[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <144598.1685034915@warthog.procyon.org.uk>
Date:   Thu, 25 May 2023 18:15:15 +0100
From:   David Howells <dhowells@...hat.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     dhowells@...hat.com, David Hildenbrand <david@...hat.com>,
        Christoph Hellwig <hch@...radead.org>,
        Jens Axboe <axboe@...nel.dk>,
        Al Viro <viro@...iv.linux.org.uk>,
        Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
        Jeff Layton <jlayton@...nel.org>,
        Jason Gunthorpe <jgg@...dia.com>,
        Logan Gunthorpe <logang@...tatee.com>,
        Hillf Danton <hdanton@...a.com>,
        Christian Brauner <brauner@...nel.org>,
        linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: Extending page pinning into fs/direct-io.c
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> So I suspect we should add that
> 
>     is_zero_pfn(page_to_pfn(page))
> 
> as a helper inline function rather than write it out even more times
> (that "is this 'struct page' a zero page" pattern already exists in
> /proc and a few other places.
> 
> is_longterm_pinnable_page() already has it, so adding it as a helper
> there in <linux/mm.h> is probably a good idea.
I just added:
static inline bool IS_ZERO_PAGE(const struct page *page)
{
	return is_zero_pfn(page_to_pfn(page));
}
static inline bool IS_ZERO_FOLIO(const struct folio *folio)
{
	return is_zero_pfn(page_to_pfn((const struct page *)folio));
}
to include/linux/pgtable.h.  It doesn't seem I can add it to mm.h as an inline
function.
David
Powered by blists - more mailing lists
 
