From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01DF7C433ED for ; Sat, 15 May 2021 20:14:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 83D4561369 for ; Sat, 15 May 2021 20:14:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83D4561369 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7DEA66B00A8; Sat, 15 May 2021 16:14:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78FB86B00A9; Sat, 15 May 2021 16:14:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62F2B6B00AA; Sat, 15 May 2021 16:14:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id 32EE36B00A8 for ; Sat, 15 May 2021 16:14:53 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BE7D8180AD81A for ; Sat, 15 May 2021 20:14:52 +0000 (UTC) X-FDA: 78144568824.15.8D9A3E7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 3B73440002D1 for ; Sat, 15 May 2021 20:14:51 +0000 (UTC) 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=9XOLX3lclxqmOizJHcYJXn5gUXcoNsJjjPeZ7bAkGuo=; b=Oj4pfQCxOYIZIubFOGoWq6QKrD TXlHtKiOnJrrhh/3J91qwZ1heaYZ3Hh3Vjdd2biF9hsgZlCTrm8UDfxTUY75yPdahRhGixtnZVd57 bpUHb8y+8jPqTUeFIAjziupW2Btwa+r37TZkPiGwU9LgcdW/grnik4JI9/T+loxEH7P4J2A8YHunB B23UcDF1qZyQDBieq+/PhzTk8uO0X93IXiqF8deZvZkFO67Rw/Yk1p5G8CYHoz6fiFI0SRIYupArf 3trdgjNQz0SMbk+2hZxUTgZiFjMnVy8wSKHMPSorSdJWkbXfwUbs9ityUlaaGeDBZcDvMKn9PeVMF vhETKKZA==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1li0ft-00BUME-LY; Sat, 15 May 2021 20:14:17 +0000 Date: Sat, 15 May 2021 21:14:13 +0100 From: Matthew Wilcox To: William Kucharski Cc: Andrew Morton , Linux-Fsdevel , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Jeff Layton Subject: Re: [PATCH v10 01/33] mm: Introduce struct folio Message-ID: References: <20210511214735.1836149-1-willy@infradead.org> <20210511214735.1836149-2-willy@infradead.org> <0FF7A37F-80A8-4B49-909D-6234ADA8A25C@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0FF7A37F-80A8-4B49-909D-6234ADA8A25C@oracle.com> Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Oj4pfQCx; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3B73440002D1 X-Stat-Signature: nbtiyhhytsm6bpadsb9zmyaatqrdwqcg X-HE-Tag: 1621109691-437327 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, May 15, 2021 at 10:55:19AM +0000, William Kucharski wrote: > > +/** > > + * folio_page - Return a page from a folio. > > + * @folio: The folio. > > + * @n: The page number to return. > > + * > > + * @n is relative to the start of the folio. It should be between > > + * 0 and folio_nr_pages(@folio) - 1, but this is not checked for. > > Please add a statement noting WHY @n isn't checked since you state it > should be. Something like "...but this is not checked for because this is > a hot path." Hmm ... how about this: /** * folio_page - Return a page from a folio. * @folio: The folio. * @n: The page number to return. * * @n is relative to the start of the folio. This function does not * check that the page number lies within @folio; the caller is presumed * to have a reference to the page. */ #define folio_page(folio, n) nth_page(&(folio)->page, n) It occurred to me that it is actually useful (under some circumstances) for referring to a page outside the base folio. For example when dealing with bios that have merged consecutive pages together into a single bvec (ok, bios don't use folios, but it would be reasonable if they did in future).