Re: [PATCH v2] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache

From: Jeff Moyer
Date: Mon Feb 15 2010 - 12:01:43 EST


Richard Kennedy <richard@xxxxxxxxxxxxxxx> writes:

> This removes 8 bytes of padding from struct cfq_queue on 64 bit builds,
> shrinking it's size to 256 bytes, so fitting into 1 fewer cachelines and
> allowing 1 more object/slab in it's kmem_cache.

OK, I ran pahole to verify your findings:

$ pahole -C cfq_queue build/master/block/cfq-iosched.o
struct cfq_queue {
...
unsigned int allocated_slice; /* 136 4 */

/* XXX 4 bytes hole, try to pack */

long unsigned int slice_start; /* 144 8 */

...
pid_t pid; /* 216 4 */

/* XXX 4 bytes hole, try to pack */

struct cfq_rb_root * service_tree; /* 224 8 */

...
/* size: 264, cachelines: 5, members: 34 */
/* sum members: 256, holes: 2, sum holes: 8 */
/* last cacheline: 8 bytes */

After applying the patch, it indeed does save a cacheline.

Reviewed-by: Jeff Moyer <jmoyer@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/