Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1726357pxj; Sun, 16 May 2021 02:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCctsGADrBjGGmK6VeVVTpz0yWEXTsqjTauzVukBHPBCNHvVF9+MrPpPuI+m2FNcobWfER X-Received: by 2002:a50:cc8f:: with SMTP id q15mr63881392edi.322.1621156301066; Sun, 16 May 2021 02:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621156301; cv=none; d=google.com; s=arc-20160816; b=orzkgl7tgFwKb6RjdInL66VZ+bVprtKrYUe96gvt+N9U05NZXq0ZWaMyxO83puIyx1 Q2kDaCwbRqEZK3r56BT7ZkeTOQebDaGYl2sl0d/X7NFnWQDLhZsNjWEbstA2rJ9LHG3w Y4/Rg/9jQcTF2ERCI+BwYSJjQ/YStr3zD8J2XDKHOYeYB7qBY9/1PqkScvR805qLI0Xg MBHxZNebBZvNPgooeCHEFEyKhCsIv/YyXE4GrD61mtbySluNQpfmesKC3laVIKUSHNIl 1ApasSxU9ld769ZsvNR+ehz+upfA4LdHYC2IBedl0VpHYI19AQYTv65eIgh+LNgT4VVR OAuw== 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=9XOLX3lclxqmOizJHcYJXn5gUXcoNsJjjPeZ7bAkGuo=; b=HIpGrQiXHXv0PbyL448rImYC0aLMLrDS0pne0ESH2P/K+0eJx/94Q/xASserK2RZEd h02PjRWJVAZ7mfW/Kgty9MDiyQsCbr4dIq7tDLFaFNoekVc1FNz5IQwKeAX0Ji4u978c cXGeDqZBIWevez1vT/rb5p8KOj00O4FnAK+lF0+7bV1ndzgIk2hLUObQVFuIqA8kmSTA 37nPzrPtyNnRiVyHzpicR24Wnu3IxZqPPPZex/E9PELGggalVsT3p3tMJt6uC0ylOfTC qx4N0cw55MUP/8gIh85kTdoBN+CwScuo1W+syF58bCmh54URwyZ6H7Bukf0Y4o5Q4Edp s4/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Oj4pfQCx; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d14si11290252edk.117.2021.05.16.02.11.09; Sun, 16 May 2021 02:11:41 -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=@infradead.org header.s=casper.20170209 header.b=Oj4pfQCx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234828AbhEOUPu (ORCPT + 99 others); Sat, 15 May 2021 16:15:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231280AbhEOUPq (ORCPT ); Sat, 15 May 2021 16:15:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DC25C061573; Sat, 15 May 2021 13:14:33 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).