From: Michal Hocko <mhocko@kernel.org>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
yinghai@kernel.org, linux-mm@kvack.org, hejianet@gmail.com,
"3 . 12+" <stable@vger.kernel.org>
Subject: Re: [PATCH] mm/memblock: fix potential issue in memblock_search_pfn_nid()
Date: Tue, 3 Apr 2018 13:30:41 +0200 [thread overview]
Message-ID: <20180403113041.GP5501@dhcp22.suse.cz> (raw)
In-Reply-To: <20180402015026.GA32938@WeideMacBook-Pro.local>
On Mon 02-04-18 09:50:26, Wei Yang wrote:
> On Fri, Mar 30, 2018 at 01:57:27PM -0700, Andrew Morton wrote:
> >On Fri, 30 Mar 2018 11:30:55 +0800 Wei Yang <richard.weiyang@gmail.com> wrote:
> >
> >> memblock_search_pfn_nid() returns the nid and the [start|end]_pfn of the
> >> memory region where pfn sits in. While the calculation of start_pfn has
> >> potential issue when the regions base is not page aligned.
> >>
> >> For example, we assume PAGE_SHIFT is 12 and base is 0x1234. Current
> >> implementation would return 1 while this is not correct.
> >
> >Why is this not correct? The caller might want the pfn of the page
> >which covers the base?
> >
>
> Hmm... the only caller of memblock_search_pfn_nid() is __early_pfn_to_nid(),
> which returns the nid of a pfn and save the [start_pfn, end_pfn] with in the
> same memory region to a cache. So this looks not a good practice to store
> un-exact pfn in the cache.
>
> >> This patch fixes this by using PFN_UP().
> >>
> >> The original commit is commit e76b63f80d93 ("memblock, numa: binary search
> >> node id") and merged in v3.12.
> >>
> >> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> >> Cc: 3.12+ <stable@vger.kernel.org>
> >
> >Please fully describe the runtime effects of a bug when fixing that
> >bug. This description doesn't give enough justification for merging
> >the patch into mainline, let alone -stable.
>
> Since PFN_UP() and PFN_DOWN() differs when the address is not page aligned, in
> theory we may have two situations like below.
Have you ever seen a HW that would report page unaligned memory ranges?
Is this even possible?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-04-03 11:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-30 3:30 [PATCH] mm/memblock: fix potential issue in memblock_search_pfn_nid() Wei Yang
2018-03-30 20:57 ` Andrew Morton
2018-04-02 1:50 ` Wei Yang
2018-04-03 11:30 ` Michal Hocko [this message]
2018-04-04 1:33 ` Wei Yang
2018-04-04 5:45 ` Michal Hocko
2018-04-06 1:35 ` Wei Yang
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=20180403113041.GP5501@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hejianet@gmail.com \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.com \
--cc=stable@vger.kernel.org \
--cc=yinghai@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).