Re: + syscalls-x86-add-__nr_kcmp-syscall-v8.patch added to -mm tree

Cyrill Gorcunov
2012-02-16T18:35:01Z

On Thu, Feb 16, 2012 at 10:21:06PM +0400, Vasiliy Kulikov wrote:
> On Thu, Feb 16, 2012 at 20:49 +0400, Cyrill Gorcunov wrote:
> > + err = mutex_lock_killable(m1);
> > + if (!err && likely(m1 != m2)) {
> > + err = mutex_lock_killable_nested(m2, SINGLE_DEPTH_NESTING);
>
> Doesn't it lead to a deadlock?
>
> mutex_lock_killable(task1)
> | mutex_lock_killable(task2)
> mutex_lock_killable_nested(task2) |
> (locked) |
> mutex_lock_killable_nested(task1)
> (locked)
>
> I suppose you should use some global lock (kcmp_lock) before both locks.

but here is if (m1 > m2) and swap() do take place.

Cyrill