Bug 2838006 (Corrupt SHM_LOCK_DEST flag)

John Hughes <[email protected]> Wed, 03 Feb 2010 11:09:42 +0100
Newsgroups gmane.linux.cluster.ssic.devel
Message-ID <[email protected]>
Currently we have:

/* shm_mode upper byte flags */
#define SHM_DEST        01000   /* segment will be destroyed on last detach */
#define SHM_LOCKED      02000   /* segment will not be swapped */
#define SHM_HUGETLB     04000   /* segment will use huge TLB pages */
#ifdef CONFIG_SSI
/* SSI_XXX: no room for SHM_LOCK_DEST */
#define SHM_LOCK_DEST   10000   /* obj locked for destroy */
#endif /* CONFIG_SSI */

Naive question - why not just:

#define SHM_LOCK_DEST   010000   /* obj locked for destroy */

Would need changing later as at some point the base kernel has:

#define SHM_NORESERVE   010000  /* don't check for reservations */

The comment says "upper byte flags", this is true if they're using 9 bit 
bytes.  :-)

The low 9 bits are the 3 octal digits of the shm access more "rwx".

Above that we have at least a healthy 16-9 = 11 bits available.   (shm 
flags is stored in a mode_t, which is an unsigned short on i386, an 
unsigned int on x86_64).






------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com