public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Gregory Haskins <ghaskins@novell.com>
Cc: Daniel Walker <dwalker@mvista.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RT: Add priority-queuing and priority-inheritance to workqueue infrastructure
Date: Thu, 2 Aug 2007 02:22:01 +0400	[thread overview]
Message-ID: <20070801222201.GA316@tv-sign.ru> (raw)
In-Reply-To: <1186005598.9513.261.camel@ghaskins-t60p.haskins.net>

On 08/01, Gregory Haskins wrote:
>
> On Thu, 2007-08-02 at 01:34 +0400, Oleg Nesterov wrote:
> > On 08/01, Gregory Haskins wrote:
> > >
> > > On Thu, 2007-08-02 at 00:50 +0400, Oleg Nesterov wrote:
> > > > On 08/01, Daniel Walker wrote:
> > > > >
> > > > > It's translating priorities through the work queues, which doesn't seem
> > > > > to happen with the current implementation. A high priority, say
> > > > > SCHED_FIFO priority 99, task may have to wait for a nice -5 work queue
> > > > > to finish..
> > > > 
> > > > Why should that task wait?
> > > 
> > > I assume "that task" = the RT99 task?  If so, that is precisely the
> > > question.  It shouldn't wait.  ;)  With mainline, it is simply queued
> > > with every other request.  There could be an RT40, and a SCHED_NORMAL in
> > > front of it in the queue that will get processed first.  In addition,
> > > the system could suffer from a priority inversion if some unrelated but
> > > lower priority task (say RT98) was blocking the workqueue thread from
> > > making forward progress on the nice -5 job. 
> > > 
> > > To clarify: when a design utilizes a singlethread per workqueue (such as
> > > in both mainline and this patch), the RT99 will always have to wait
> > > behind any already dispatched jobs.
> > 
> > It is not that "RT99 will always have to wait". But yes, the work_struct
> > queued by RT99 has to wait.
> 
> Agreed.  We are talking only within the scope of workqueues here.
> 
> 
> > > 1) The RT99 task would move ahead in the queue of anything else that was
> > > also scheduled on the workqueue that is < RT99.
> > 
> > this itself is wrong, breaks flush_workqueue() semantics
> 
> Perhaps in Daniels patch.

No.

> However, IIUC the point of flush_workqueue() is a barrier only relative
> to your own submissions, correct?.  E.g. to make sure *your* requests
> are finished, not necessarily the entire queue.

No,

> If flush_workqueue is supposed to behave differently than I describe,
> then I agree its broken even in my original patch.

The comment near flush_workqueue() says:

	* We sleep until all works which were queued on entry have been handled,
	* but we are not livelocked by new incoming ones.

> > > 2) The priority of the workqueue task would be temporarily elevated to
> > > RT99 so that the currently dispatched task will complete at the same
> > > priority as the waiter.
> > 
> > _Which_ waiter?
> 
> The RT99 task that submitted the request.

Now, again, why do you think this task should wait?

> >  I can't understand at all why work_struct should "inherit"
> > the priority of the task which queued it. 
> 
> Think about it:  If you are an RT99 task and you have work to do,
> shouldn't *all* of the work you need be done at RT99 if possible. 

No, I don't think so. Quite opposite, I think sometimes it makes
sense to "offload" some low-priority work from RT99 to workqueue
thread exactly because it has no rt policy.

And what about queue_work() from irq? Why should that work take a
"random" priority?

> Why
> should something like a measly RT98 task block you from completing your
> work. ;) The fact that you need to do some work via a workqueue (perhaps
> because you need specific cpu routing) is inconsequential, IMHO.

In that case I think it is better to create a special workqueue
and raise its priority.

Oleg.


  reply	other threads:[~2007-08-01 22:22 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-01  0:26 [PATCH] RT: Add priority-queuing and priority-inheritance to workqueue infrastructure Gregory Haskins
2007-08-01  3:52 ` Daniel Walker
2007-08-01 11:59   ` Gregory Haskins
2007-08-01 15:10     ` Daniel Walker
2007-08-01 15:19       ` Gregory Haskins
2007-08-01 15:55         ` Daniel Walker
2007-08-01 17:32           ` Gregory Haskins
2007-08-01 21:48       ` Esben Nielsen
2007-08-01 17:01   ` Peter Zijlstra
2007-08-01 17:10     ` Daniel Walker
2007-08-01 18:26       ` Oleg Nesterov
2007-08-01 18:39         ` Daniel Walker
2007-08-01 20:25           ` Oleg Nesterov
2007-08-01 18:12     ` Oleg Nesterov
2007-08-01 18:29       ` Daniel Walker
2007-08-01 20:18         ` Oleg Nesterov
2007-08-01 20:32           ` Oleg Nesterov
2007-08-01 20:43             ` Daniel Walker
2007-08-01 20:34           ` Daniel Walker
2007-08-01 20:50             ` Oleg Nesterov
2007-08-01 21:02               ` Daniel Walker
2007-08-01 21:13               ` Gregory Haskins
2007-08-01 21:34                 ` Oleg Nesterov
2007-08-01 21:59                   ` Gregory Haskins
2007-08-01 22:22                     ` Oleg Nesterov [this message]
2007-08-01 23:53                       ` Gregory Haskins
2007-08-02 19:50                         ` Oleg Nesterov
2007-08-06 11:35                           ` Gregory Haskins
2007-08-06 14:26                             ` Oleg Nesterov
2007-08-06 14:57                               ` Gregory Haskins
2007-08-06 15:36                                 ` Oleg Nesterov
2007-08-06 15:50                                   ` Gregory Haskins
2007-08-06 16:50                                     ` Oleg Nesterov
2007-08-06 16:57                                       ` Gregory Haskins
2007-08-06 11:49                           ` Ingo Molnar
2007-08-06 13:18                             ` Oleg Nesterov
2007-08-06 13:29                               ` Peter Zijlstra
2007-08-06 13:32                                 ` Peter Zijlstra
2007-08-06 14:45                                   ` Oleg Nesterov
2007-08-06 14:52                                     ` Peter Zijlstra
2007-08-06 16:40                                       ` Oleg Nesterov
2007-08-06 15:04                                     ` Gregory Haskins
2007-08-06 15:38                                       ` Oleg Nesterov
2007-08-06 19:33                           ` Oleg Nesterov
2007-08-06 19:37                             ` Gregory Haskins

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 \
    --in-reply-to=20070801222201.GA316@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=dwalker@mvista.com \
    --cc=ghaskins@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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