lkml.org 
[lkml]   [2018]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil
On Tue, Dec 18, 2018 at 02:10:31PM +0100, Peter Zijlstra wrote:
> On Mon, Dec 17, 2018 at 12:53:10PM -0800, Davidlohr Bueso wrote:

> > So how about the following to reduce some of the performance penalty (at
> > the cost of more complexity)?
>
> I'd rather do it like so, except I'm still conflicted on the naming.

> +void wake_q_add(struct wake_q_head *head, struct task_struct *task)
> +{
> + if (__wake_q_add(head, task))
> + get_task_struct(task);
> +}
> +
> +void wake_q_add_safe(struct wake_q_head *head, struct task_struct *task)
> +{
> + if (!__wake_a_add(head, task))
> + put_task_struct(task);
> }

That is, in the one case it has internal reference counting, in the
other case it consumes the reference counting.

\
 
 \ /
  Last update: 2018-12-18 14:14    [W:0.102 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site