[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=wirrJNoVSOSVK2ae9pa7Q5kJKFYMk2ad-_6YrS1cEScqA@mail.gmail.com>
Date: Thu, 25 May 2023 10:25:42 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: David Howells <dhowells@...hat.com>
Cc: 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
On Thu, May 25, 2023 at 10:15 AM David Howells <dhowells@...hat.com> wrote:
>
> It doesn't seem I can add it to mm.h as an inline function.
What? We already have that pattern inside is_longterm_pinnable_page(),
so that's really strange.
But regardless, please don't duplicate that odd conditional for no
reason, and don't scream.
So regardless of where it is, make that "is_zero_folio()" just do
"is_zero_page(&folio->page)" rather than repeat the question.
I also wonder whether we shouldn't just use the "transparent union"
argument thing more aggressively. Something like
typedef union {
struct page *page;
struct folio *folio;
} page_or_folio_t __attribute__ ((__transparent_union__));
and then you should be able to do something like this:
static inline bool is_zero_page(const page_or_folio_t arg)
{
return is_zero_pfn(page_to_pfn(arg.page));
}
and we don't have to keep generating the two versions over and over
and over again.
Linus
Powered by blists - more mailing lists