Re: ipc,sem: sysv semaphore scalability

From: Andrew Morton
Date: Tue Apr 16 2013 - 19:30:47 EST


On Tue, 26 Mar 2013 11:35:33 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> Do we need the locking at all? What does it actually do?
>
> sem_lock_and_putref(sma);
> if (sma->sem_perm.deleted) {
> sem_unlock(sma, -1);
> err = -EIDRM;
> goto out_free;
> }
> sem_unlock(sma, -1);
>
> We're taking the lock, testing an int and then dropping the lock.
> What's the point in that?

Rikpoke.

The new semctl_main() is now taking a lock, testing
sma->sem_perm.deleted then dropping that lock. It looks wrong. What
is that lock testing against? What prevents .deleted from changing
value 1ns after we dropped that lock?

--
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/