mm: Fix for PG_reserved page flag clearing
Subsystems (2)
PATCH 1/1 mm: Fix for PG_reserved page flag clearing
From: Masayoshi Mizuma <[email protected]>
struct page is inizialized as zero in __init_single_page(). If the page is offlined page, PG_reserved flag is set in early boot time before __init_single_page(), so we should not clear the flag.
The real problem is that we can not online the offlined page through following sysfs operation because offlined page is expected PG_reserved flag is set.
It is not needed the initialization, so remove it simply.
Code:
static int online_pages_range(unsigned long start_pfn,
...
if (PageReserved(pfn_to_page(start_pfn))) <= HERE!!
for (i = 0; i < nr_pages; i++) {
page = pfn_to_page(start_pfn + i);
(*online_page_callback)(page);
onlined_pages++;
sysfs operation:# echo online > /sys/devices/system/node/node2/memory12288/online # cat /sys/devices/system/node/node2/memory12288/online 1 # cat /sys/devices/system/node/node2/meminfo Node 2 MemTotal: 0 kB
--- mm/page_alloc.c | 1 - 1 file changed, 1 deletion(-)
mm/page_alloc.c +0 -1
@@ -1179,7 +1179,6 @@ static void free_one_page(struct zone *zone,static void __meminit __init_single_page (struct page *page,unsigned long pfn,unsigned long zone,int nid) { -mm_zero_struct_page (page);set_page_links (page, zone, nid, pfn);init_page_count (page);page_mapcount_reset (page);
Signature · 9 lines
2.16.1 - Masayoshi -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Michal Hocko
reviewerQuoted 22 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
struct page is inizialized as zero in
__init_single_page(). If the page is offlined page,PG_reservedflag is set in early boot time before__init_single_page(), so we should not clear the flag.The real problem is that we can not online the offlined page through following sysfs operation because offlined page is expected
PG_reservedflag is set.
It is not needed the initialization, so remove it simply.Code:
static int online_pages_range(unsigned long start_pfn, ... if (PageReserved(pfn_to_page(start_pfn))) <= HERE!! for (i = 0; i < nr_pages; i++) { page = pfn_to_page(start_pfn + i); (*online_page_callback)(page); onlined_pages++; sysfs operation:
Quoted 5 lines
# echo online > /sys/devices/system/node/node2/memory12288/online # cat /sys/devices/system/node/node2/memory12288/online 1 # cat /sys/devices/system/node/node2/meminfo Node 2 MemTotal: 0 kB
Nack. The patch is simply wrong. We do need to zero page for the boot pages. I believe the fix you are looking for is 9bb5a391f9a5 ("mm,memory_hotplug: fix memmap initialization"). Or do you still see a problem with this patch applied?
Quoted 22 lines
Fixes f7f99100d8d9 ("mm: stop zeroing memory during allocation in vmemmap")Signed-off-by Masayoshi Mizuma <[email protected]>--- mm/page_alloc.c | 1 - 1 file changed, 1 deletion(-)mm/page_alloc.c +0
-1@@ -1179,7 +1179,6 @@ static void free_one_page(struct zone *zone,static void __meminit __init_single_page (struct page *page,unsigned long pfn,unsigned long zone,int nid) { -mm_zero_struct_page (page);set_page_links (page, zone, nid, pfn);init_page_count (page);page_mapcount_reset (page);Signature · 3 lines
2.16.1 - Masayoshi
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hello Michal,
Quoted 29 lines · Mon, 19 Feb 2018 18:19:16 +0100 Michal Hocko wrote:
Quoted 22 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
struct page is inizialized as zero in
__init_single_page(). If the page is offlined page,PG_reservedflag is set in early boot time before__init_single_page(), so we should not clear the flag.The real problem is that we can not online the offlined page through following sysfs operation because offlined page is expected
PG_reservedflag is set.
It is not needed the initialization, so remove it simply.Code:
static int online_pages_range(unsigned long start_pfn, ... if (PageReserved(pfn_to_page(start_pfn))) <= HERE!! for (i = 0; i < nr_pages; i++) { page = pfn_to_page(start_pfn + i); (*online_page_callback)(page); onlined_pages++; sysfs operation:Quoted 5 lines
# echo online > /sys/devices/system/node/node2/memory12288/online # cat /sys/devices/system/node/node2/memory12288/online 1 # cat /sys/devices/system/node/node2/meminfo Node 2 MemTotal: 0 kB
Quoted 4 lines
Nack. The patch is simply wrong. We do need to zero page for the boot pages. I believe the fix you are looking for is
9bb5a391f9a5("mm,memory_hotplug: fix memmap initialization"). Or do you still see a problem with this patch applied?
I have confirmed the problem is fixed by your patch 9bb5a391f9a5. (I had tested it in 4.15.2, so I did not notice your patch, sorry)
Thank you for the fix!
- Masayoshi
Quoted 22 lines
Quoted 22 lines
Fixes f7f99100d8d9 ("mm: stop zeroing memory during allocation in vmemmap")Signed-off-by Masayoshi Mizuma <[email protected]>--- mm/page_alloc.c | 1 - 1 file changed, 1 deletion(-)mm/page_alloc.c +0
-1@@ -1179,7 +1179,6 @@ static void free_one_page(struct zone *zone,static void __meminit __init_single_page (struct page *page,unsigned long pfn,unsigned long zone,int nid) { -mm_zero_struct_page (page);set_page_links (page, zone, nid, pfn);init_page_count (page);page_mapcount_reset (page);Signature · 1 line
2.16.1
Quoted 2 lines
Quoted 1 line
- Masayoshi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Michal Hocko
reviewerQuoted 32 lines · Masayoshi Mizuma
Hello Michal,
Quoted 29 lines · Mon, 19 Feb 2018 18:19:16 +0100 Michal Hocko wrote:
Quoted 27 lines · Masayoshi Mizuma
From: Masayoshi Mizuma <[email protected]>
struct page is inizialized as zero in
__init_single_page(). If the page is offlined page,PG_reservedflag is set in early boot time before__init_single_page(), so we should not clear the flag.The real problem is that we can not online the offlined page through following sysfs operation because offlined page is expected
PG_reservedflag is set.
It is not needed the initialization, so remove it simply.Code:
static int online_pages_range(unsigned long start_pfn, ... if (PageReserved(pfn_to_page(start_pfn))) <= HERE!! for (i = 0; i < nr_pages; i++) { page = pfn_to_page(start_pfn + i); (*online_page_callback)(page); onlined_pages++; sysfs operation:# echo online > /sys/devices/system/node/node2/memory12288/online # cat /sys/devices/system/node/node2/memory12288/online 1 # cat /sys/devices/system/node/node2/meminfo Node 2 MemTotal: 0 kB
Quoted 7 lines
Quoted 4 lines
Nack. The patch is simply wrong. We do need to zero page for the boot pages. I believe the fix you are looking for is
9bb5a391f9a5("mm,memory_hotplug: fix memmap initialization"). Or do you still see a problem with this patch applied?I have confirmed the problem is fixed by your patch
9bb5a391f9a5. (I had tested it in 4.15.2, so I did not notice your patch, sorry)
I have posted the backport for the 4.15 stable tree just an hour ago so it should appear in the next stable release.
Thanks for double checking.
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>