Re:Re: [PATCH] mm/page_alloc: fix alloc_pages_bulk/set_page_owner panic on irq disabled

From: 杨欢
Date: Sun Jul 11 2021 - 22:27:39 EST



>
>> The problem is caused by set_page_owner alloc memory to save stack with
>> GFP_KERNEL in local_riq disabled.
>> So, we just can't assume that alloc flags should be same with new page,
>> let's split it. But in most situation, same is ok, in alloc_pages_bulk,
>> input GFP_ATOMIC when prep_new_pages
>
>Please more fully describe the bug which is being fixed. A link to the
>sysbot report would be helpful. I assume there was a stack backtrace
>available? Seeing the will help others to understand the bug.
Sorry, here is the back trace
BUG: sleeping function called from invalid context at mm/page_alloc.c:5179
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:96
___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:9153
prepare_alloc_pages+0x3da/0x580 mm/page_alloc.c:5179
__alloc_pages+0x12f/0x500 mm/page_alloc.c:5375
alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272
stack_depot_save+0x39d/0x4e0 lib/stackdepot.c:303
save_stack+0x15e/0x1e0 mm/page_owner.c:120
__set_page_owner+0x50/0x290 mm/page_owner.c:181
prep_new_page mm/page_alloc.c:2445 [inline]
__alloc_pages_bulk+0x8b9/0x1870 mm/page_alloc.c:5313


>And if you are able to identify the patch which introduced the bug, a
>Fixes: tag would be helpful as well.
I will send patch again with this descrption.
Thanks
>
>Thanks.
>