From: Oscar Salvador <osalvador@suse.de>
To: Qian Cai <cai@lca.pw>
Cc: akpm@linux-foundation.org, catalin.marinas@arm.com,
vbabka@suse.cz, mhocko@suse.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] mm/hotplug: invalid PFNs from pfn_to_online_page()
Date: Tue, 22 Jan 2019 11:46:24 +0100 [thread overview]
Message-ID: <20190122104621.khvcpwz6vucmpthr@d104.suse.de> (raw)
In-Reply-To: <20190121212747.23029-1-cai@lca.pw>
On Mon, Jan 21, 2019 at 04:27:47PM -0500, Qian Cai wrote:
> Fixes: 9f1eb38e0e11 ("mm, kmemleak: little optimization while scanning")
> Acked-by: Michal Hocko <mhocko@suse.com>
> Signed-off-by: Qian Cai <cai@lca.pw>
Heh, I guess that it comes in handy to have a machine with CONFIG_HOLES_IN_ZONE
enabled.
I totally missed the fact that systems with such configuration can have
uninitialized pages even if the section is online.
To be honest, I blindly thought that if a section was online, that means
that all its pages were initialized properly.
Thanks for fixing it:
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
>
> v3: change the "Fixes" line.
> v2: update the changelog; keep the bound check; use pfn_valid_within().
>
> include/linux/memory_hotplug.h | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index 07da5c6c5ba0..cdeecd9bd87e 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -21,14 +21,15 @@ struct vmem_altmap;
> * walkers which rely on the fully initialized page->flags and others
> * should use this rather than pfn_valid && pfn_to_page
> */
> -#define pfn_to_online_page(pfn) \
> -({ \
> - struct page *___page = NULL; \
> - unsigned long ___nr = pfn_to_section_nr(pfn); \
> - \
> - if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr))\
> - ___page = pfn_to_page(pfn); \
> - ___page; \
> +#define pfn_to_online_page(pfn) \
> +({ \
> + struct page *___page = NULL; \
> + unsigned long ___nr = pfn_to_section_nr(pfn); \
> + \
> + if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr) && \
> + pfn_valid_within(pfn)) \
> + ___page = pfn_to_page(pfn); \
> + ___page; \
> })
>
> /*
> --
> 2.17.2 (Apple Git-113)
>
--
Oscar Salvador
SUSE L3
prev parent reply other threads:[~2019-01-22 10:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 21:27 Qian Cai
2019-01-22 6:58 ` Michal Hocko
2019-01-22 10:46 ` Oscar Salvador [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=20190122104621.khvcpwz6vucmpthr@d104.suse.de \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=vbabka@suse.cz \
/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