From: Christoph Hellwig <hch@lst.de>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme-pci: fix host memory buffer allocation size
Date: Thu, 28 Apr 2022 16:36:03 +0200 [thread overview]
Message-ID: <20220428143603.GA20460@lst.de> (raw)
In-Reply-To: <20220428101922.14216-1-linux@weissschuh.net>
On Thu, Apr 28, 2022 at 12:19:22PM +0200, Thomas Weißschuh wrote:
> We want to allocate the smallest possible amount of buffers with the
> largest possible size (1 buffer of size "hmpre").
>
> Previously we were allocating as many buffers as possible of the smallest
> possible size.
> This also lead to "hmpre" to not be satisifed as not enough buffer slots
> where available.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>
> Also discussed at https://lore.kernel.org/linux-nvme/f94565db-f217-4a56-83c3-c6429807185c@t-8ch.de/
>
> drivers/nvme/host/pci.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 3aacf1c0d5a5..0546523cc20b 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2090,7 +2090,7 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
>
> static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
> {
> - u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
> + u64 min_chunk = max_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
preferred is based on the HMPRE field in the spec, which documents the
preffered size. So the max here would not make ny sense at all.
next prev parent reply other threads:[~2022-04-28 14:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 10:19 [PATCH] nvme-pci: fix host memory buffer allocation size Thomas Weißschuh
2022-04-28 14:36 ` Christoph Hellwig [this message]
2022-04-28 14:44 ` Thomas Weißschuh
2022-04-28 15:06 ` Christoph Hellwig
2022-04-28 16:09 ` Thomas Weißschuh
2022-05-10 7:03 ` Christoph Hellwig
2022-05-10 10:20 ` Thomas Weißschuh
2022-05-25 15:07 ` Thomas Weißschuh
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=20220428143603.GA20460@lst.de \
--to=hch@lst.de \
--cc=axboe@fb.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux@weissschuh.net \
--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