[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e00ee9f5-0f02-6463-bc84-b94c17f488bc@redhat.com>
Date: Thu, 25 May 2023 18:45:07 +0200
From: David Hildenbrand <david@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
David Howells <dhowells@...hat.com>
Cc: 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 25.05.23 18:31, Linus Torvalds wrote:
> On Wed, May 24, 2023 at 1:47 AM David Howells <dhowells@...hat.com> wrote:
>>
>> True - but I was thinking of just treating the zero_page specially and never
>> hold a pin or a ref on it. It can be checked by address, e.g.:
>>
>> static inline void bio_release_page(struct bio *bio, struct page *page)
>> {
>> if (page == ZERO_PAGE(0))
>> return;
>
> That won't actually work.
>
> We do have cases that try to use the page coloring that we support.
>
> Admittedly it seems to be only rmda that does it directly with
> something like this:
>
> vmf->page = ZERO_PAGE(vmf->address);
>
> but you can get arbitrary zero pages by pinning or GUPing them from
> user space mappings.
>
> Now, the only architectures that *use* multiple zero pages are - I
> think - MIPS (including Loongarch) and s390.
>
> So it's rare, but it does happen.
I think the correct way to test for a zero page is
is_zero_pfn(page_to_pfn(page).
Using my_zero_pfn(vmf->address) in do_anonymous_page() these can easily
end up in any process.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists