* [PATCH] mm/vmalloc: use unbound workqueue for vmap area draining
@ 2026-03-18 7:36 lirongqing
2026-03-18 18:10 ` Uladzislau Rezki
0 siblings, 1 reply; 3+ messages in thread
From: lirongqing @ 2026-03-18 7:36 UTC (permalink / raw)
To: Andrew Morton, Uladzislau Rezki, linux-mm, linux-kernel; +Cc: Li RongQing
From: Li RongQing <lirongqing@baidu.com>
The workqueue watchdog currently reports that drain_vmap_area_work
hogs the CPU for more than 10ms. This typically happens during heavy
memory pressure or high-frequency vmap/vunmap operations where the lazy
drain list grows large.
[ 2069.796205] workqueue: drain_vmap_area_work hogged CPU for >10000us 4 times, consider switching to WQ_UNBOUND
[ 2192.823225] workqueue: drain_vmap_area_work hogged CPU for >10000us 5 times, consider switching to WQ_UNBOUND
[ 3225.388966] workqueue: drain_vmap_area_work hogged CPU for >10000us 7 times, consider switching to WQ_UNBOUND
Since vmap area draining is a background housekeeping task that does
not require strict CPU affinity or cache locality, it is a prime
candidate for an unbound workqueue.
Switching from schedule_work() to queue_work(system_unbound_wq, ...)
allows the scheduler to offload the draining process to any available
CPU core. This prevents stalling the current CPU and resolves the
"consider switching to WQ_UNBOUND" warning.
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
mm/vmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 61caa55..5f2218a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2471,7 +2471,7 @@ static void free_vmap_area_noflush(struct vmap_area *va)
/* After this point, we may free va at any time */
if (unlikely(nr_lazy > nr_lazy_max))
- schedule_work(&drain_vmap_work);
+ queue_work(system_unbound_wq, &drain_vmap_work);
}
/*
--
2.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/vmalloc: use unbound workqueue for vmap area draining
2026-03-18 7:36 [PATCH] mm/vmalloc: use unbound workqueue for vmap area draining lirongqing
@ 2026-03-18 18:10 ` Uladzislau Rezki
2026-03-19 2:13 ` 答复: [????] " Li,Rongqing(ACG CCN)
0 siblings, 1 reply; 3+ messages in thread
From: Uladzislau Rezki @ 2026-03-18 18:10 UTC (permalink / raw)
To: lirongqing; +Cc: Andrew Morton, Uladzislau Rezki, linux-mm, linux-kernel
On Wed, Mar 18, 2026 at 03:36:30AM -0400, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> The workqueue watchdog currently reports that drain_vmap_area_work
> hogs the CPU for more than 10ms. This typically happens during heavy
> memory pressure or high-frequency vmap/vunmap operations where the lazy
> drain list grows large.
>
> [ 2069.796205] workqueue: drain_vmap_area_work hogged CPU for >10000us 4 times, consider switching to WQ_UNBOUND
> [ 2192.823225] workqueue: drain_vmap_area_work hogged CPU for >10000us 5 times, consider switching to WQ_UNBOUND
> [ 3225.388966] workqueue: drain_vmap_area_work hogged CPU for >10000us 7 times, consider switching to WQ_UNBOUND
>
> Since vmap area draining is a background housekeeping task that does
> not require strict CPU affinity or cache locality, it is a prime
> candidate for an unbound workqueue.
>
> Switching from schedule_work() to queue_work(system_unbound_wq, ...)
> allows the scheduler to offload the draining process to any available
> CPU core. This prevents stalling the current CPU and resolves the
> "consider switching to WQ_UNBOUND" warning.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> mm/vmalloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 61caa55..5f2218a 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2471,7 +2471,7 @@ static void free_vmap_area_noflush(struct vmap_area *va)
>
> /* After this point, we may free va at any time */
> if (unlikely(nr_lazy > nr_lazy_max))
> - schedule_work(&drain_vmap_work);
> + queue_work(system_unbound_wq, &drain_vmap_work);
> }
>
> /*
> --
> 2.9.4
>
We free memory here. Therefore it is time to switch to our
own workqueue with WQ_MEM_RECLAIM | WQ_UNBOUND flags.
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 3+ messages in thread
* 答复: [????] Re: [PATCH] mm/vmalloc: use unbound workqueue for vmap area draining
2026-03-18 18:10 ` Uladzislau Rezki
@ 2026-03-19 2:13 ` Li,Rongqing(ACG CCN)
0 siblings, 0 replies; 3+ messages in thread
From: Li,Rongqing(ACG CCN) @ 2026-03-19 2:13 UTC (permalink / raw)
To: Uladzislau Rezki
Cc: Andrew Morton, linux-mm@kvack.org, linux-kernel@vger.kernel.org
> > --
> > 2.9.4
> >
> We free memory here. Therefore it is time to switch to our own workqueue
> with WQ_MEM_RECLAIM | WQ_UNBOUND flags.
>
Ok, I will send v2
Thanks
[Li,Rongqing]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-19 2:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 7:36 [PATCH] mm/vmalloc: use unbound workqueue for vmap area draining lirongqing
2026-03-18 18:10 ` Uladzislau Rezki
2026-03-19 2:13 ` 答复: [????] " Li,Rongqing(ACG CCN)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox