[lkml]   [2013]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[RFC][RT][PATCH RESEND] mm: Do not use stop_machine() for __zone_pcp_udpate() for CONFIG_PREEMPT_RT_FULL
The code path of __zone_pcp_update() has following locks, which in
CONFIG_PREEMPT_RT_FULL=y are rt-mutex.
- pa_lock locked by cpu_lock_irqsave()
- zone->lock locked by free_pcppages_bulk()

Since __zone_pcp_update() is called from stop_machine(), so with
we get following backtrace when __zone_pcp_update() is called during
memory hot plugging while
doing heavy file I/O.

stop_machine() may not be required for calling __zone_pcp_update()
in case of CONFIG_PREEMPT_RT_FULL=y as acquiring pa_lock in __zone_pcp_update()
should be sufficient to isolate pcp pages and to setup per cpu pagesets.

The backtrace that this patch fixes:
BUG: scheduling while atomic: migration/0/7/0x00000002
Modules linked in: v2p
[<800111a0>] (dump_backtrace+0x0/0x10c) from [<802d7b7c>]
r6:80c8fc28 r5:80c8f9a0 r4:00000000 r3:60000013
[<802d7b64>] (dump_stack+0x0/0x1c) from [<8001e81c>] (__schedule_bug+0x64/0x74)
[<8001e7b8>] (__schedule_bug+0x0/0x74) from [<802d7fa0>]
r4:8051bf00 r3:00000000
[<802d7f38>] (__schedule+0x0/0x604) from [<802d8a78>] (schedule+0x98/0xbc)
[<802d89e0>] (schedule+0x0/0xbc) from [<802d9e14>]
r4:805228f4 r3:00000000
[<802d9cac>] (rt_spin_lock_slowlock+0x0/0x240) from [<802da234>]
[<802da224>] (rt_spin_lock+0x0/0x14) from [<8008694c>]
[<800868f4>] (__zone_pcp_update+0x0/0xd8) from [<800603ec>]
[<8006033c>] (stop_machine_cpu_stop+0x0/0x104) from [<80060200>]

Signed-off-by: Aaditya Kumar <>

mm/page_alloc.c | 4 4 + 0 - 0 !
1 file changed, 4 insertions(+)

Index: b/mm/page_alloc.c
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3868,7 +3868,11 @@ static int __zone_pcp_update(void *data)

void zone_pcp_update(struct zone *zone)
stop_machine(__zone_pcp_update, zone, NULL);
+ __zone_pcp_update(zone);

static __meminit void zone_pcp_init(struct zone *zone)

 \ /
  Last update: 2013-03-05 20:23    [W:0.257 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site