Re: [RFC] locking/rwsem: Avoid issuing wakeup before setting the reader waiter to nil
From: Peter Zijlstra
Date: Tue Dec 18 2018 - 08:14:27 EST
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.