public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: io-uring <[email protected]>, LKML <[email protected]>
Cc: Linus Torvalds <[email protected]>,
	Dave Chinner <[email protected]>, Zorro Lang <[email protected]>
Subject: [PATCH] io_uring/io-wq: don't clear PF_IO_WORKER on exit
Date: Mon, 12 Jun 2023 12:11:57 -0600	[thread overview]
Message-ID: <[email protected]> (raw)

A recent commit gated the core dumping task exit logic on current->flags
remaining consistent in terms of PF_{IO,USER}_WORKER at task exit time.
This exposed a problem with the io-wq handling of that, which explicitly
clears PF_IO_WORKER before calling do_exit().

The reasons for this manual clear of PF_IO_WORKER is historical, where
io-wq used to potentially trigger a sleep on exit. As the io-wq thread
is exiting, it should not participate any further accounting. But these
days we don't need to rely on current->flags anymore, so we can safely
remove the PF_IO_WORKER clearing.

Reported-by: Zorro Lang <[email protected]>
Reported-by: Dave Chinner <[email protected]>
Reported-by: Linus Torvalds <[email protected]>
Link: https://lore.kernel.org/all/[email protected]/
Fixes: f9010dbdce91 ("fork, vhost: Use CLONE_THREAD to fix freezer/ps regression")
Signed-off-by: Jens Axboe <[email protected]>

---

diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index b2715988791e..fe38eb0cbc82 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -221,9 +221,6 @@ static void io_worker_exit(struct io_worker *worker)
 	raw_spin_unlock(&wq->lock);
 	io_wq_dec_running(worker);
 	worker->flags = 0;
-	preempt_disable();
-	current->flags &= ~PF_IO_WORKER;
-	preempt_enable();
 
 	kfree_rcu(worker, rcu);
 	io_worker_ref_put(wq);

-- 
Jens Axboe


             reply	other threads:[~2023-06-12 18:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 18:11 Jens Axboe [this message]
2023-06-14  0:54 ` [PATCH] io_uring/io-wq: don't clear PF_IO_WORKER on exit Zorro Lang
2023-06-14  1:03   ` Zorro Lang
2023-06-14  1:14   ` Jens Axboe
2023-06-14  4:49     ` Zorro Lang
2023-06-14 17:44     ` Linus Torvalds
2023-06-14 19:25       ` Jens Axboe
2023-06-15  2:22     ` Zorro Lang
2023-06-15  2:23       ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox