lkml.org 
[lkml]   [2009]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 6/6] Makes procs file writable to move all threads by tgid at once
    On 06/08/09 11:58 +0200, Louis Rilling wrote:
    > On 05/08/09 17:01 -0700, Benjamin Blum wrote:
    > > On Wed, Aug 5, 2009 at 9:42 AM, Louis Rilling<Louis.Rilling@kerlabs.com> wrote:
    > > > On 05/08/09  9:11 -0700, Paul Menage wrote:
    > > >> On Wed, Aug 5, 2009 at 3:20 AM, Louis Rilling<Louis.Rilling@kerlabs.com> wrote:
    > > >> >
    > > >> > The downside of this is teaching lockdep about this recursive locking. Not that
    > > >> > simple actually...
    > > >>
    > > >> Don't we just give each thread's lock its own lock class? That's what
    > > >> we did for the cgroup hierarchy_mutex.
    > > >
    > > > Given that lock classes must be static and that lockdep only supports a limited
    > > > lock depth, this is an issue for processes having many threads.
    > > >
    > > >>
    > > >> > so that such cases are currently handled using a higher-level
    > > >> > lock that prevents races in locking the whole chain (there was one such example
    > > >> > for locking all vmas with KVM). IIUC, the intent here is to avoid such
    > > >> > higher-level lock.
    > > >>
    > > >> cgroup_mutex already fulfills the role of the higher-level lock.
    > > >
    > > > If so (that is, here cgroup_mutex is taken before write-locking all threads'
    > > > rw_sem), then enhancing rwsem's interface in a similar way to the
    > > > spin_lock_nest_lock() interface could do it. There will still be an issue with
    > > > many threads and lockdep limited lock depth though.
    > >
    > > If we make the locks per-thread, then we can use plain mutexes instead
    > > of rwsems since the only reader will ever be the owning thread itself,
    > > and we can use mutex_lock_nested.
    >
    > mutex_lock_nested is not enough, since this would require putting each thread's
    > mutex in a different class.

    Not exactly what I meant, sorry. This would require defining as many sub-classes
    as possible (still limited to MAX_LOCK_DEPTH) to support many threads.

    > Again, something like mutex_lock_nest_lock() is
    > the solution, especially since Peter's recent improvement.
    >
    Louis

    --
    Dr Louis Rilling Kerlabs
    Skype: louis.rilling Batiment Germanium
    Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
    http://www.kerlabs.com/ 35700 Rennes
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2009-08-06 12:07    [W:0.022 / U:29.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site