Skip to content

optimize some data structure in nvme

Christophe JAILLET kernel-janitors linux-nvme lkml 1 version Applied

Status from this message: Thanks, applied to nvme-6.5.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/5nvmet: Reorder fields in 'struct nvmet_sq'drivers/nvme/target/nvmet.h+1 -10 replies
2/5nvmet: Reorder fields in 'struct nvme_ctrl'drivers/nvme/host/nvme.h+3 -32 replies
3/5nvmet: Reorder fields in 'struct nvmf_ctrl_options'drivers/nvme/host/fabrics.h+4 -40 replies
4/5nvmet: Reorder fields in 'struct nvme_dhchap_queue_context'drivers/nvme/host/auth.c+3 -30 replies
5/5nvmet: Reorder fields in 'struct nvmefc_fcp_req'include/linux/nvme-fc-driver.h+5 -50 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSagi GrimbergChristoph HellwigChaitanya Kulkarni
SeriesR-b R-b R-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 0/5] optimize some data structure in nvme

This serie is a proposal to slighly optimize the memory needed for some structures used in nvme.

This follows the discussion in [1].

Honnestly, I'm not convinced that this serie really brings semething. Because of the way memory alocation works, and its over-allocation to try to avoid memory fragmentation, some limited gains are most of the time useless.

It could still help:
- many holes in structure can, at some point, have its size reach a threshold (this is specially true if such structures are allocated with kcalloc() or kmalloc_array())
- it can save some space in some other structures if embedded in them
- it can save a few cycles if the structure is memcpy()'ed or zeroed, for example
- can reduce cache usage

With that in mind, patch 3 is a win, patch 4 is likely a win, the other ones are much more theorical.

The changes are really limited, so even if the gain is marginal, maybe it still makes sense to merge them.

Each patch gives the layout generated by pahole before and after the patch.

[1]: https://lore.kernel.org/all/[email protected]/

Christophe JAILLET (5):
nvmet: Reorder fields in 'struct nvmet_sq'
nvmet: Reorder fields in 'struct nvme_ctrl'
nvmet: Reorder fields in 'struct nvmf_ctrl_options'
nvmet: Reorder fields in 'struct nvme_dhchap_queue_context'
nvmet: Reorder fields in 'struct nvmefc_fcp_req'

 drivers/nvme/host/auth.c       |  6 +++---
 drivers/nvme/host/fabrics.h    |  8 ++++----
 drivers/nvme/host/nvme.h       |  6 +++---
 drivers/nvme/target/nvmet.h    |  4 ++--
 include/linux/nvme-fc-driver.h | 10 +++++-----
 5 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.34.1