linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
@ 2022-01-17 14:27 Chen Wandun
  2022-01-17 15:32 ` David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Chen Wandun @ 2022-01-17 14:27 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel, guillaume.tucker

This reverts commit 075782149abff45ee22f27315eced44d02b96779.

commit 075782149abf ("mm/page_isolation: unset migratetype directly for
non Buddy page") will result memory that should in buddy disappear by
mistake. move_freepages_block move all pages in pageblock instead of
pages indicated by input parameter, so if input pages is not in buddy
but other pages in pageblock is in buddy, it will result in page out of
control.

Reported-by: "kernelci.org bot" <bot@kernelci.org>
Signed-off-by: Chen Wandun <chenwandun@huawei.com>
---
 mm/page_isolation.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 6a0ddda6b3c5..f67c4c70f17f 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
 	 * onlining - just onlined memory won't immediately be considered for
 	 * allocation.
 	 */
-	if (!isolated_page && PageBuddy(page)) {
+	if (!isolated_page) {
 		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
 		__mod_zone_freepage_state(zone, nr_pages, migratetype);
 	}
-- 
2.18.0.huawei.25



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-17 14:27 [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page" Chen Wandun
@ 2022-01-17 15:32 ` David Hildenbrand
  2022-01-26  2:17   ` Chen Wandun
  2022-01-18 13:50 ` Dong Aisheng
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: David Hildenbrand @ 2022-01-17 15:32 UTC (permalink / raw)
  To: Chen Wandun, akpm, linux-mm, linux-kernel, guillaume.tucker

