lkml.org 
[lkml]   [2015]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [tip:locking/core] locking/rwsem: Fix lock optimistic spinning when owner is not running
From
On Tue, Mar 10, 2015 at 10:28 AM, Oleg Nesterov <oleg@redhat.com> wrote:
>
> But this won't fix other problems we might have. For example, suppose
> that we will need get_task_struct(owner) in this code, this won't work.

I agree that SLAB_DESTROY_BY_RCU in general is fairly fragile, and
leads to subtle issues. If speculatively taking locks, for example,
they might need to be initialized in the constructor function, and not
ever touched at actual allocation time. Etc etc.

So I'm not a huge fan of SLAB_DESTROY_BY_RCU in general, but for
really core data structures like this, I think it's worth it. The
overhead of "call_rcu()" can be quite noticeable, and the other
alternative solutions (like that suggested task_rcu_dereference()) are
even *more* complex and subtle and generally perform worse.

I'm not claiming it's perfect, but I think the "access the task
pointer without locking" is kind of special and worth making work in
reasonable ways.

Linus


\
 
 \ /
  Last update: 2015-03-10 19:01    [W:0.078 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site