Skip to contentSkip to conversation

mm/page_alloc: Use migreate_disable() in drain_local_pages_wq()

PATCH New Sebastian Andrzej Siewior 1 participant 1 message Mar 20, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/page_alloc: Use migreate_disable() in drain_local_pages_wq()

The drain_local_pages_wq() uses preempt_disable() to ensure that there will be no CPU migration while drain_local_pages() is invoked which might happen if the CPU is going down.
drain_local_pages() acquires a sleeping lock on RT which can not be acquired with disabled preemption.

Use migrate_disable() instead of preempt_disable(): On RT it ensures that the CPU won't go down and on !RT it is replaced with preempt_disable().

---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/page_alloc.c +2 -2
index 99a51dfed59c7..7df9930628c2b 100644
@@ -2912,9 +2912,9 @@ static void drain_local_pages_wq(struct work_struct *work)
 	 * cpu which is allright but we also have to make sure to not move to
 	 * a different one.
 	 */
-	preempt_disable();
+	migrate_disable();
 	drain_local_pages(drain->zone);
-	preempt_enable();
+	migrate_enable();
 }
 
 /*
Signature · 1 line
2.26.0.rc2