Subject: SysV SHM MP-safeness
To: None <tech-kern@NetBSD.org>
From: Mindaugas R. <rmind@NetBSD.org>
List: tech-kern
Date: 11/26/2007 21:50:47
Hello,
here is the patch to make SysV shared memory subsystem MP-safe. The
coarse-grained locking is used; shm_lock is held during the shm_memlock and
shmmap_getprivate. While the first is really not a problem, the latter
function might often perform a memory allocation, eg. create a separate shm
map and copy all entries from the parent process. Avoiding the lock would be
complicated here, and probably not worth - I did not estimated a heavy lock
contention, however, this is arguable. The patch also replaces tsleep/wakeup
with condvars, malloc with kmem, fixes the check of last segment when
reallocating and few minor bugs.
http://www.netbsd.org/~rmind/sysv_shm.diff
Note, that patch is against vmlocking branch.
Comments?
--
Best regards,
Mindaugas
www.NetBSD.org