mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Andrew Morton <akpm@osdl.org>
Cc: dipankar@in.ibm.com, manfred@colorfullife.com, davej@redhat.com,
	wli@holomorphy.com, linux-kernel@vger.kernel.org,
	maneesh@in.ibm.com
Subject: Re: dentry bloat.
Date: Sat, 8 May 2004 19:55:39 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0405081947290.1592@ppc970.osdl.org> (raw)
In-Reply-To: <20040508171027.6e469f70.akpm@osdl.org>


Ok,
 while we're discussing the other things, how about for now
just having this fairly minimal patch to get rid of the most egregious 
memory mis-use.

This removes the SLAB_HWCACHE_ALIGN and the cache line alignment on
"struct dentry", and to compensate for the fact that the inline name
length will shrink quite a bit it changes DNAME_INLINE_LEN_MIN from 16 to
24.

It also re-orders the first few fields of the dentry, since the "count"  
and "d_lock" should be 32-bit on most 64-bit architectures, so to avoid
having unnecessary unused space, we should just put them together
(everything else there is goign to be comprised of 64-bit entities, I
think).

So this should bring the size of a dentry down to 160 bytes on x86, from
either 192 of 256 bytes (depending on cacheline size). And 24 bytes of
inline name (it can be a bit more on some architectures, due to longword
alignment or similar) should still capture most of the dentries by far.

Let's see what Andrew's more complex patches can do to bring the size of 
"struct dentry" down further.

		Linus

--- 1.71/fs/dcache.c	Mon Apr 26 22:07:34 2004
+++ edited/fs/dcache.c	Sat May  8 17:41:30 2004
@@ -1558,14 +1558,11 @@
 	 * A constructor could be added for stable state like the lists,
 	 * but it is probably not worth it because of the cache nature
 	 * of the dcache. 
-	 * If fragmentation is too bad then the SLAB_HWCACHE_ALIGN
-	 * flag could be removed here, to hint to the allocator that
-	 * it should not try to get multiple page regions.  
 	 */
 	dentry_cache = kmem_cache_create("dentry_cache",
 					 sizeof(struct dentry),
 					 0,
-					 SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+					 SLAB_RECLAIM_ACCOUNT,
 					 NULL, NULL);
 	if (!dentry_cache)
 		panic("Cannot create dentry cache");
===== include/linux/dcache.h 1.36 vs edited =====
--- 1.36/include/linux/dcache.h	Mon Jan 19 15:38:11 2004
+++ edited/include/linux/dcache.h	Sat May  8 19:39:47 2004
@@ -74,14 +74,14 @@
 	return end_name_hash(hash);
 }
 
-#define DNAME_INLINE_LEN_MIN 16
+#define DNAME_INLINE_LEN_MIN 24
 
 struct dcookie_struct;
  
 struct dentry {
 	atomic_t d_count;
-	unsigned long d_vfs_flags;	/* moved here to be on same cacheline */
 	spinlock_t d_lock;		/* per dentry lock */
+	unsigned long d_vfs_flags;	/* moved here to be on same cacheline */
 	struct inode  * d_inode;	/* Where the name belongs to - NULL is negative */
 	struct list_head d_lru;		/* LRU list */
 	struct list_head d_child;	/* child of parent list */
@@ -102,7 +102,7 @@
 	struct hlist_node d_hash;	/* lookup hash list */	
 	struct hlist_head * d_bucket;	/* lookup hash bucket */
 	unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
-} ____cacheline_aligned;
+};
 
 #define DNAME_INLINE_LEN	(sizeof(struct dentry)-offsetof(struct dentry,d_iname))
  

  reply	other threads:[~2004-05-09  2:56 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040506200027.GC26679@redhat.com>
     [not found] ` <20040506150944.126bb409.akpm@osdl.org>
     [not found]   ` <409B1511.6010500@colorfullife.com>
2004-05-08  8:23     ` Andrew Morton
2004-05-08  9:23       ` Andrew Morton
2004-05-08 10:11         ` Andrew Morton
2004-05-08 10:12           ` Andrew Morton
2004-05-08 10:28           ` viro
2004-05-08 10:41             ` Andrew Morton
2004-05-08 10:52             ` Andrew Morton
2004-05-08 10:31           ` Manfred Spraul
2004-05-08 17:28           ` Linus Torvalds
2004-05-08 18:19             ` David S. Miller
2004-05-08 19:01             ` Andrew Morton
2004-05-08 19:13               ` Linus Torvalds
2004-05-08 19:27                 ` Andrew Morton
2004-05-08 19:27                 ` Linus Torvalds
2004-05-08 20:42                   ` Dipankar Sarma
2004-05-08 20:55                     ` Andrew Morton
2004-05-08 21:19                       ` Dipankar Sarma
2004-05-09  0:10                         ` Andrew Morton
2004-05-09  2:55                           ` Linus Torvalds [this message]
2004-05-09  3:12                             ` David S. Miller
2004-05-09  3:53                               ` Linus Torvalds
2004-05-09 21:03                                 ` Matt Mackall
2004-05-10  8:27                                   ` Helge Hafting
2004-05-10  8:32                                     ` Arjan van de Ven
2004-05-10  9:46                                       ` Andrew Morton
2004-05-10 14:54                                         ` Matt Mackall
2004-05-10 16:26                                           ` Paul E. McKenney
2004-05-10 18:34                                             ` Dipankar Sarma
2004-05-09  4:12                             ` Andrew Morton
2004-05-09  4:25                               ` Linus Torvalds
2004-05-09  4:36                                 ` Andrew Morton
2004-05-09  5:14                                   ` Linus Torvalds
2004-05-09  7:36                                     ` Rodolfo Guluarte Hale
2004-05-09  9:10                                     ` Guennadi Liakhovetski
2004-05-09  9:23                                       ` viro
2004-05-09 15:35                                       ` Linus Torvalds
2004-05-09 18:11                                         ` Matt Mackall
2004-05-09 22:08                                           ` Francois Romieu
2004-05-09 23:51                                           ` Paul Jackson
2004-05-10  7:17                                         ` Florian Weimer
2004-05-10 14:12                                         ` Rik van Riel
2004-05-09  4:43                                 ` Linus Torvalds
2004-05-09  7:28                     ` Manfred Spraul
2004-05-09 15:33                       ` Dipankar Sarma
2004-05-09 22:17                         ` viro
2004-05-09 22:27                           ` Andrew Morton
2004-05-11  5:26                             ` Maneesh Soni
2004-05-10 18:39                           ` Dipankar Sarma
2004-05-11  5:17                             ` Maneesh Soni
2004-05-08 20:13                 ` Dipankar Sarma
2004-10-06 12:58                   ` Maneesh Soni
2004-05-11 20:22                     ` Andrew Morton
2004-05-14 10:33                       ` Raghavan
2004-05-14 10:50                         ` Paul Jackson
2004-05-14 11:04                           ` Jens Axboe
2004-05-14 11:14                             ` Paul Jackson
2004-05-14 11:24                               ` Dipankar Sarma
2004-05-14 11:24                               ` Jens Axboe
2004-05-14 11:30                                 ` Paul Jackson
2004-05-14 11:18                         ` Dipankar Sarma
2004-05-14 14:44                           ` Linus Torvalds
2004-05-08 21:00               ` Dipankar Sarma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0405081947290.1592@ppc970.osdl.org \
    --to=torvalds@osdl.org \
    --cc=akpm@osdl.org \
    --cc=davej@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=manfred@colorfullife.com \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®