[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140221054752.3905832359384e0f427ee9f8@skynet.be>
Date: Fri, 21 Feb 2014 05:47:52 +0800
From: Fabian Frederick <fabf@...net.be>
To: David Howells <dhowells@...hat.com>
Cc: linux-kernel@...r.kernel.org, akpm <akpm@...ux-foundation.org>,
cl@...ux-foundation.org
Subject: Re: Has slab ctor operation changed? -- was [PATCH 1/1] afs:
afs_alloc_inode: use kmem_cache_zalloc
On Thu, 20 Feb 2014 22:23:15 +0000
David Howells <dhowells@...hat.com> wrote:
> Fabian Frederick <fabf@...net.be> wrote:
>
> > afs_vnode is currently cleared with 2 memsets after allocation and
> > 1 in constructor (afs_i_init_once).
> > -This patch calls zalloc for explicit zero fill.
>
> Ummm... This patch isn't necessarily correct in the substantiative portions.
>
> Since afs_i_init_once() is called by the slab allocator during the course of
> kmem_cache_alloc(), how does kmem_cache_zalloc() interact with that?
Object of this patch was to replace any kmem_cache_alloc by kmem_cache_zalloc
so I guess what is done in the patch v2 in afs_alloc_inode below zalloc
would be ok (leaving ctor how it is) ?
>
> IIRC, it used to be that the ctor() function was called when the pages were
> allocated to the slab - and it wasn't called again, even if the object was
> allocated, deallocated and reallocated. This means that things like locks and
> lists don't need reinitialising after allocation.
>
> So afs_i_init_once() theoretically constructs the stuff that can be reused,
> and afs_alloc_inode() therefore has to clear the non-reusable state.
>
> Of course, it's possible that the slab allocator no longer works like this...
>
> David
--
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