linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC PATCH] io-wq: kill cpu hog worker
       [not found] <20191223024145.11580-1-hdanton@sina.com>
@ 2019-12-24 11:54 ` Hillf Danton
  2019-12-24 16:13   ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2019-12-24 11:54 UTC (permalink / raw)
  To: Jens Axboe
  Cc: io-uring, viro, linux-fsdevel, linux-kernel, linux-mm, Hillf Danton


On Mon, 23 Dec 2019 08:15:00 -0700 Jens Axboe wrote:
> 
> On 12/22/19 7:41 PM, Hillf Danton wrote:
> > 
> > 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 <hdanton@sina.com>
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.

Signed-off-by: Hillf Danton <hdanton@sina.com>
---

--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -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);
--



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

* Re: [RFC PATCH] io-wq: kill cpu hog worker
  2019-12-24 11:54 ` [RFC PATCH] io-wq: kill cpu hog worker Hillf Danton
@ 2019-12-24 16:13   ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-12-24 16:13 UTC (permalink / raw)
  To: Hillf Danton; +Cc: io-uring, viro, linux-fsdevel, linux-kernel, linux-mm

On 12/24/19 4:54 AM, Hillf Danton wrote:
> 
> On Mon, 23 Dec 2019 08:15:00 -0700 Jens Axboe wrote:
>>
>> On 12/22/19 7:41 PM, Hillf Danton wrote:
>>>
>>> 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 <hdanton@sina.com>
> 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.
> 
> Signed-off-by: Hillf Danton <hdanton@sina.com>
> ---
> 
> --- a/fs/io-wq.c
> +++ b/fs/io-wq.c
> @@ -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.

-- 
Jens Axboe



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

end of thread, other threads:[~2019-12-24 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191223024145.11580-1-hdanton@sina.com>
2019-12-24 11:54 ` [RFC PATCH] io-wq: kill cpu hog worker Hillf Danton
2019-12-24 16:13   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox