* [PATCH] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache
@ 2010-02-15 14:10 Richard Kennedy
2010-02-15 14:16 ` Vivek Goyal
0 siblings, 1 reply; 6+ messages in thread
From: Richard Kennedy @ 2010-02-15 14:10 UTC (permalink / raw)
To: Jens Axboe, Vivek Goyal, Corrado Zoccolo, Jeff Moyer,
Gui Jianfeng; +Cc: lkml
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.
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
----
patch against 2.6.33-rc8
tested on x86_64 AMDX2
regards
Richard
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 023f4e6..db4c127 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -116,10 +116,10 @@ struct cfq_queue {
unsigned long dispatch_start;
unsigned int allocated_slice;
/* time when first request from queue completed and slice started. */
+ unsigned int slice_dispatch;
unsigned long slice_start;
unsigned long slice_end;
long slice_resid;
- unsigned int slice_dispatch;
/* pending metadata requests */
int meta_pending;
@@ -130,13 +130,13 @@ struct cfq_queue {
unsigned short ioprio, org_ioprio;
unsigned short ioprio_class, org_ioprio_class;
+ pid_t pid;
+
unsigned int seek_samples;
u64 seek_total;
sector_t seek_mean;
sector_t last_request_pos;
- pid_t pid;
-
struct cfq_rb_root *service_tree;
struct cfq_queue *new_cfqq;
struct cfq_group *cfqg;
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache
2010-02-15 14:10 [PATCH] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache Richard Kennedy
@ 2010-02-15 14:16 ` Vivek Goyal
2010-02-15 15:32 ` Richard Kennedy
2010-02-15 16:26 ` [PATCH v2] " Richard Kennedy
0 siblings, 2 replies; 6+ messages in thread
From: Vivek Goyal @ 2010-02-15 14:16 UTC (permalink / raw)
To: Richard Kennedy
Cc: Jens Axboe, Corrado Zoccolo, Jeff Moyer, Gui Jianfeng, lkml
On Mon, Feb 15, 2010 at 02:10:36PM +0000, Richard Kennedy wrote:
> 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.
>
>
> Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
> ----
> patch against 2.6.33-rc8
> tested on x86_64 AMDX2
>
> regards
> Richard
>
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index 023f4e6..db4c127 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -116,10 +116,10 @@ struct cfq_queue {
> unsigned long dispatch_start;
> unsigned int allocated_slice;
> /* time when first request from queue completed and slice started. */
> + unsigned int slice_dispatch;
Can you move it above the comment. The comment describes "slice_start" and
now comment and variable have been separated.
Vivek
> unsigned long slice_start;
> unsigned long slice_end;
> long slice_resid;
> - unsigned int slice_dispatch;
>
> /* pending metadata requests */
> int meta_pending;
> @@ -130,13 +130,13 @@ struct cfq_queue {
> unsigned short ioprio, org_ioprio;
> unsigned short ioprio_class, org_ioprio_class;
>
> + pid_t pid;
> +
> unsigned int seek_samples;
> u64 seek_total;
> sector_t seek_mean;
> sector_t last_request_pos;
>
> - pid_t pid;
> -
> struct cfq_rb_root *service_tree;
> struct cfq_queue *new_cfqq;
> struct cfq_group *cfqg;
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache
2010-02-15 14:16 ` Vivek Goyal
@ 2010-02-15 15:32 ` Richard Kennedy
2010-02-15 16:26 ` [PATCH v2] " Richard Kennedy
1 sibling, 0 replies; 6+ messages in thread
From: Richard Kennedy @ 2010-02-15 15:32 UTC (permalink / raw)
To: Vivek Goyal; +Cc: Jens Axboe, Corrado Zoccolo, Jeff Moyer, Gui Jianfeng, lkml
On Mon, 2010-02-15 at 09:16 -0500, Vivek Goyal wrote:
> On Mon, Feb 15, 2010 at 02:10:36PM +0000, Richard Kennedy wrote:
> > 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.
> >
> >
> > Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
> > ----
> > patch against 2.6.33-rc8
> > tested on x86_64 AMDX2
> >
> > regards
> > Richard
> >
> >
> > diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> > index 023f4e6..db4c127 100644
> > --- a/block/cfq-iosched.c
> > +++ b/block/cfq-iosched.c
> > @@ -116,10 +116,10 @@ struct cfq_queue {
> > unsigned long dispatch_start;
> > unsigned int allocated_slice;
> > /* time when first request from queue completed and slice started. */
> > + unsigned int slice_dispatch;
>
> Can you move it above the comment. The comment describes "slice_start" and
> now comment and variable have been separated.
>
> Vivek
Sure, no problem. I'll send out a new version.
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache
2010-02-15 14:16 ` Vivek Goyal
2010-02-15 15:32 ` Richard Kennedy
@ 2010-02-15 16:26 ` Richard Kennedy
2010-02-15 17:01 ` Jeff Moyer
2010-02-22 12:49 ` Jens Axboe
1 sibling, 2 replies; 6+ messages in thread
From: Richard Kennedy @ 2010-02-15 16:26 UTC (permalink / raw)
To: Vivek Goyal, Jens Axboe; +Cc: Corrado Zoccolo, Jeff Moyer, Gui Jianfeng, lkml
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.
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
----
patch against 2.6.33-rc8
tested on x86_64 AMDX2
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 023f4e6..e3dedfd 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -115,11 +115,11 @@ struct cfq_queue {
/* time when queue got scheduled in to dispatch first request. */
unsigned long dispatch_start;
unsigned int allocated_slice;
+ unsigned int slice_dispatch;
/* time when first request from queue completed and slice started. */
unsigned long slice_start;
unsigned long slice_end;
long slice_resid;
- unsigned int slice_dispatch;
/* pending metadata requests */
int meta_pending;
@@ -130,13 +130,13 @@ struct cfq_queue {
unsigned short ioprio, org_ioprio;
unsigned short ioprio_class, org_ioprio_class;
+ pid_t pid;
+
unsigned int seek_samples;
u64 seek_total;
sector_t seek_mean;
sector_t last_request_pos;
- pid_t pid;
-
struct cfq_rb_root *service_tree;
struct cfq_queue *new_cfqq;
struct cfq_group *cfqg;
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache
2010-02-15 16:26 ` [PATCH v2] " Richard Kennedy
@ 2010-02-15 17:01 ` Jeff Moyer
2010-02-22 12:49 ` Jens Axboe
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Moyer @ 2010-02-15 17:01 UTC (permalink / raw)
To: Richard Kennedy
Cc: Vivek Goyal, Jens Axboe, Corrado Zoccolo, Gui Jianfeng, lkml
Richard Kennedy <richard@rsk.demon.co.uk> 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@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache
2010-02-15 16:26 ` [PATCH v2] " Richard Kennedy
2010-02-15 17:01 ` Jeff Moyer
@ 2010-02-22 12:49 ` Jens Axboe
1 sibling, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2010-02-22 12:49 UTC (permalink / raw)
To: Richard Kennedy
Cc: Vivek Goyal, Corrado Zoccolo, Jeff Moyer, Gui Jianfeng, lkml
On Mon, Feb 15 2010, Richard Kennedy wrote:
> 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.
Thanks, applied!
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-02-22 12:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-15 14:10 [PATCH] cfq: reorder cfq_queue removing padding on 64bit & allowing more objects/slab in it's kmem_cache Richard Kennedy
2010-02-15 14:16 ` Vivek Goyal
2010-02-15 15:32 ` Richard Kennedy
2010-02-15 16:26 ` [PATCH v2] " Richard Kennedy
2010-02-15 17:01 ` Jeff Moyer
2010-02-22 12:49 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox