Re: Extending page pinning into fs/direct-io.c

From: Linus Torvalds
Date: Thu May 25 2023 - 13:25:10 EST

On Thu, May 25, 2023 at 10:07 AM David Howells <dhowells@xxxxxxxxxx> wrote:
> Should everywhere that is using ZERO_PAGE(0) actually be using my_zero_pfn()?

No, that would just make code uglier for no reason, because then you
have to turn that pfn into a virtual address.

So if what you *want* is a pfn to begin with, then use, use my_zero_pfn().

But if what you want is just the virtual address, use ZERO_PAGE().

And if you are going to map it at some address, give it the address
you're going to use, otherwise just do zero for "whatever".

The only thing you can't use ZERO_PAGE(0) for is literally that "is
this a zero page" address comparison, because ZERO_PAGE(0) is just
_one_ address.