* [PATCH] null-blk: save memory footprint for struct nullb_cmd
@ 2022-04-26 2:21 Yu Kuai
2022-04-26 2:31 ` Jens Axboe
2022-04-26 6:20 ` Chaitanya Kulkarni
0 siblings, 2 replies; 3+ messages in thread
From: Yu Kuai @ 2022-04-26 2:21 UTC (permalink / raw)
To: axboe, shinichiro.kawasaki, chaitanya.kulkarni
Cc: linux-block, linux-kernel, yukuai3, yi.zhang
Total 16 bytes can be saved in two ways:
1) The field 'bio' will only be used in bio based mode, and the field
'rq' will only be used in mq mode. Since they won't be used in the
same time, declare a union for them.
2) The field 'bool fake_timeout' can be placed in the hole after the
field 'error'.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
drivers/block/null_blk/null_blk.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 78eb56b0ca55..4525a65e1b23 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -16,13 +16,15 @@
#include <linux/mutex.h>
struct nullb_cmd {
- struct request *rq;
- struct bio *bio;
+ union {
+ struct request *rq;
+ struct bio *bio;
+ };
unsigned int tag;
blk_status_t error;
+ bool fake_timeout;
struct nullb_queue *nq;
struct hrtimer timer;
- bool fake_timeout;
};
struct nullb_queue {
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] null-blk: save memory footprint for struct nullb_cmd
2022-04-26 2:21 [PATCH] null-blk: save memory footprint for struct nullb_cmd Yu Kuai
@ 2022-04-26 2:31 ` Jens Axboe
2022-04-26 6:20 ` Chaitanya Kulkarni
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-04-26 2:31 UTC (permalink / raw)
To: chaitanya.kulkarni, shinichiro.kawasaki, yukuai3
Cc: linux-block, linux-kernel, yi.zhang
On Tue, 26 Apr 2022 10:21:33 +0800, Yu Kuai wrote:
> Total 16 bytes can be saved in two ways:
>
> 1) The field 'bio' will only be used in bio based mode, and the field
> 'rq' will only be used in mq mode. Since they won't be used in the
> same time, declare a union for them.
> 2) The field 'bool fake_timeout' can be placed in the hole after the
> field 'error'.
>
> [...]
Applied, thanks!
[1/1] null-blk: save memory footprint for struct nullb_cmd
commit: 8ba816b23abd2a9a05705f3d00b8653f8be73015
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] null-blk: save memory footprint for struct nullb_cmd
2022-04-26 2:21 [PATCH] null-blk: save memory footprint for struct nullb_cmd Yu Kuai
2022-04-26 2:31 ` Jens Axboe
@ 2022-04-26 6:20 ` Chaitanya Kulkarni
1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2022-04-26 6:20 UTC (permalink / raw)
To: Yu Kuai
Cc: linux-block, shinichiro.kawasaki, linux-kernel, axboe, yi.zhang,
chaitanya.kulkarni
On 4/25/22 19:21, Yu Kuai wrote:
> Total 16 bytes can be saved in two ways:
>
> 1) The field 'bio' will only be used in bio based mode, and the field
> 'rq' will only be used in mq mode. Since they won't be used in the
> same time, declare a union for them.
> 2) The field 'bool fake_timeout' can be placed in the hole after the
> field 'error'.
>
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>
> ---
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-26 6:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 2:21 [PATCH] null-blk: save memory footprint for struct nullb_cmd Yu Kuai
2022-04-26 2:31 ` Jens Axboe
2022-04-26 6:20 ` Chaitanya Kulkarni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.