lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Sat, 5 May 2007 12:59:46 +0300 (EEST)
From:	Pekka J Enberg <penberg@...helsinki.fi>
To:	akpm@...ux-foundation.org
cc:	linux-kernel@...r.kernel.org, reiserfs-dev@...esys.com,
	clameter@....com
Subject: [PATCH 4/4] reiserfs: remove inode constructor

From: Pekka Enberg <penberg@...helsinki.fi>

As alloc_inode() touches the same cache line as init_once(), we gain
nothing from using slab constructors.

Cc: <reiserfs-dev@...esys.com>
Cc: Christoph Lameter <clameter@....com>
Signed-off-by: Pekka Enberg <penberg@...helsinki.fi>
---
 fs/reiserfs/super.c |   33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

Index: 26-mm/fs/reiserfs/super.c
===================================================================
--- 26-mm.orig/fs/reiserfs/super.c	2007-05-03 11:14:12.000000000 +0300
+++ 26-mm/fs/reiserfs/super.c	2007-05-05 12:34:56.000000000 +0300
@@ -495,12 +495,21 @@ static struct kmem_cache *reiserfs_inode
 static struct inode *reiserfs_alloc_inode(struct super_block *sb)
 {
 	struct reiserfs_inode_info *ei;
-	ei = (struct reiserfs_inode_info *)
-	    kmem_cache_alloc(reiserfs_inode_cachep,
-						GFP_KERNEL|__GFP_RECLAIMABLE);
+	struct inode *inode;
+
+	ei = kmem_cache_alloc(reiserfs_inode_cachep,
+			      GFP_KERNEL|__GFP_RECLAIMABLE);
 	if (!ei)
 		return NULL;
-	return &ei->vfs_inode;
+
+	INIT_LIST_HEAD(&ei->i_prealloc_list);
+#ifdef CONFIG_REISERFS_FS_POSIX_ACL
+	ei->i_acl_access = NULL;
+	ei->i_acl_default = NULL;
+#endif
+	inode = &ei->vfs_inode;
+	inode_init_once(inode);
+	return inode;
 }
 
 static void reiserfs_destroy_inode(struct inode *inode)
@@ -508,20 +517,6 @@ static void reiserfs_destroy_inode(struc
 	kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
 }
 
-static void init_once(void *foo, struct kmem_cache * cachep, unsigned long flags)
-{
-	struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
-
-	if (flags & SLAB_CTOR_CONSTRUCTOR) {
-		INIT_LIST_HEAD(&ei->i_prealloc_list);
-		inode_init_once(&ei->vfs_inode);
-#ifdef CONFIG_REISERFS_FS_POSIX_ACL
-		ei->i_acl_access = NULL;
-		ei->i_acl_default = NULL;
-#endif
-	}
-}
-
 static int init_inodecache(void)
 {
 	reiserfs_inode_cachep = kmem_cache_create("reiser_inode_cache",
@@ -529,7 +524,7 @@ static int init_inodecache(void)
 							 reiserfs_inode_info),
 						  0, (SLAB_RECLAIM_ACCOUNT|
 							SLAB_MEM_SPREAD),
-						  init_once, NULL);
+						  NULL, NULL);
 	if (reiserfs_inode_cachep == NULL)
 		return -ENOMEM;
 	return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