Skip to content

Commit 50953fe

Browse files
Christoph LameterLinus Torvalds
authored andcommitted
slab allocators: Remove SLAB_DEBUG_INITIAL flag
I have never seen a use of SLAB_DEBUG_INITIAL. It is only supported by SLAB. I think its purpose was to have a callback after an object has been freed to verify that the state is the constructor state again? The callback is performed before each freeing of an object. I would think that it is much easier to check the object state manually before the free. That also places the check near the code object manipulation of the object. Also the SLAB_DEBUG_INITIAL callback is only performed if the kernel was compiled with SLAB debugging on. If there would be code in a constructor handling SLAB_DEBUG_INITIAL then it would have to be conditional on SLAB_DEBUG otherwise it would just be dead code. But there is no such code in the kernel. I think SLUB_DEBUG_INITIAL is too problematic to make real use of, difficult to understand and there are easier ways to accomplish the same effect (i.e. add debug code before kfree). There is a related flag SLAB_CTOR_VERIFY that is frequently checked to be clear in fs inode caches. Remove the pointless checks (they would even be pointless without removeal of SLAB_DEBUG_INITIAL) from the fs constructors. This is the last slab flag that SLUB did not support. Remove the check for unimplemented flags from SLUB. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4b1d892 commit 50953fe

55 files changed

Lines changed: 55 additions & 136 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/powerpc/platforms/cell/spufs/inode.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ spufs_init_once(void *p, struct kmem_cache * cachep, unsigned long flags)
7171
{
7272
struct spufs_inode_info *ei = p;
7373

74-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
75-
SLAB_CTOR_CONSTRUCTOR) {
74+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
7675
inode_init_once(&ei->vfs_inode);
7776
}
7877
}

‎drivers/mtd/ubi/eba.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,7 @@ static void ltree_entry_ctor(void *obj, struct kmem_cache *cache,
940940
{
941941
struct ltree_entry *le = obj;
942942

943-
if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) !=
944-
SLAB_CTOR_CONSTRUCTOR)
943+
if (flags & SLAB_CTOR_CONSTRUCTOR)
945944
return;
946945

947946
le->users = 0;

‎fs/adfs/super.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
232232
{
233233
struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
234234

235-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
236-
SLAB_CTOR_CONSTRUCTOR)
235+
if (flags & SLAB_CTOR_CONSTRUCTOR)
237236
inode_init_once(&ei->vfs_inode);
238237
}
239238

‎fs/affs/super.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
8787
{
8888
struct affs_inode_info *ei = (struct affs_inode_info *) foo;
8989

90-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
91-
SLAB_CTOR_CONSTRUCTOR) {
90+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
9291
init_MUTEX(&ei->i_link_lock);
9392
init_MUTEX(&ei->i_ext_lock);
9493
inode_init_once(&ei->vfs_inode);

‎fs/afs/super.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,7 @@ static void afs_i_init_once(void *_vnode, struct kmem_cache *cachep,
453453
{
454454
struct afs_vnode *vnode = _vnode;
455455

456-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
457-
SLAB_CTOR_CONSTRUCTOR) {
456+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
458457
memset(vnode, 0, sizeof(*vnode));
459458
inode_init_once(&vnode->vfs_inode);
460459
init_waitqueue_head(&vnode->update_waitq);

‎fs/befs/linuxvfs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
293293
{
294294
struct befs_inode_info *bi = (struct befs_inode_info *) foo;
295295

296-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
297-
SLAB_CTOR_CONSTRUCTOR) {
296+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
298297
inode_init_once(&bi->vfs_inode);
299298
}
300299
}

‎fs/bfs/inode.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
248248
{
249249
struct bfs_inode_info *bi = foo;
250250

251-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
252-
SLAB_CTOR_CONSTRUCTOR)
251+
if (flags & SLAB_CTOR_CONSTRUCTOR)
253252
inode_init_once(&bi->vfs_inode);
254253
}
255254

‎fs/block_dev.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,7 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag
457457
struct bdev_inode *ei = (struct bdev_inode *) foo;
458458
struct block_device *bdev = &ei->bdev;
459459

460-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
461-
SLAB_CTOR_CONSTRUCTOR)
462-
{
460+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
463461
memset(bdev, 0, sizeof(*bdev));
464462
mutex_init(&bdev->bd_mutex);
465463
sema_init(&bdev->bd_mount_sem, 1);

‎fs/buffer.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,8 +2953,7 @@ EXPORT_SYMBOL(free_buffer_head);
29532953
static void
29542954
init_buffer_head(void *data, struct kmem_cache *cachep, unsigned long flags)
29552955
{
2956-
if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
2957-
SLAB_CTOR_CONSTRUCTOR) {
2956+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
29582957
struct buffer_head * bh = (struct buffer_head *)data;
29592958

29602959
memset(bh, 0, sizeof(*bh));

‎fs/cifs/cifsfs.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,7 @@ cifs_init_once(void *inode, struct kmem_cache * cachep, unsigned long flags)
701701
{
702702
struct cifsInodeInfo *cifsi = inode;
703703

704-
if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
705-
SLAB_CTOR_CONSTRUCTOR) {
704+
if (flags & SLAB_CTOR_CONSTRUCTOR) {
706705
inode_init_once(&cifsi->vfs_inode);
707706
INIT_LIST_HEAD(&cifsi->lockList);
708707
}

0 commit comments

Comments
 (0)