lkml.org 
[lkml]   [2022]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/6] mm/page_alloc: Split out buddy removal code from rmqueue into separate helper
On 05/12/22 09:50, Mel Gorman wrote:
> This is a preparation page to allow the buddy removal code to be reused
> in a later patch.
>
> No functional change.
>
> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> Tested-by: Minchan Kim <minchan@kernel.org>
> Acked-by: Minchan Kim <minchan@kernel.org>
> ---

I see this splat when this patch is applied on 5.10.107 kernel:

[ 132.779332] CPU: 1 PID: 203 Comm: klogd Not tainted 5.10.107-00039-g83962808e276 #28
[ 132.782470] BUG: using __this_cpu_add_return() in preemptible [00000000] code: udhcpc/229
[ 132.787809] Hardware name: ARM Juno development board (r2) (DT)
[ 132.787841] Call trace:
[ 132.787881] dump_backtrace+0x0/0x2c0
[ 132.787921] show_stack+0x18/0x28
[ 132.787963] dump_stack_lvl+0x108/0x150
[ 132.788003] dump_stack+0x1c/0x58
[ 132.788049] check_preemption_disabled+0xf4/0x108
[ 132.788095] __this_cpu_preempt_check+0x20/0x2c
[ 132.788135] __inc_numa_state+0x3c/0x120
[ 132.788177] get_page_from_freelist+0xd6c/0x1ac8
[ 132.788220] __alloc_pages_nodemask+0x224/0x1780
[ 132.797359] caller is __this_cpu_preempt_check+0x20/0x2c
[ 132.803579] alloc_pages_current+0xb0/0x150
[ 132.803621] allocate_slab+0x2d0/0x408
[ 132.803662] ___slab_alloc+0x43c/0x640
[ 132.803704] __slab_alloc.isra.0+0x70/0xc8
[ 132.803747] __kmalloc_node_track_caller+0x10c/0x2d8
[ 132.803792] __kmalloc_reserve.isra.0+0x80/0x160
[ 132.803835] __alloc_skb+0xd0/0x2a8
[ 132.883893] alloc_skb_with_frags+0x64/0x2a0
[ 132.888632] sock_alloc_send_pskb+0x420/0x438
[ 132.893465] unix_dgram_sendmsg+0x1d4/0x930
[ 132.898112] __sys_sendto+0x16c/0x230
[ 132.902198] __arm64_sys_sendto+0x78/0x98
[ 132.906654] el0_svc_common.constprop.0+0xac/0x278

I could resolve it by applying this patch:

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 80c1e0a0f094e..92fb0c08296ef 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -957,11 +957,11 @@ void __inc_numa_state(struct zone *zone,
u16 __percpu *p = pcp->vm_numa_stat_diff + item;
u16 v;

- v = __this_cpu_inc_return(*p);
+ v = this_cpu_inc_return(*p);

if (unlikely(v > NUMA_STATS_THRESHOLD)) {
zone_numa_state_add(v, zone, item);
- __this_cpu_write(*p, 0);
+ this_cpu_write(*p, 0);
}
}

AFAICT zone_statistics() no longer protected by the spin_lock_irqsave(), so
preemption no longer disabled.

You need to have CONFIG_NUMA and CONFIG_DEBUG_PREEMPT enabled to reproduce
this.

HTH

Thanks!

--
Qais Yousef

\
 
 \ /
  Last update: 2022-05-23 18:13    [W:0.217 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site