On 17.01.22 15:27, Chen Wandun wrote:
> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
> 
> commit 075782149abf ("mm/page_isolation: unset migratetype directly for
> non Buddy page") will result memory that should in buddy disappear by
> mistake. move_freepages_block move all pages in pageblock instead of
> pages indicated by input parameter, so if input pages is not in buddy
> but other pages in pageblock is in buddy, it will result in page out of
> control.
> 

I was wondering about exactly that condition when skimming over the
patch but didn't have time review in detail.

Acked-by: David Hildenbrand <david@redhat.com>

> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> ---
>  mm/page_isolation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 6a0ddda6b3c5..f67c4c70f17f 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>  	 * onlining - just onlined memory won't immediately be considered for
>  	 * allocation.
>  	 */
> -	if (!isolated_page && PageBuddy(page)) {
> +	if (!isolated_page) {
>  		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>  		__mod_zone_freepage_state(zone, nr_pages, migratetype);
>  	}


-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-17 14:27 [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page" Chen Wandun
  2022-01-17 15:32 ` David Hildenbrand
@ 2022-01-18 13:50 ` Dong Aisheng
  2022-01-24  8:41   ` Francesco Dolcini
  2022-01-25 16:40 ` Vlastimil Babka
  2022-01-26 21:11 ` Guenter Roeck
  3 siblings, 1 reply; 10+ messages in thread
From: Dong Aisheng @ 2022-01-18 13:50 UTC (permalink / raw)
  To: Chen Wandun; +Cc: akpm, linux-mm, linux-kernel, guillaume.tucker

On Mon, Jan 17, 2022 at 10:12 PM Chen Wandun <chenwandun@huawei.com> wrote:
>
> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
>
> commit 075782149abf ("mm/page_isolation: unset migratetype directly for
> non Buddy page") will result memory that should in buddy disappear by
> mistake. move_freepages_block move all pages in pageblock instead of
> pages indicated by input parameter, so if input pages is not in buddy
> but other pages in pageblock is in buddy, it will result in page out of
> control.
>
> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Chen Wandun <chenwandun@huawei.com>

The original patch broke imx6ul evk booting up.
Bisect shows it was caused by that patch.
After reverting, it works again.

So:
Tested-by: Dong Aisheng <aisheng.dong@nxp.com>

Below is the original error log:
[    8.710031] kworker/u2:2 invoked oom-killer:
gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=0
[    8.719920] CPU: 0 PID: 29 Comm: kworker/u2:2 Not tainted
5.16.0-00095-g721fb891ad0b #95
[    8.728093] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[    8.734322] Workqueue: events_unbound deferred_probe_work_func
[    8.740258] [<c0111640>] (unwind_backtrace) from [<c010ba84>]
(show_stack+0x10/0x14)
[    8.748080] [<c010ba84>] (show_stack) from [<c0f38aa4>]
(dump_stack_lvl+0x58/0x70)
[    8.755725] [<c0f38aa4>] (dump_stack_lvl) from [<c0f32f60>]
(dump_header+0x54/0x3cc)
[    8.763534] [<c0f32f60>] (dump_header) from [<c02aec94>]
(out_of_memory+0x54c/0x5f0)
[    8.771351] [<c02aec94>] (out_of_memory) from [<c030166c>]
(__alloc_pages+0xda8/0x1224)
[    8.779427] [<c030166c>] (__alloc_pages) from [<c03102f4>]
(new_slab+0x200/0x288)
[    8.786983] [<c03102f4>] (new_slab) from [<c03129ec>]
(___slab_alloc.constprop.0+0x5b0/0xea4)
[    8.795585] [<c03129ec>] (___slab_alloc.constprop.0) from
[<c031331c>] (__slab_alloc.constprop.0+0x3c/0x5c)
[    8.805399] [<c031331c>] (__slab_alloc.constprop.0) from
[<c03135a0>] (__kmalloc_track_caller+0x264/0x3a4)
[    8.815125] [<c03135a0>] (__kmalloc_track_caller) from [<c02c8cec>]
(kstrdup_const+0x4c/0x7c)
[    8.823719] [<c02c8cec>] (kstrdup_const) from [<c03cf890>]
(__kernfs_new_node.constprop.0+0x30/0x260)
[    8.833009] [<c03cf890>] (__kernfs_new_node.constprop.0) from
[<c03d0c4c>] (kernfs_new_node+0x30/0x50)
[    8.842384] [<c03d0c4c>] (kernfs_new_node) from [<c03d2e24>]
(kernfs_create_link+0x40/0xac)
[    8.850804] [<c03d2e24>] (kernfs_create_link) from [<c03d419c>]
(sysfs_do_create_link_sd+0x5c/0xd8)
[    8.859921] [<c03d419c>] (sysfs_do_create_link_sd) from
[<c086e9a4>] (device_add+0x264/0x8a8)
[    8.868518] [<c086e9a4>] (device_add) from [<c09f99dc>]
(usb_add_gadget+0xd0/0x180)
[    8.876246] [<c09f99dc>] (usb_add_gadget) from [<c09fa124>]
(usb_add_gadget_udc+0x78/0xb4)
[    8.884580] [<c09fa124>] (usb_add_gadget_udc) from [<c09ec674>]
(ci_hdrc_gadget_init+0x368/0x3e0)
[    8.893522] [<c09ec674>] (ci_hdrc_gadget_init) from [<c09e7870>]
(ci_hdrc_probe+0x6c8/0x8b8)
[    8.902025] [<c09e7870>] (ci_hdrc_probe) from [<c08756f4>]
(platform_probe+0x58/0xbc)
[    8.909919] [<c08756f4>] (platform_probe) from [<c0872e14>]
(really_probe.part.0+0x9c/0x32c)
[    8.918427] [<c0872e14>] (really_probe.part.0) from [<c0873144>]
(__driver_probe_device+0xa0/0x138)
[    8.927544] [<c0873144>] (__driver_probe_device) from [<c087320c>]
(driver_probe_device+0x30/0x10c)
[    8.936661] [<c087320c>] (driver_probe_device) from [<c08737dc>]
(__device_attach_driver+0xb0/0xf8)
[    8.945778] [<c08737dc>] (__device_attach_driver) from [<c0870ec8>]
(bus_for_each_drv+0x80/0xd0)
[    8.954631] [<c0870ec8>] (bus_for_each_drv) from [<c08734f0>]
(__device_attach+0xd0/0x19c)
[    8.962965] [<c08734f0>] (__device_attach) from [<c0871f5c>]
(bus_probe_device+0x88/0x90)
[    8.971212] [<c0871f5c>] (bus_probe_device) from [<c086ead0>]
(device_add+0x390/0x8a8)
[    8.979195] [<c086ead0>] (device_add) from [<c0875370>]
(platform_device_add+0x100/0x208)
[    8.987436] [<c0875370>] (platform_device_add) from [<c09e686c>]
(ci_hdrc_add_device+0x400/0x538)
[    8.996369] [<c09e686c>] (ci_hdrc_add_device) from [<c09eee90>]
(ci_hdrc_imx_probe+0x250/0x62c)
[    9.005133] [<c09eee90>] (ci_hdrc_imx_probe) from [<c08756f4>]
(platform_probe+0x58/0xbc)
[    9.013375] [<c08756f4>] (platform_probe) from [<c0872e14>]
(really_probe.part.0+0x9c/0x32c)
[    9.021880] [<c0872e14>] (really_probe.part.0) from [<c0873144>]
(__driver_probe_device+0xa0/0x138)
[    9.030995] [<c0873144>] (__driver_probe_device) from [<c087320c>]
(driver_probe_device+0x30/0x10c)
[    9.040110] [<c087320c>] (driver_probe_device) from [<c08737dc>]
(__device_attach_driver+0xb0/0xf8)
[    9.049225] [<c08737dc>] (__device_attach_driver) from [<c0870ec8>]
(bus_for_each_drv+0x80/0xd0)
[    9.058081] [<c0870ec8>] (bus_for_each_drv) from [<c08734f0>]
(__device_attach+0xd0/0x19c)
[    9.066414] [<c08734f0>] (__device_attach) from [<c0871f5c>]
(bus_probe_device+0x88/0x90)
[    9.074659] [<c0871f5c>] (bus_probe_device) from [<c0872390>]
(deferred_probe_work_func+0x78/0xa8)
[    9.083691] [<c0872390>] (deferred_probe_work_func) from
[<c0149174>] (process_one_work+0x294/0x7c0)
[    9.092896] [<c0149174>] (process_one_work) from [<c01496ec>]
(worker_thread+0x4c/0x554)
[    9.101052] [<c01496ec>] (worker_thread) from [<c01525c8>]
(kthread+0x16c/0x194)
[    9.108515] [<c01525c8>] (kthread) from [<c010011c>]
(ret_from_fork+0x14/0x38)
[    9.115800] Exception stack(0xc4349fb0 to 0xc4349ff8)
[    9.120906] 9fa0:                                     00000000
00000000 00000000 00000000
[    9.129138] 9fc0: 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000
[    9.137364] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    9.145304] Mem-Info:
[    9.147682] active_anon:0 inactive_anon:0 isolated_anon:0
[    9.147682]  active_file:0 inactive_file:0 isolated_file:0
[    9.147682]  unevictable:0 dirty:0 writeback:0
[    9.147682]  slab_reclaimable:2805 slab_unreclaimable:1466
[    9.147682]  mapped:0 shmem:0 pagetables:0 bounce:0
[    9.147682]  kernel_misc_reclaimable:0
[    9.147682]  free:0 free_pcp:5 free_cma:0
[    9.182265] Node 0 active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB
isolated(file):0kB mapped:0kB dirty:0kB writeback:0kB shmem:0kB
writeback_tmp:0kB kerno
[    9.205657] Normal free:0kB boost:0kB min:2780kB low:3472kB
high:4164kB reserved_highatomic:0KB active_anon:0kB inactive_anon:0kB
active_file:0kB inactive_file:0kB unevictable:0kB writepending:0kB
present:524B
[    9.232095] lowmem_reserve[]: 0 0 0
[    9.235772] Normal: 5*4kB (UMI) 5*8kB (UEI) 10*16kB (UMEI) 9*32kB
(UME) 5*64kB (UME) 7*128kB (UMEI) 7*256kB (UMEI) 4*512kB (MEI)
2*1024kB (M) 4*2048kB (UMI) 5*4096kB (UMEI) 2*8192kB (MI) 5*16384kB
(UMEI) 10*3B
[    9.257621] 0 total pagecache pages
[    9.261441] 0 pages in swap cache
[    9.264820] Swap cache stats: add 0, delete 0, find 0/0
[    9.270258] Free swap  = 0kB
[    9.273199] Total swap = 0kB
[    9.276133] 131072 pages RAM
[    9.279293] 0 pages HighMem/MovableOnly
[    9.283188] 10061 pages reserved
[    9.286468] 16384 pages cma reserved
[    9.290239] Tasks state (memory values in pages):
[    9.295087] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes
swapents oom_score_adj name
[    9.303927] Out of memory and no killable processes...
[    9.309285] Kernel panic - not syncing: System is deadlocked on memory

Regards
Aisheng

> ---
>  mm/page_isolation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 6a0ddda6b3c5..f67c4c70f17f 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>          * onlining - just onlined memory won't immediately be considered for
>          * allocation.
>          */
> -       if (!isolated_page && PageBuddy(page)) {
> +       if (!isolated_page) {
>                 nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>                 __mod_zone_freepage_state(zone, nr_pages, migratetype);
>         }
> --
> 2.18.0.huawei.25
>
>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-18 13:50 ` Dong Aisheng
@ 2022-01-24  8:41   ` Francesco Dolcini
  0 siblings, 0 replies; 10+ messages in thread
From: Francesco Dolcini @ 2022-01-24  8:41 UTC (permalink / raw)
  To: Dong Aisheng, Chen Wandun, akpm, guillaume.tucker; +Cc: linux-mm, linux-kernel

On Tue, Jan 18, 2022 at 09:50:42PM +0800, Dong Aisheng wrote:
> On Mon, Jan 17, 2022 at 10:12 PM Chen Wandun <chenwandun@huawei.com> wrote:
> >
> > This reverts commit 075782149abff45ee22f27315eced44d02b96779.
> >
> > commit 075782149abf ("mm/page_isolation: unset migratetype directly for
> > non Buddy page") will result memory that should in buddy disappear by
> > mistake. move_freepages_block move all pages in pageblock instead of
> > pages indicated by input parameter, so if input pages is not in buddy
> > but other pages in pageblock is in buddy, it will result in page out of
> > control.
> >
> > Reported-by: "kernelci.org bot" <bot@kernelci.org>
> > Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> 
> The original patch broke imx6ul evk booting up.
> Tested-by: Dong Aisheng <aisheng.dong@nxp.com>

Same issue present on imx7.
Tested-by: Francesco Dolcini <francesco.dolcini@toradex.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-17 14:27 [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page" Chen Wandun
  2022-01-17 15:32 ` David Hildenbrand
  2022-01-18 13:50 ` Dong Aisheng
@ 2022-01-25 16:40 ` Vlastimil Babka
  2022-01-26  2:18   ` Chen Wandun
  2022-01-26 21:11 ` Guenter Roeck
  3 siblings, 1 reply; 10+ messages in thread
From: Vlastimil Babka @ 2022-01-25 16:40 UTC (permalink / raw)
  To: Chen Wandun, akpm, linux-mm, linux-kernel, guillaume.tucker
  Cc: regressions, Oscar Salvador

On 1/17/22 15:27, Chen Wandun wrote:
> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
> 
> commit 075782149abf ("mm/page_isolation: unset migratetype directly for

That's an old -next commit id, it went to mainline as 721fb891ad0b
("mm/page_isolation: unset migratetype directly for non Buddy page")

> non Buddy page") will result memory that should in buddy disappear by
> mistake. move_freepages_block move all pages in pageblock instead of
> pages indicated by input parameter, so if input pages is not in buddy
> but other pages in pageblock is in buddy, it will result in page out of
> control.
> 
> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Chen Wandun <chenwandun@huawei.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

#regzbot ^introduced: 721fb891ad0b

There should better be also:

Fixes: 721fb891ad0b ("mm/page_isolation: unset migratetype directly for non
Buddy page")

Especially as that commit had a (inadequate, IMHO, for an optimization)
Fixes: tag and could end up being backported somewhere without the followup
fix/revert.

> ---
>  mm/page_isolation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 6a0ddda6b3c5..f67c4c70f17f 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>  	 * onlining - just onlined memory won't immediately be considered for
>  	 * allocation.
>  	 */
> -	if (!isolated_page && PageBuddy(page)) {
> +	if (!isolated_page) {
>  		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>  		__mod_zone_freepage_state(zone, nr_pages, migratetype);
>  	}



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-17 15:32 ` David Hildenbrand
@ 2022-01-26  2:17   ` Chen Wandun
  0 siblings, 0 replies; 10+ messages in thread
From: Chen Wandun @ 2022-01-26  2:17 UTC (permalink / raw)
  To: David Hildenbrand, akpm, linux-mm, linux-kernel, guillaume.tucker



在 2022/1/17 23:32, David Hildenbrand 写道:
> On 17.01.22 15:27, Chen Wandun wrote:
>> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
>>
>> commit 075782149abf ("mm/page_isolation: unset migratetype directly for
>> non Buddy page") will result memory that should in buddy disappear by
>> mistake. move_freepages_block move all pages in pageblock instead of
>> pages indicated by input parameter, so if input pages is not in buddy
>> but other pages in pageblock is in buddy, it will result in page out of
>> control.
>>
> I was wondering about exactly that condition when skimming over the
> patch but didn't have time review in detail.
when the first valid page in pageblock is non-buddy page and the page order
is not equal pagblock_order,  unset_migratetype_isolate will missing 
move free
page in this pageblock.
>
> Acked-by: David Hildenbrand <david@redhat.com>
>
>> Reported-by: "kernelci.org bot" <bot@kernelci.org>
>> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
>> ---
>>   mm/page_isolation.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
>> index 6a0ddda6b3c5..f67c4c70f17f 100644
>> --- a/mm/page_isolation.c
>> +++ b/mm/page_isolation.c
>> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>>   	 * onlining - just onlined memory won't immediately be considered for
>>   	 * allocation.
>>   	 */
>> -	if (!isolated_page && PageBuddy(page)) {
>> +	if (!isolated_page) {
>>   		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>>   		__mod_zone_freepage_state(zone, nr_pages, migratetype);
>>   	}
>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-25 16:40 ` Vlastimil Babka
@ 2022-01-26  2:18   ` Chen Wandun
  2022-01-30  9:24     ` Thorsten Leemhuis
  0 siblings, 1 reply; 10+ messages in thread
From: Chen Wandun @ 2022-01-26  2:18 UTC (permalink / raw)
  To: Vlastimil Babka, akpm, linux-mm, linux-kernel, guillaume.tucker
  Cc: regressions, Oscar Salvador



在 2022/1/26 0:40, Vlastimil Babka 写道:
> On 1/17/22 15:27, Chen Wandun wrote:
>> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
>>
>> commit 075782149abf ("mm/page_isolation: unset migratetype directly for
> That's an old -next commit id, it went to mainline as 721fb891ad0b
> ("mm/page_isolation: unset migratetype directly for non Buddy page")
>
>> non Buddy page") will result memory that should in buddy disappear by
>> mistake. move_freepages_block move all pages in pageblock instead of
>> pages indicated by input parameter, so if input pages is not in buddy
>> but other pages in pageblock is in buddy, it will result in page out of
>> control.
>>
>> Reported-by: "kernelci.org bot" <bot@kernelci.org>
>> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
>
> #regzbot ^introduced: 721fb891ad0b
>
> There should better be also:
>
> Fixes: 721fb891ad0b ("mm/page_isolation: unset migratetype directly for non
> Buddy page")
>
> Especially as that commit had a (inadequate, IMHO, for an optimization)
> Fixes: tag and could end up being backported somewhere without the followup
> fix/revert.
thanks, I will send v2
>
>> ---
>>   mm/page_isolation.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
>> index 6a0ddda6b3c5..f67c4c70f17f 100644
>> --- a/mm/page_isolation.c
>> +++ b/mm/page_isolation.c
>> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>>   	 * onlining - just onlined memory won't immediately be considered for
>>   	 * allocation.
>>   	 */
>> -	if (!isolated_page && PageBuddy(page)) {
>> +	if (!isolated_page) {
>>   		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>>   		__mod_zone_freepage_state(zone, nr_pages, migratetype);
>>   	}
> .



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-17 14:27 [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page" Chen Wandun
                   ` (2 preceding siblings ...)
  2022-01-25 16:40 ` Vlastimil Babka
@ 2022-01-26 21:11 ` Guenter Roeck
  3 siblings, 0 replies; 10+ messages in thread
From: Guenter Roeck @ 2022-01-26 21:11 UTC (permalink / raw)
  To: Chen Wandun; +Cc: akpm, linux-mm, linux-kernel, guillaume.tucker

On Mon, Jan 17, 2022 at 10:27:12PM +0800, Chen Wandun wrote:
> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
> 
> commit 075782149abf ("mm/page_isolation: unset migratetype directly for
> non Buddy page") will result memory that should in buddy disappear by
> mistake. move_freepages_block move all pages in pageblock instead of
> pages indicated by input parameter, so if input pages is not in buddy
> but other pages in pageblock is in buddy, it will result in page out of
> control.
> 
> Reported-by: "kernelci.org bot" <bot@kernelci.org>
> Signed-off-by: Chen Wandun <chenwandun@huawei.com>

I see a number of qemu emulations fail with memory allocation
errors in v5.17-rc1. This revert fixes the problem.

Tested-by: Guenter Roeck <linux@roeck-us.net>

Guenter

> ---
>  mm/page_isolation.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 6a0ddda6b3c5..f67c4c70f17f 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype)
>  	 * onlining - just onlined memory won't immediately be considered for
>  	 * allocation.
>  	 */
> -	if (!isolated_page && PageBuddy(page)) {
> +	if (!isolated_page) {
>  		nr_pages = move_freepages_block(zone, page, migratetype, NULL);
>  		__mod_zone_freepage_state(zone, nr_pages, migratetype);
>  	}
> -- 
> 2.18.0.huawei.25
> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-26  2:18   ` Chen Wandun
@ 2022-01-30  9:24     ` Thorsten Leemhuis
  2022-01-31 22:39       ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Leemhuis @ 2022-01-30  9:24 UTC (permalink / raw)
  To: Chen Wandun, Vlastimil Babka, akpm, linux-mm, linux-kernel,
	guillaume.tucker
  Cc: regressions, Oscar Salvador

Hi, this is your Linux kernel regression tracker speaking.

On 26.01.22 03:18, Chen Wandun wrote:
> 在 2022/1/26 0:40, Vlastimil Babka 写道:
>> On 1/17/22 15:27, Chen Wandun wrote:
>>> This reverts commit 075782149abff45ee22f27315eced44d02b96779.
>>>
>>> commit 075782149abf ("mm/page_isolation: unset migratetype directly for
>> That's an old -next commit id, it went to mainline as 721fb891ad0b
>> ("mm/page_isolation: unset migratetype directly for non Buddy page")
>>
>>> non Buddy page") will result memory that should in buddy disappear by
>>> mistake. move_freepages_block move all pages in pageblock instead of
>>> pages indicated by input parameter, so if input pages is not in buddy
>>> but other pages in pageblock is in buddy, it will result in page out of
>>> control.
>>>
>>> Reported-by: "kernelci.org bot" <bot@kernelci.org>
>>> Signed-off-by: Chen Wandun <chenwandun@huawei.com>
>> Acked-by: Vlastimil Babka <vbabka@suse.cz>
>>
>> #regzbot ^introduced: 721fb891ad0b

Thx for getting regzbot involved, much appreciated.

>> There should better be also:
>>
>> Fixes: 721fb891ad0b ("mm/page_isolation: unset migratetype directly
>> for non
>> Buddy page")
>>
>> Especially as that commit had a (inadequate, IMHO, for an optimization)
>> Fixes: tag and could end up being backported somewhere without the
>> followup
>> fix/revert.
>
> thanks, I will send v2

Just wondering:

Andrew, I don't see this patch in the list of changes you sent to Linus
yesterday. Shouldn't it be in there due to above reason alone? And there
is another reason: it seems to be an issue people actually hit, as
Guenter mentioned in this thread. It thus complicates things for those
that want to help testing pre-releases.

Or am I missing something/asking too much in this case?

BTW, let's tell regzbot about v2:

#regzbot monitor:
https://lore.kernel.org/all/20220126024436.13921-1-chenwandun@huawei.com/

Ciao, Thorsten

>>> ---
>>>   mm/page_isolation.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
>>> index 6a0ddda6b3c5..f67c4c70f17f 100644
>>> --- a/mm/page_isolation.c
>>> +++ b/mm/page_isolation.c
>>> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page
>>> *page, unsigned migratetype)
>>>        * onlining - just onlined memory won't immediately be
>>> considered for
>>>        * allocation.
>>>        */
>>> -    if (!isolated_page && PageBuddy(page)) {
>>> +    if (!isolated_page) {
>>>           nr_pages = move_freepages_block(zone, page, migratetype,
>>> NULL);
>>>           __mod_zone_freepage_state(zone, nr_pages, migratetype);
>>>       }
>> .
> 
> 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page"
  2022-01-30  9:24     ` Thorsten Leemhuis
@ 2022-01-31 22:39       ` Andrew Morton
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Morton @ 2022-01-31 22:39 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Chen Wandun, Vlastimil Babka, linux-mm, linux-kernel,
	guillaume.tucker, regressions, Oscar Salvador

On Sun, 30 Jan 2022 10:24:43 +0100 Thorsten Leemhuis <regressions@leemhuis.info> wrote:

> Andrew, I don't see this patch in the list of changes you sent to Linus
> yesterday. Shouldn't it be in there due to above reason alone? And there
> is another reason: it seems to be an issue people actually hit, as
> Guenter mentioned in this thread. It thus complicates things for those
> that want to help testing pre-releases.

I prefer to give fixes some time in linux-next before upstreaming them.
At least a day, worst case.  So I have this patch in this week's pile.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-31 22:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 14:27 [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page" Chen Wandun
2022-01-17 15:32 ` David Hildenbrand
2022-01-26  2:17   ` Chen Wandun
2022-01-18 13:50 ` Dong Aisheng
2022-01-24  8:41   ` Francesco Dolcini
2022-01-25 16:40 ` Vlastimil Babka
2022-01-26  2:18   ` Chen Wandun
2022-01-30  9:24     ` Thorsten Leemhuis
2022-01-31 22:39       ` Andrew Morton
2022-01-26 21:11 ` Guenter Roeck

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).