Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1353292

Re: [RFC v0] Use swait in completion

From Josh Cartwright <joshc@ni.com>
Newsgroups linux.kernel
Subject Re: [RFC v0] Use swait in completion
Date 2016-03-08 19:30 +0100
Message-ID <rauym-4FV-7@gated-at.bofh.it> (permalink)
References <rasdc-2OP-25@gated-at.bofh.it> <rau5k-4bI-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Mar 08, 2016 at 06:52:06PM +0100, Sebastian Andrzej Siewior wrote:
> * Daniel Wagner | 2016-03-08 16:59:13 [+0100]:
> 
> >Hi,
> Hi,
> 
> >As Peter correctly pointed out in [1] a simple conversion from
> >wait to swait in completion.c wont work. I played a bit around and
> >came up with this rather ugly idea.
> 
> besides all the things I mentioned privatly, here is what I have
> currently in -RT:
> 
> +void swake_up_all_locked(struct swait_queue_head *q)
> +{
> +       struct swait_queue *curr;
> +       int wakes = 0;
> +
> +       while (!list_empty(&q->task_list)) {
> +
> +               curr = list_first_entry(&q->task_list, typeof(*curr),
> +                                       task_list);
> +               wake_up_process(curr->task);
> +               list_del_init(&curr->task_list);
> +               wakes++;
> +       }
> +       WARN_ON(wakes > 2);
> +}
> +EXPORT_SYMBOL(swake_up_all_locked);
> 
> the remaining part is what you have. The only user so far is complete()
> and currently I see ony complete_all() with zero or one waiter.
> If none of my boxes die over the night, I intend to release this
> tomorrow in -RT and see if someone else triggers the limit.
> 
> However I don't think if your DEFER flag solution is all that bad.  I
> have also the block-mq in -RT using swait and they perform wakes with
> irqs-off. Not in -RT but mainline. So me might need something to make
> it work properly. But if we defer the wakeup they might come at us and
> complain about the latency???

Is it really just about latency?  Does this deferral not lead to an
inversion in the case where the single woken task isn't the highest
priority waiter on the completion (and doesn't run due to a
middle-priority thing spinning)?

In order for this to work, it seems like the chosen waiter would need to
inherit the highest priority of all waiters (which AFAICT isn't
happening).

  Josh

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v0] Use swait in completion Daniel Wagner <wagi@monom.org> - 2016-03-08 17:10 +0100
  Re: [RFC v0] Use swait in completion Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-03-08 19:00 +0100
    Re: [RFC v0] Use swait in completion Daniel Wagner <daniel.wagner@bmw-carit.de> - 2016-03-08 19:10 +0100
    Re: [RFC v0] Use swait in completion Josh Cartwright <joshc@ni.com> - 2016-03-08 19:30 +0100
      Re: [RFC v0] Use swait in completion Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-03-09 13:30 +0100

csiph-web