public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Alignment of fields in struct dentry
@ 2006-09-14  9:31 Jörn Engel
  2006-09-14 10:50 ` Jörn Engel
  0 siblings, 1 reply; 10+ messages in thread
From: Jörn Engel @ 2006-09-14  9:31 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel

After taking a look at struct dentry, Arnd noted an alignment
problem.  The first four fields currently are:
	atomic_t d_count;
	unsigned int d_flags;		/* protected by d_lock */
	spinlock_t d_lock;		/* per dentry lock */
	struct inode *d_inode;		/* Where the name belongs to - NULL is
					 * negative */
On 64bit architectures, the first three take 12 bytes and d_inode is
not naturally aligned, so it can be aligned to byte 16.  This grows a
struct dentry from 196 to 200 Bytes (assuming no funky config options
like DEBUG_*, PROFILING or PREEMT && SMP are set).

One possible solution would be to exchange d_inode with d_mounted, but
I fear that d_inode would move from a hot cacheline to a cold one,
reducing performance.  Could there be a good solution or would any
rearrangement here only cause regressions?

Also, both 196 and 200 bytes are fairly close to 192 bytes, so I could
imagine performance improvements on 64bit machines with 64 Byte
cachelines.  Might it make sense to trim DNAME_INLINE_LEN_MIN by 4 or
8 bytes for such machines?

Jörn

-- 
The wise man seeks everything in himself; the ignorant man tries to get
everything from somebody else.
-- unknown

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-09-18 21:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-14  9:31 [RFC] Alignment of fields in struct dentry Jörn Engel
2006-09-14 10:50 ` Jörn Engel
2006-09-14 18:33   ` Andreas Dilger
2006-09-14 21:02     ` Jörn Engel
2006-09-14 21:55       ` Andreas Dilger
2006-09-15 10:27         ` Jörn Engel
2006-09-15 13:41           ` Jörn Engel
2006-09-15 20:44           ` Arnd Bergmann
2006-09-18 21:24             ` Jörn Engel
2006-09-18 21:54               ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox