From: Vlastimil Babka <vbabka@suse.cz>
To: akpm@linux-foundation.org, linux-mm@kvack.org, jcuster@sgi.com,
isimatu.yasuaki@jp.fujitsu.com, kamezawa.hiroyu@jp.fujitsu.com,
rja@sgi.com, stable@vger.kernel.org
Subject: Re: [patch 4/6] mm: fix invalid use of pfn_valid_within in test_pages_in_a_zone
Date: Tue, 13 Jan 2015 11:04:13 +0100 [thread overview]
Message-ID: <54B4ED9D.8050109@suse.cz> (raw)
In-Reply-To: <548f68bb.wuNDZDL8qk6xEWTm%akpm@linux-foundation.org>
On 12/16/2014 12:03 AM, akpm@linux-foundation.org wrote:
> From: James Custer <jcuster@sgi.com>
> Subject: mm: fix invalid use of pfn_valid_within in test_pages_in_a_zone
>
> Offlining memory by 'echo 0 > /sys/devices/system/memory/memory#/online'
> or reading valid_zones 'cat
> /sys/devices/system/memory/memory#/valid_zones' causes BUG: unable to
> handle kernel paging request due to invalid use of pfn_valid_within. This
> is due to a bug in test_pages_in_a_zone.
It would still be useful to show the BUG, and provide /proc/zoneinfo for us to
see where are the corner cases.
> In order to use pfn_valid_within within a MAX_ORDER_NR_PAGES block of
> pages, a valid pfn within the block must first be found. There only needs
> to be one valid pfn found in test_pages_in_a_zone in the first place. So
> the fix is to replace pfn_valid_within with pfn_valid such that the first
> valid pfn within the pageblock is found (if it exists). This works
> independently of CONFIG_HOLES_IN_ZONE.
>
> Signed-off-by: James Custer <jcuster@sgi.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Russ Anderson <rja@sgi.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/memory_hotplug.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff -puN mm/memory_hotplug.c~mm-fix-invalid-use-of-pfn_valid_within-in-test_pages_in_a_zone mm/memory_hotplug.c
> --- a/mm/memory_hotplug.c~mm-fix-invalid-use-of-pfn_valid_within-in-test_pages_in_a_zone
> +++ a/mm/memory_hotplug.c
> @@ -1331,7 +1331,7 @@ int is_mem_section_removable(unsigned lo
> }
>
> /*
> - * Confirm all pages in a range [start, end) is belongs to the same zone.
> + * Confirm all pages in a range [start, end) belong to the same zone.
> */
> int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn)
> {
> @@ -1342,10 +1342,11 @@ int test_pages_in_a_zone(unsigned long s
> for (pfn = start_pfn;
> pfn < end_pfn;
> pfn += MAX_ORDER_NR_PAGES) {
> - i = 0;
> - /* This is just a CONFIG_HOLES_IN_ZONE check.*/
> - while ((i < MAX_ORDER_NR_PAGES) && !pfn_valid_within(pfn + i))
> - i++;
> + /* Find the first valid pfn in this pageblock */
> + for (i = 0; i < MAX_ORDER_NR_PAGES; i++) {
> + if (pfn_valid(pfn + i))
> + break;
> + }
> if (i == MAX_ORDER_NR_PAGES)
> continue;
> page = pfn_to_page(pfn + i);
> _
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2015-01-13 10:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 23:03 [patch 4/6] mm: fix invalid use of pfn_valid_within in test_pages_in_a_zone akpm
2014-12-17 23:40 ` David Rientjes
2014-12-18 17:16 ` James Custer
2015-01-05 17:27 ` James Custer
2015-01-13 10:18 ` Vlastimil Babka
2015-01-13 10:04 ` Vlastimil Babka [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=54B4ED9D.8050109@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=jcuster@sgi.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=rja@sgi.com \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.