Subject: SysV SHM MP-safeness
To: None <>
From: Mindaugas R. <>
List: tech-kern
Date: 11/26/2007 21:50:47

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.

Note, that patch is against vmlocking branch.

Best regards,