[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161121125535.GB1459@redhat.com>
Date: Mon, 21 Nov 2016 13:55:35 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Davidlohr Bueso <dave@...olabs.net>
Cc: mingo@...nel.org, peterz@...radead.org, john.stultz@...aro.org,
dimitrysh@...gle.com, linux-kernel@...r.kernel.org,
Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 2/3] locking/percpu-rwsem: Replace bulky wait-queues
with swait
On 11/18, Davidlohr Bueso wrote:
>
> @@ -12,7 +12,7 @@ struct percpu_rw_semaphore {
> struct rcu_sync rss;
> unsigned int __percpu *read_count;
> struct rw_semaphore rw_sem;
> - wait_queue_head_t writer;
> + struct swait_queue_head writer;
I won't argue, but even swait_queue_head is overkill in this case.
We can just add "struct task_struct *writer" into percpu_rw_semaphore,
__percpu_up_read:
rcu_read_lock();
writer = task_rcu_dereference(&sem->writer);
if (writer)
wake_up_process(writer);
rcu_read_unlock();
percpu_down_write() can set sem->writer == current and do the simple
while-not-condition-schedule() loop.
But this probably needs a couple of new helpers, and probably they
can have more users.
Oleg.
Powered by blists - more mailing lists