Skip to contentSkip to conversation

io-wq: kill cpu hog worker

RFC PATCH Jens Axboe 2 participants 3 messages Dec 23, 2019 – Dec 24, 2019 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Jens Axboe

author maintainer
#1 lore raw
In reply to a message not in the archive
Quoted 2 lines · Hillf Danton

Reschedule the current IO worker if it is becoming a cpu hog.

Might make more sense to put this a bit earlier, to avoid the awkward lock juggle. In theory it shouldn't make a difference if we do it _before_ doing new work, or _after_ doing work. We should only be rescheduling if it's running for quite a while.

How about putting it after the flushing of signals instead?

Signature · 1 line
Jens Axboe
#2 lore raw
In reply to a message not in the archive
Quoted 11 lines · On Mon, 23 Dec 2019 08:15:00 -0700 Jens Axboe wrote:
Quoted 2 lines · Hillf Danton

Reschedule the current IO worker if it is becoming a cpu hog.

Might make more sense to put this a bit earlier, to avoid the awkward lock juggle. In theory it shouldn't make a difference if we do it _before_ doing new work, or _after_ doing work. We should only be rescheduling if it's running for quite a while.

How about putting it after the flushing of signals instead?

All right, thanks.

Hillf
--->8---
From: Hillf Danton <[email protected]>
Subject: [RFC PATCH] io-wq: kill cpu hog worker

Reschedule the current IO worker to cut the risk that it is becoming a cpu hog.

---

fs/io-wq.c +2 -0
@@ -432,6 +432,8 @@ next:
 		if (signal_pending(current))
 			flush_signals(current);
 
+		cond_resched();
+
 		spin_lock_irq(&worker->lock);
 		worker->cur_work = work;
 		spin_unlock_irq(&worker->lock);

--

author maintainer
#3 lore raw
Quoted 31 lines · Hillf Danton
Quoted 11 lines · On Mon, 23 Dec 2019 08:15:00 -0700 Jens Axboe wrote:
Quoted 2 lines · Hillf Danton

Reschedule the current IO worker if it is becoming a cpu hog.

Might make more sense to put this a bit earlier, to avoid the awkward lock juggle. In theory it shouldn't make a difference if we do it _before_ doing new work, or _after_ doing work. We should only be rescheduling if it's running for quite a while.

How about putting it after the flushing of signals instead?

All right, thanks.

Hillf
--->8---
From: Hillf Danton <[email protected]>
Subject: [RFC PATCH] io-wq: kill cpu hog worker

Reschedule the current IO worker to cut the risk that it is becoming a cpu hog.

---

fs/io-wq.c next:

Quoted 9 lines
fs/io-wq.c +2 -1
@@ -432,6 +432,8 @@ next:
 		if (signal_pending(current))
 			flush_signals(current);
 
+		cond_resched();
+
 		spin_lock_irq(&worker->lock);
 		worker->cur_work = work;
 		spin_unlock_irq(&worker->lock);
--

That looks better, applied.

Signature · 1 line
Jens Axboe