Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp593976pxb; Wed, 1 Sep 2021 06:05:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3jjBdq0k3OzboMyy09K+rraNjpULN1s41upmjUzurLvsU5xutwLkCL1SpzvqelZwvifKM X-Received: by 2002:a05:6402:5154:: with SMTP id n20mr35063102edd.33.1630501542309; Wed, 01 Sep 2021 06:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630501542; cv=none; d=google.com; s=arc-20160816; b=c6p+SDPJzPvbLtfeLSXjiXg9oU7I7l+mmfudenpyulsBkqiOh5qMxOYpLsX812tQnS DA/ycSzf3QkP1nFAs2keDeTXT2MQkmuduaHdAHflXjzEWpZv5EUpWjdBUcOoIYD6OBmz TJORUtXF4RStwCw1KFnxRDqlzjHwOE0K5V+0z9Az1ZGrmXxRirMpeL0a3aP2t3JsHE2S r5PqX457VPhoN5gQze+ce6U8O7xnhwxy8CBeq/2A8eeOyjWmigQo4OvtqUaAETjdmvhM eu+sli+jd1AOr8r2/VpIjE8dfQr8bWWMSsnLNeoDbNhIk4kyunQA/TFZROq6Nk+RZdwC Jt9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Nd3qcy/mw3wC18J6QDNkZPhFIiE9G+6827MVrHGl9SU=; b=h2Kq2+gI34862uIvfopH09dU6DxpRSdxzap8p7+65AJ1iYMCPaW6iBBk/nWej8acPa vaM2ayA4L+U23grbq575Hy3P4asbiqlimoZf1CAzCu+62oqdUE0u1pQTjAPDyqa5rPj2 CHiH6HYq7j5YY1hp8YPufaGPih+Ld3y1CMIa1rwfGO9zdwGj/sJ3zf+s+au5CsVj3Zdh eeruWSPJoWwkcUF4K5qIxBY5K5UVv4RSGpc4vstc7pwBcWJMjVGFuerzWsv30VE5OsbX eDQmPcgqIL68+7PSCAxhRjDz8bMbvQ6+KotNPElJTPCmbCpz2veL8trZrVVcBH5ReyV/ uc3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hlHStViL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di14si23160478ejc.680.2021.09.01.06.04.59; Wed, 01 Sep 2021 06:05:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hlHStViL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343744AbhIANC6 (ORCPT + 99 others); Wed, 1 Sep 2021 09:02:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:60162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344530AbhIAM7k (ORCPT ); Wed, 1 Sep 2021 08:59:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 53C5360F23; Wed, 1 Sep 2021 12:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630501123; bh=Fs+Ei850S/AfoXruaZpaxBAI0iXC8n1giB7EbO3rJOU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hlHStViLm82AieCjlQ46Lrn2UwKHUxLtsmClsGnjxYRfnQXXD0Cr+m1obtcWVRCHE NyvGl2K0GNeWXci3i2flnId7bgYcRxv1ebOmm/UJEuqDwjVJDzDSKKKOqFbqA8ncX6 Ux/CtirmtcVQyrOyeYxJne4Vl1Zr3M9sK1/hVAqouPZhA48uBQFE1Vb44FiZLw3mOf thlPffimqvhwVJTLbeKvlHCp+YVKzDpGPLUa0fXtnSoonHguDczvjQVeX2A8u6MAro 1Ur2rnheW/kJ9bYC66eJSxO2Wt4cKh9dp0qHn4S6ygN89/yTQc9p/TlZd0kncL2nJh tEhBtqqOl1nqg== Date: Wed, 1 Sep 2021 15:58:37 +0300 From: Mike Rapoport To: Theodore Ts'o Cc: Matthew Wilcox , Linus Torvalds , David Howells , Johannes Weiner , Linux-MM , linux-fsdevel , Linux Kernel Mailing List , Andrew Morton Subject: Re: [GIT PULL] Memory folios for v5.15 Message-ID: References: <1957060.1629820467@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 24, 2021 at 03:44:48PM -0400, Theodore Ts'o wrote: > On Tue, Aug 24, 2021 at 08:23:15PM +0100, Matthew Wilcox wrote: > > So if someone sees "kmem_cache_alloc()", they can probably make a > guess what it means, and it's memorable once they learn it. > Similarly, something like "head_page", or "mempages" is going to a bit > more obvious to a kernel newbie. So if we can make a tiny gesture > towards comprehensibility, it would be good to do so while it's still > easier to change the name. Talking about being newbie friendly, how about we'll just add a piece of documentation along with the new type for a change? Something along those lines (I'm sure willy can add several more sentences for Folio description) diff --git a/Documentation/vm/memory-model.rst b/Documentation/vm/memory-model.rst index 30e8fbed6914..b5b39ebe67cf 100644 --- a/Documentation/vm/memory-model.rst +++ b/Documentation/vm/memory-model.rst @@ -30,6 +30,29 @@ Each memory model defines :c:func:`pfn_to_page` and :c:func:`page_to_pfn` helpers that allow the conversion from PFN to `struct page` and vice versa. +Pages +----- + +Each physical page frame in the system is represented by a `struct page`. +This structure aggregatates several types, each corresponding to a +particular usage of a page frame, such as anonymous memory, SLAB caches, +file-backed memory etc. These types are define within unions in the struct +page to reduce memory footprint of the memory map. + +The actual type of the particular insance of struct page is determined by +values of the fields shared between the different types and can be quired +using page flag operatoins defined in ``include/linux/page-flags.h`` + +Folios +------ + +For many use cases, single page frame granularity is too small. In such +cases a contiguous range of memory can be referred by `struct folio`. + +A folio is a physically, virtually and logically contiguous range of +bytes. It is a power-of-two in size, and it is aligned to that same +power-of-two. It is at least as large as PAGE_SIZE. + FLATMEM ======= -- Sincerely yours, Mike.