PM: Use WQ_MEM_RECLAIM flag for PM workqueue
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 18 lines · Ravisankarreddy lingareddy
Deadlock is seen under below high memory usage scenario.
kswapd waiting to reclaim memory is blocked on i/o kworker and
pm_wqcontext which needs to wakeup i/o kworker is waiting for kthread creation which is again blocked in memory reclaim path.Use
WQ_MEM_RECLAIMflag for PM workqueue to avoid this deadlock.Signed-off-by Ravisankarreddy lingareddy <[email protected]>--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/power/main.c +0
-0
kernel/power/main.c EXPORT_SYMBOL_GPL(pm_wq); · line 939
Quoted 8 lines
kernel/power/main.c +1
-1@@ -933,7 +933,7 @@ EXPORT_SYMBOL_GPL(pm_wq);static int __init pm_start_workqueue (void ) { - pm_wq =alloc_workqueue ("pm" ,WQ_FREEZABLE ,0 ); + pm_wq =alloc_workqueue ("pm" ,WQ_FREEZABLE |WQ_MEM_RECLAIM ,0 );return pm_wq ?0 : -ENOMEM ; }
Please resend this with a CC to [email protected].
Also it would be good to know how to reproduce this issue.
Quoted 1 line
Please resend this with a CC to [email protected].
Thank you, I resend with a CC to [email protected].
Quoted 1 line
Also it would be good to know how to reproduce this issue.
Commit message says under high memory scenarios, try a memory pressure test and do repeatedly until the battery is under 20%.
Quoted 3 lines
@Pavel,
Does this need some kind of auditing to make sure we don't allocate memory from the code running in the workqueue, and thus further deadlocks?
I used WQ_MEM_RECLAIM in pm_wq workqueue to fix bug and no further deadlocks are seen and tested on 4.9 and 4.19 kernel.
Best Regards,
Ravi
Quoted 34 lines · Rafael J. Wysocki
Quoted 18 lines · Ravisankarreddy lingareddy
Deadlock is seen under below high memory usage scenario.
kswapd waiting to reclaim memory is blocked on i/o kworker and
pm_wqcontext which needs to wakeup i/o kworker is waiting for kthread creation which is again blocked in memory reclaim path.Use
WQ_MEM_RECLAIMflag for PM workqueue to avoid this deadlock.Signed-off-by Ravisankarreddy lingareddy <[email protected]>--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/power/main.c +0
-0kernel/power/main.c EXPORT_SYMBOL_GPL(pm_wq); · line 939
Quoted 8 lines
kernel/power/main.c +1
-1@@ -933,7 +933,7 @@ EXPORT_SYMBOL_GPL(pm_wq);static int __init pm_start_workqueue (void ) { - pm_wq =alloc_workqueue ("pm" ,WQ_FREEZABLE ,0 ); + pm_wq =alloc_workqueue ("pm" ,WQ_FREEZABLE |WQ_MEM_RECLAIM ,0 );return pm_wq ?0 : -ENOMEM ; }Please resend this with a CC to [email protected].
Also it would be good to know how to reproduce this issue.