Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1244514
| From | Daniel Wagner <daniel.wagner@bmw-carit.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v1 3/8] sched/completion: convert completions to use simple wait queues |
| Date | 2015-10-12 11:20 +0200 |
| Message-ID | <qiHqW-2Xd-13@gated-at.bofh.it> (permalink) |
| References | <q6Mml-2BO-3@gated-at.bofh.it> <q6Mmn-2BO-31@gated-at.bofh.it> <q6OxP-5FK-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 09/09/2015 04:26 PM, Peter Zijlstra wrote:
> On Wed, Sep 09, 2015 at 02:05:29PM +0200, Daniel Wagner wrote:
>> @@ -50,10 +50,10 @@ void complete_all(struct completion *x)
>> {
>> unsigned long flags;
>>
>> - spin_lock_irqsave(&x->wait.lock, flags);
>> + raw_spin_lock_irqsave(&x->wait.lock, flags);
>> x->done += UINT_MAX/2;
>> - __wake_up_locked(&x->wait, TASK_NORMAL, 0);
>> - spin_unlock_irqrestore(&x->wait.lock, flags);
>> + swake_up_locked(&x->wait);
>> + raw_spin_unlock_irqrestore(&x->wait.lock, flags);
>> }
>> EXPORT_SYMBOL(complete_all);
>
> I don't think that's correct; __wake_up_locked(.nr=0) would wake all
> waiters, where swake_up_locked() will only wake one.
I read that x->done should be protected via wait.lock during the whole
operation. swake_up_all() will release and reacquire the lock while
processing the all waiters. So we need to get
Could we play a trick like setting the highest bit in done for
indicating the complete_all() operation. The UINT_MAX/2 update looks
like do this by setting a value which has the biggest offset from 0 (but
why adding instead of just going for assigning...).
cheers,
daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH v1 3/8] sched/completion: convert completions to use simple wait queues Daniel Wagner <daniel.wagner@bmw-carit.de> - 2015-10-12 11:20 +0200
Re: [PATCH v1 3/8] sched/completion: convert completions to use simple wait queues Daniel Wagner <daniel.wagner@bmw-carit.de> - 2015-10-12 12:10 +0200
Re: [PATCH v1 3/8] sched/completion: convert completions to use simple wait queues Peter Zijlstra <peterz@infradead.org> - 2015-10-12 14:00 +0200
Re: [PATCH v1 3/8] sched/completion: convert completions to use simple wait queues Daniel Wagner <daniel.wagner@bmw-carit.de> - 2015-10-12 14:50 +0200
csiph-web