Re: [RFC v1 0/5] fs/locks: Use plain percpu spinlocks instead of lglock to protect file_lock

From: Daniel Wagner
Date: Wed Mar 04 2015 - 09:03:47 EST


On 03/03/2015 01:29 AM, Jeff Layton wrote:
>> Hmm, are you sure about that? I read the code this way that when a lock
>> is added to flock_list it stays on that CPU. The locks are not moved
>> from one flock_list to another during their existent.
>>
>
> Yes, I'm sure. When a file lock is acquired, we assign the fl_link_cpu
> to the current CPU and add it to the current CPU's global list. When
> the lock is released, any blocked lock that might have been blocking on
> it could acquire it at that point, and that doesn't necessarily occur
> on the same CPU as where the lock was originally held.
>
> So, it's entirely possible that between when you drop the spinlock on
> one CPU and pick it up on another, the lock could have been released
> and then reacquired on a different CPU.

D'oh. I am an idiot. I didn't really understand it the first time. Yes,
you are right.

cheers,
daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/