On 01/03/15 at 11:02am, Stephen Hemminger wrote:
> As a follow on to Thomas's patch I think this would complete the
> transistion to RCU for netlink.
> Compile tested only.
> 
> 
> 
> This patch gets rid of the reader/writer nl_table_lock and replaces it
> with exclusively using RCU for reading, and a mutex for writing.
> 
> Signed-off-by: Stephen Hemminger <step...@networkplumber.org>

I like it. One thing I noticed it that it leaves a mix of
native mutex unlocks and unlocks via netlink_table_ungrab().

The Open vSwitch upcall is a pretty good real world Netlink
benchmark. I'll run the tests I have to see if this has any
unexpected side effects.

>  void netlink_table_grab(void)
> -     __acquires(nl_table_lock)
>  {
> -     might_sleep();
> -
> -     write_lock_irq(&nl_table_lock);
> -
> -     if (atomic_read(&nl_table_users)) {
> -             DECLARE_WAITQUEUE(wait, current);
> -
> -             add_wait_queue_exclusive(&nl_table_wait, &wait);
> -             for (;;) {
> -                     set_current_state(TASK_UNINTERRUPTIBLE);
> -                     if (atomic_read(&nl_table_users) == 0)
> -                             break;
> -                     write_unlock_irq(&nl_table_lock);
> -                     schedule();
> -                     write_lock_irq(&nl_table_lock);
> -             }
> -
> -             __set_current_state(TASK_RUNNING);
> -             remove_wait_queue(&nl_table_wait, &wait);
> -     }
> +     mutex_lock(&nl_table_mutex);
>  }

I left this untouched so far as I wasn't clear on what side effect
it would have to remove this as it does explicitely relax writers
right now.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to