All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@weissschuh.net>
To: linux-nvme@lists.infradead.org
Subject: Re: Calculation of Host Memory Buffer sizes
Date: Thu, 28 Apr 2022 01:09:58 +0200	[thread overview]
Message-ID: <3612ae14-f9fb-46d1-92b9-662f3b15ff26@t-8ch.de> (raw)
In-Reply-To: <f94565db-f217-4a56-83c3-c6429807185c@t-8ch.de>

On 2022-04-28 00:40+0200, Thomas Weißschuh wrote:
> I am wondering about the calculation of the NVMe Host Memory Buffer sizes.
> It seems to me that the current algorithm to calculate this size does not lead
> to an optimal result.
> 
> [..]
> 
> It seems that the logic to calculate min_chunk in nvme_alloc_host_mem() starts
> with a too small value.

Of course shortly after sending the original mail I probably found the solution:

 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);

This would also much better fit the comment "start big and work our way down".

I'll send a proper patch tomorrow.

Thomas


      reply	other threads:[~2022-04-27 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 22:40 Calculation of Host Memory Buffer sizes Thomas Weißschuh
2022-04-27 23:09 ` Thomas Weißschuh [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=3612ae14-f9fb-46d1-92b9-662f3b15ff26@t-8ch.de \
    --to=thomas@weissschuh.net \
    --cc=linux-nvme@lists.infradead.org \
    /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 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.