Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6716127rdb; Fri, 15 Dec 2023 06:37:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFj1L53kbO7GJP+1ZeFWG+uqa/mCLnGg5Lg8EnEgZ+z3QE6zFzE69ZYZL3OysmK7mhTXSJ1 X-Received: by 2002:a17:907:9686:b0:a18:92db:282b with SMTP id hd6-20020a170907968600b00a1892db282bmr7518973ejc.39.1702651025020; Fri, 15 Dec 2023 06:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702651024; cv=none; d=google.com; s=arc-20160816; b=Pn//3gQbREpfaptqHTg/kwthfHktkTfG9PiwQjXhnyH/CI4JQeq7JMq3vSFP6rxCnb 4PtG14kWhxJG9lZORKq+vFXmplaRdcCOM+/zlB3wc84UWhXjmxRrdc1hqP2ZT++86UX9 A2Uw4Ay8FRzJvSpv8o6eO7bF8xe8wFeLfqSQxqHDjeER5WF53SRtDuMTUvJSeNZrXa2l b8QY+UcPEyLPG3H5+/41wS0vDgHJPCYQ/kzrotf1Fr/r26NytwGkC+25rtOVd/OXLm6r 5Wo26EH/0s3WFN8/MdDjUScpGR6GJc/TSopZsOlV0TBKvz8DZKB3ftol/mCGOyhBUBdz 27MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Y5+Oppl7Eai1Gazn1zCuzXFdRsqsodfM2YwuFgSvpsg=; fh=DyomxaBgMa6U6d0vOPXFEfW0ftijWLX4EGqcATAhPwc=; b=YZhDwdRtJqGyJb1Jw+UP2kHdSHhZPoLDEvTzBkRM3ZqboQbkZFQI4kzh6As7XyOHV/ JQCBwLjxSLU3CcVaIKo3Uj+XbdM3+uC21Sv/fz3J0Gk/5wGehUxOUmtiBh16Tk+r8s8/ YrOWTv4lEGJ0THziRDyuRWLiSu3dF3PtRGOSBbf7TGMzN03hxp1p3k1QxpRGenir03XV Vg2qwh1JIoOvJNcna7g2aIO4nmlH6YsezUfD0HlNBXTFlQd7nDHo2EodpMttSJultvYV sjQYXyO3He1spO5RdZ/ZPmI5MeGmycDmw4IctHsJiMYfL3p/r6nt9S1Y1vQa9LoU1Z8S L7/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ug3ZjL5M; spf=pass (google.com: domain of linux-kernel+bounces-1110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1110-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x21-20020a170906711500b00a230ff24d3csi1468650ejj.968.2023.12.15.06.37.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 06:37:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ug3ZjL5M; spf=pass (google.com: domain of linux-kernel+bounces-1110-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1110-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A1D041F24C8B for ; Fri, 15 Dec 2023 14:36:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E424A358AE; Fri, 15 Dec 2023 14:36:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ug3ZjL5M" X-Original-To: linux-kernel@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71AC835884; Fri, 15 Dec 2023 14:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Y5+Oppl7Eai1Gazn1zCuzXFdRsqsodfM2YwuFgSvpsg=; b=Ug3ZjL5M6NrwtZt79VjTUklG89 p324KBMNXDZ9PyVJL5d9VJQzrpkhVQVjDoPYuBg84iNi5li9ab/Jf8uWuHlKXLSDtNHPWW/61eSe4 AG+ddXJDIiYlF83agu24wcF3axsI/tntMA5yMIeT6sJDqV6nLltFlbDLEEfVcQNFPmCIMl1r+Iatd +PnlFxsBbjFN2RzA03CMPm2e/kelhrTuQuFv3wV/5uX5EFXpF2iq3p6UIV30xzQexsNBGx8tcahNa sZE7TnlMcn8x5rc2Z31SeqL7s3LcXHeVHSg/fUmeRdmWC/ytc/ioSHvv/I0y0fkTEsrgZNc2G9MPZ sBCHaH5Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rE9Ib-000I0J-Tu; Fri, 15 Dec 2023 14:36:22 +0000 Date: Fri, 15 Dec 2023 14:36:21 +0000 From: Matthew Wilcox To: "Fabio M. De Francesco" Cc: Jonathan Corbet , "Mike Rapoport (IBM)" , Bagas Sanjaya , Lorenzo Stoakes , Lukas Bulwahn , Kim Phillips , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Documentation/mm: Describe folios in physical_memory.rst Message-ID: References: <20231215120022.2010667-1-fabio.maria.de.francesco@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231215120022.2010667-1-fabio.maria.de.francesco@linux.intel.com> On Fri, Dec 15, 2023 at 01:00:12PM +0100, Fabio M. De Francesco wrote: > +A folio is a physically, virtually and logically contiguous set 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. If it is in the page cache, it is > +at a file offset which is a multiple of that power-of-two. It may be > +mapped into userspace at an address which is at an arbitrary page offset, > +but its kernel virtual address is aligned to its size. This text is verbatim from include/linux/mm_types.h. It seems sad to have kernel-doc and then replicate it in an rst file. > +As Matthew Wilcox explains in his introduction to folios, the need for oof, no, don't mention my name. > +`struct folio` arises mostly to address issues with the use of compound > +pages. It is often unclear whether a function operates on an individual > +page, or an entire compound page. > + > +"A function which has a `struct page` pointer argument might be > +expecting a head or base page and will BUG if given a tail page. It might > +work with any kind of page and operate on %PAGE_SIZE bytes. It might work > +with any kind of page and operate on page_size() bytes if given a head > +page but %PAGE_SIZE bytes if given a base or tail page. It might operate > +on page_size() bytes if passed a head or tail page. We have examples of > +all of these today.". > + > +A pointer to folio points to a page that is never a tail page. It > +represents an entire compound page. Therefore, there is no need to call > +compound_head() to get a pointer to the head. Folios has eliminted the > +need to unnecessary calls and has avoided bugs related to the misuse of > +pages passed to functions. Furthermore, the inline compound_head() makes > +the kernel bigger and slows things down. > + > +The folio APIs are described in the "Memory Management APIs" document. This was exactly the kind of documentation I was hoping you wouldn't write ;-( It's documentation that makes sense today, but won't in five years time. We want to say something like, A folio represents a single memory allocation. It may be composed of several pages ...