Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2013 23:36:21 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        current@freebsd.org
Subject:   Re: sysvshm: replace Giant with a local sx lock
Message-ID:  <20130423213621.GB6346@dft-labs.eu>
In-Reply-To: <20130423205532.GE67273@kib.kiev.ua>
References:  <20130423203823.GA6346@dft-labs.eu> <20130423205532.GE67273@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 23, 2013 at 11:55:32PM +0300, Konstantin Belousov wrote:
> On Tue, Apr 23, 2013 at 10:38:23PM +0200, Mateusz Guzik wrote:
> > I would like to replace Giant with a local sx lock in sysvshm code.
> > Looked really straightforward so maybe I missed something.
> 
> At very least, the shmget_existing() is no longer functional.
> The sx is owned around tsleep(), and thus a progress cannot be made
> by other thread, which needs the same sx lock.
> 
> Use of the SHMSEG_REMOVED in the shmget_allocate_segment() does
> not make any sense in your patch, since sleeping malloc allocation
> owns sx and prevent other threads from finding the segment.
> 
> I did not looked further.

Thank you for review, I definitely skimmed too fast.

Looks like this code has some bugs as it is already, e.g. kern_shmat
does not re-check for NULL p->p_vmspace->vm_shm after malloc.

I will respin in a couple of days with a better patch.
-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130423213621.GB6346>