Re: [RFC][PATCH] Manage jbd allocations from its own slabs

Dave Kleikamp <[email protected]> Thu, 24 Aug 2006 12:41:05 +0000
Newsgroups gmane.comp.file-systems.ext2.devel,gmane.linux.kernel
Message-ID <[email protected]>
On Wed, 2006-08-23 at 16:34 -0700, Andrew Morton wrote:
> On Wed, 23 Aug 2006 16:08:15 -0700
> Badari Pulavarty <[email protected]> wrote:

> >  /*
> > + * jbd slab management: create 1k, 2k, 4k, 8k slabs and allocate
> > + * frozen and commit buffers from these slabs.
> > + *
> > + * Reason for doing this is to avoid, SLAB_DEBUG - since it could
> > + * cause bh to cross page boundary.
> > + */
> > +
> > +static kmem_cache_t *jbd_slab[4];
> > +static const char *jbd_slab_names[4] = {
> > +	"jbd_1k",
> > +	"jbd_2k",
> > +	"jbd_4k",
> > +	"jbd_8k",
> > +};
> > +
> > +static void journal_destroy_jbd_slabs(void)
> > +{
> > +	int i;
> > +
> > +	for (i=0; i<4; i++) {
> > +		if (jbd_slab[i])
> > +			kmem_cache_destroy(jbd_slab[i]);
> > +		jbd_slab[i] = NULL;
> > +	}
> > +}
> > +
> > +static int journal_init_jbd_slabs(void)
> > +{
> > +	int i = 0;
> > +	int retval = 0;
> > +
> > +	for (i=0; i<4; i++) {
> > +		unsigned long slab_size = 1024 << i;
> > +		jbd_slab[i] = kmem_cache_create(jbd_slab_names[i],
> > +					slab_size, slab_size,
> > +					0, NULL, NULL);
> 
> OK, passing align=slab_size fixes the bug.

The comments above don't mention the alignment of the slabs, so a
comment here may help explain that the alignment is the key to avoiding
the page-straddling.  Or you could elaborate above.

Shaggy
-- 
David Kleikamp
IBM Linux Technology Center


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642