Commit 597648bb authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] remove cacheline alignment from inode slabs

Most of the inode slabs are cacheline aligned.  This can waste a fair
amount of memory, especially on architectures with large cacheline sizes
(eg 128 bytes).

Alignment has a few advantages.  It prevents 2 cpus from accessing 2 data
structures in the same cacheline.  Since struct inodes are well over a
cacheline and there are so many of them, there is little chance we will hit
this problem if we remove the alignment.  

Alignment also ensures the maximum amount of the data structure is in the
same cacheline (instead of straddling 2 for example).  The large size of
struct inode reduces this advantage.

With this patch the inode_cache slab goes from 640 bytes to 544 bytes, and
the number that fits in a 4kB slab goes from 6 to 7 on ppc64.  A number of
other inode slabs also see improvements.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2f3e61cd
......@@ -241,7 +241,7 @@ static int init_inodecache(void)
{
adfs_inode_cachep = kmem_cache_create("adfs_inode_cache",
sizeof(struct adfs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (adfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -115,7 +115,7 @@ static int init_inodecache(void)
{
affs_inode_cachep = kmem_cache_create("affs_inode_cache",
sizeof(struct affs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (affs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -433,7 +433,7 @@ befs_init_inodecache(void)
{
befs_inode_cachep = kmem_cache_create("befs_inode_cache",
sizeof (struct befs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (befs_inode_cachep == NULL) {
printk(KERN_ERR "befs_init_inodecache: "
......
......@@ -245,7 +245,7 @@ static int init_inodecache(void)
{
bfs_inode_cachep = kmem_cache_create("bfs_inode_cache",
sizeof(struct bfs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (bfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -561,7 +561,7 @@ cifs_init_inodecache(void)
{
cifs_inode_cachep = kmem_cache_create("cifs_inode_cache",
sizeof (struct cifsInodeInfo),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
cifs_init_once, NULL);
if (cifs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -69,7 +69,7 @@ int coda_init_inodecache(void)
{
coda_inode_cachep = kmem_cache_create("coda_inode_cache",
sizeof(struct coda_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (coda_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -58,7 +58,7 @@ static int init_inodecache(void)
{
efs_inode_cachep = kmem_cache_create("efs_inode_cache",
sizeof(struct efs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (efs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -190,7 +190,7 @@ static int init_inodecache(void)
{
ext2_inode_cachep = kmem_cache_create("ext2_inode_cache",
sizeof(struct ext2_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ext2_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -477,7 +477,7 @@ static int init_inodecache(void)
{
ext3_inode_cachep = kmem_cache_create("ext3_inode_cache",
sizeof(struct ext3_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ext3_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -744,7 +744,7 @@ int __init fat_init_inodecache(void)
{
fat_inode_cachep = kmem_cache_create("fat_inode_cache",
sizeof(struct msdos_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (fat_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -191,7 +191,7 @@ static int init_inodecache(void)
{
hpfs_inode_cachep = kmem_cache_create("hpfs_inode_cache",
sizeof(struct hpfs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (hpfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1373,8 +1373,7 @@ void __init inode_init(unsigned long mempages)
/* inode slab cache */
inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode),
0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, init_once,
NULL);
0, SLAB_PANIC, init_once, NULL);
set_shrinker(DEFAULT_SEEKS, shrink_icache_memory);
}
......
......@@ -108,7 +108,7 @@ static int init_inodecache(void)
{
isofs_inode_cachep = kmem_cache_create("isofs_inode_cache",
sizeof(struct iso_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (isofs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -302,7 +302,7 @@ static int __init init_jffs2_fs(void)
jffs2_inode_cachep = kmem_cache_create("jffs2_i",
sizeof(struct jffs2_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
jffs2_i_init_once, NULL);
if (!jffs2_inode_cachep) {
printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n");
......
......@@ -79,7 +79,7 @@ static int init_inodecache(void)
{
minix_inode_cachep = kmem_cache_create("minix_inode_cache",
sizeof(struct minix_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (minix_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -72,7 +72,7 @@ static int init_inodecache(void)
{
ncp_inode_cachep = kmem_cache_create("ncp_inode_cache",
sizeof(struct ncp_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ncp_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1859,7 +1859,7 @@ int nfs_init_inodecache(void)
{
nfs_inode_cachep = kmem_cache_create("nfs_inode_cache",
sizeof(struct nfs_inode),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (nfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -2638,7 +2638,7 @@ static int __init init_ntfs_fs(void)
ntfs_inode_cache = kmem_cache_create(ntfs_inode_cache_name,
sizeof(ntfs_inode), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT, NULL, NULL);
SLAB_RECLAIM_ACCOUNT, NULL, NULL);
if (!ntfs_inode_cache) {
printk(KERN_CRIT "NTFS: Failed to create %s!\n",
ntfs_inode_cache_name);
......
......@@ -120,7 +120,7 @@ int __init proc_init_inodecache(void)
{
proc_inode_cachep = kmem_cache_create("proc_inode_cache",
sizeof(struct proc_inode),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (proc_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -544,7 +544,7 @@ static int init_inodecache(void)
{
qnx4_inode_cachep = kmem_cache_create("qnx4_inode_cache",
sizeof(struct qnx4_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (qnx4_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -444,7 +444,7 @@ static int init_inodecache(void)
{
reiserfs_inode_cachep = kmem_cache_create("reiser_inode_cache",
sizeof(struct reiserfs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (reiserfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -579,7 +579,7 @@ static int init_inodecache(void)
{
romfs_inode_cachep = kmem_cache_create("romfs_inode_cache",
sizeof(struct romfs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (romfs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -80,7 +80,7 @@ static int init_inodecache(void)
{
smb_inode_cachep = kmem_cache_create("smb_inode_cache",
sizeof(struct smb_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (smb_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -340,7 +340,7 @@ int __init sysv_init_icache(void)
{
sysv_inode_cachep = kmem_cache_create("sysv_inode_cache",
sizeof(struct sysv_inode_info), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (!sysv_inode_cachep)
return -ENOMEM;
......
......@@ -145,7 +145,7 @@ static int init_inodecache(void)
{
udf_inode_cachep = kmem_cache_create("udf_inode_cache",
sizeof(struct udf_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (udf_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -1183,7 +1183,7 @@ static int init_inodecache(void)
{
ufs_inode_cachep = kmem_cache_create("ufs_inode_cache",
sizeof(struct ufs_inode_info),
0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (ufs_inode_cachep == NULL)
return -ENOMEM;
......
......@@ -335,8 +335,7 @@ STATIC int
init_inodecache( void )
{
linvfs_inode_zone = kmem_cache_create("linvfs_icache",
sizeof(vnode_t), 0,
SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
sizeof(vnode_t), 0, SLAB_RECLAIM_ACCOUNT,
init_once, NULL);
if (linvfs_inode_zone == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment