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.

Reply via email to