linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] fput: Use unbound workqueue for scheduling delayed fput works
@ 2019-12-17 15:11 qiwuchen55
  2019-12-17 15:30 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: qiwuchen55 @ 2019-12-17 15:11 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, linux-kernel, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

There is a potential starvation that the number of delayed fput works
increase rapidly if task exit storm or fs unmount issue happens.

Since the delayed fput works are expected to be executed as soon as
possible. The commonly accepted wisdom that the measurements of scheduling
works via the unbound workqueue show lowered worst-case latency responses
of up to 5x over bound workqueue.

Work items queued to an unbound wq are not bound to any specific CPU, not
concurrency managed. All queued works are executed immediately as long as
max_active limit is not reached and resources are available.

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 fs/file_table.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index 30d55c9..472ad92 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -348,7 +348,8 @@ void fput_many(struct file *file, unsigned int refs)
 		}
 
 		if (llist_add(&file->f_u.fu_llist, &delayed_fput_list))
-			schedule_delayed_work(&delayed_fput_work, 1);
+			queue_delayed_work(system_unbound_wq,
+					&delayed_fput_work, 1);
 	}
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] fput: Use unbound workqueue for scheduling delayed fput works
  2019-12-17 15:11 [RESEND PATCH] fput: Use unbound workqueue for scheduling delayed fput works qiwuchen55
@ 2019-12-17 15:30 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2019-12-17 15:30 UTC (permalink / raw)
  To: qiwuchen55; +Cc: linux-fsdevel, linux-kernel, chenqiwu

On Tue, Dec 17, 2019 at 11:11:12PM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> There is a potential starvation that the number of delayed fput works
> increase rapidly if task exit storm or fs unmount issue happens.

Err...  Details, please, ideally along with a reproducer.  In particular,
I would like to understand what does any of that have to do with umount.
Or to task exits, for that matter - exit_files() is called before
exit_task_work(), so you shouldn't normally be seeing task_work_add()
failures when files get closed on exit(2)...

If you are really observing such problems, it might be worth looking
into the underlying situation - something odd appears to be going
on and I'd rather understand what it is.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-17 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 15:11 [RESEND PATCH] fput: Use unbound workqueue for scheduling delayed fput works qiwuchen55
2019-12-17 15:30 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).