[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181218131419.GD16284@hirez.programming.kicks-ass.net>
Date: Tue, 18 Dec 2018 14:14:19 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: Yongji Xie <elohimes@...il.com>, mingo@...hat.com,
will.deacon@....com, linux-kernel@...r.kernel.org,
Xie Yongji <xieyongji@...du.com>, zhangyu31@...du.com,
liuqi16@...du.com, yuanlinsi01@...du.com, nixun@...du.com,
lilin24@...du.com, longman@...hat.com,
andrea.parri@...rulasolutions.com
Subject: Re: [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.
Powered by blists - more mailing lists