From: Jens Axboe <axboe@kernel.dk>
To: Chaitanya Kulkarni <chaitanyak@nvidia.com>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Cc: "hch@lst.de" <hch@lst.de>, "sagi@grimberg.me" <sagi@grimberg.me>
Subject: Re: [PATCH] nvmet: dynamically allocate nvmet_ns->nguid
Date: Thu, 4 May 2023 11:55:41 -0600 [thread overview]
Message-ID: <79be970b-16d7-bfb4-ddc1-6705a06e4e34@kernel.dk> (raw)
In-Reply-To: <4174843d-18f8-572d-8fff-ab6d9bf42946@nvidia.com>
On 5/3/23 4:39?PM, Chaitanya Kulkarni wrote:
> On 5/3/23 08:45, Jens Axboe wrote:
>> On 5/1/23 11:30?PM, Chaitanya Kulkarni wrote:
>>> The nvmet_ns struct is critical to I/O operations in each backend bdev
>>> and file, but its static nguid array is not accessed in the fast path.
>>> This means that pulling all the memory for the array on each access
>>> is inefficient.
>>>
>>> This patch dynamically allocates the nvmet_ns->nguid array, reducing the
>>> size of the nvmet_ns struct. This optimization should reduce unnecessary
>>> memory access in the fast path that is required for the array vs pointer.
>>> For allocation of nguid with kzalloc() use same policy GFP_KERNEL that is
>>> used to allocate nvmet_ns struct iself.
>> Replacing 16 bytes of embedded memory with 8 bytes and then alloc+free
>> seems like a poor tradeoff.
>>
>> Why not just arrange it a bit more sanely, and also push the config
>> stuff out-of-line as that would not be used in the fast path. The below
>> 30 second job takes it from 456 -> 440 bytes for me, and has a better
>> layout imho.
>>
> Intentionally I didn't touch reordering since I've asked Christoph J
> look into it so my patch only optimizing the nguid allocation.
> Just looked into his series your patch is missing from that.
>
> Moving configfs out of the way and combining bool together is
> much better layout ...
But I think you missed my point, which is that replacing 16 bytes with 8
bytes, and then adding an alloc+free on top for the latter, doesn't make
a lot of sense. And some saner reordering gets you a bigger win, without
needing to resort to any of that.
--
Jens Axboe
prev parent reply other threads:[~2023-05-04 17:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-02 5:30 [PATCH] nvmet: dynamically allocate nvmet_ns->nguid Chaitanya Kulkarni
2023-05-03 15:45 ` Jens Axboe
2023-05-03 22:39 ` Chaitanya Kulkarni
2023-05-04 17:55 ` Jens Axboe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=79be970b-16d7-bfb4-ddc1-6705a06e4e34@kernel.dk \
--to=axboe@kernel.dk \
--cc=chaitanyak@nvidia.com \
--cc=hch@lst.de \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox