[lkml]   [2015]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 4/4] locking: Introduce smp_cond_acquire()
On Thu, Nov 12, 2015 at 10:21:39AM -0800, Linus Torvalds wrote:
> Now, the point of spin_unlock_wait() (and "spin_is_locked()") should
> generally be that you have some external ordering guarantee that
> guarantees that the lock has been taken. For example, for the IPC
> semaphores, we do either one of:
> (a) get large lock, then - once you hold that lock - wait for each small lock
> or
> (b) get small lock, then - once you hold that lock - check that the
> largo lock is unlocked
> and that's the case we should really worry about. The other uses of
> spin_unlock_wait() should have similar "I have other reasons to know
> I've seen that the lock was taken, or will never be taken after this
> because XYZ".

I don't think this is true for the usage in do_exit(), we have no
knowledge on if pi_lock is taken or not. We just want to make sure that
_if_ it were taken, we wait until it is released.

But I'm not sure where task_work_run() sits, at first reading it appears
to also not be true -- there doesn't appear to be a reason we know a
lock to be held.

It does however appear true for the usage in completion_done(), where by
having tested x->done, we know a pi_lock _was_ held.

 \ /
  Last update: 2015-11-16 17:21    [W:0.131 / U:2.640 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site