From: Matthew Wilcox <willy@infradead.org>
To: Leesoo Ahn <lsahn@ooseel.net>
Cc: lsahn@wewakecorp.com, Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmzone: remove redundant exception handler on pfn_valid()
Date: Wed, 25 Sep 2024 18:59:26 +0100 [thread overview]
Message-ID: <ZvRPfiS9KTi7NPV4@casper.infradead.org> (raw)
In-Reply-To: <20240925155540.4087150-1-lsahn@ooseel.net>
On Thu, Sep 26, 2024 at 12:55:28AM +0900, Leesoo Ahn wrote:
> 1). It can ensure the upper PAGE_SHIFT'ed bits of PHYS_PFN(..) are clear
> by the C11 standard:
I don't think you understand the purpose of the code you're removing.
> +++ b/include/linux/mmzone.h
> @@ -2028,15 +2028,6 @@ static inline int pfn_valid(unsigned long pfn)
> struct mem_section *ms;
> int ret;
>
> - /*
> - * Ensure the upper PAGE_SHIFT bits are clear in the
> - * pfn. Else it might lead to false positives when
> - * some of the upper bits are set, but the lower bits
> - * match a valid pfn.
> - */
> - if (PHYS_PFN(PFN_PHYS(pfn)) != pfn)
> - return 0;
Let's assume that the pfn being asked about is 0x8000'0000'0000'1234.
The actually valid PFNs are only 0-0x1000'0000. This function should
return false. With your change, it will retrun true because it'll
only check the bottom 52 bits, and ignore that some of the top 12 bits
are set.
prev parent reply other threads:[~2024-09-25 17:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 15:55 Leesoo Ahn
2024-09-25 17:59 ` Matthew Wilcox [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZvRPfiS9KTi7NPV4@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lsahn@ooseel.net \
--cc=lsahn@wewakecorp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox