All of lore.kernel.org
 help / color / mirror / Atom feed
From: axboe@fb.com (Jens Axboe)
Subject: [PATCH] NVMe: avoid kmalloc/kfree for smaller IO
Date: Thu, 22 Jan 2015 11:59:01 -0700	[thread overview]
Message-ID: <54C14875.2040806@fb.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1501221702170.15481@localhost.lm.intel.com>

On 01/22/2015 10:26 AM, Keith Busch wrote:
> On Wed, 21 Jan 2015, Jens Axboe wrote:
>> Currently we allocate an nvme_iod for each IO, which holds the
>> sg list, prps, and other IO related info. Set a threshold of
>> 2 pages and/or 8KB of data, below which we can just embed this
>> in the per-command pdu in blk-mq. For any IO at or below
>> NVME_INT_PAGES and NVME_INT_BYTES, we save a kmalloc and kfree.
>>
>> For higher IOPS, this saves up to 1% of CPU time.
>>
>> Signed-off-by: Jens Axboe <axboe at fb.com>
>>
>> ----
> 
>> +/*
>> + * Max size of iod being embedded in the request payload
>> + */
>> +#define NVME_INT_PAGES        2
>> +#define NVME_INT_BYTES        (NVME_INT_PAGES * PAGE_CACHE_SIZE)
> 
> I think the above needs to use what the device thinks a page size,
> right? If
> there's a mismatched host-device page size, nvme_setup_prps could end up
> accessing a non-existent prp list.
> 
>   #define NVME_INT_BYTES(dev) (NVME_INT_PAGES * dev->page_size)

Good point, I missed that aspect of it. I'll make that change and repost.

-- 
Jens Axboe

      parent reply	other threads:[~2015-01-22 18:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22  4:38 [PATCH] NVMe: avoid kmalloc/kfree for smaller IO Jens Axboe
2015-01-22 17:26 ` Keith Busch
     [not found]   ` <CANvN+end4BQMAeBZKggbA8k+gjQzKj2xYx+=hovbTvmK_GH4Ug@mail.gmail.com>
2015-01-22 18:33     ` Keith Busch
     [not found]       ` <CANvN+emqnrm1YE2Ft68=Q+aMBgDUVEUhHUTfPwPM=yBX-EhtHg@mail.gmail.com>
2015-01-22 18:47         ` Keith Busch
     [not found]           ` <CANvN+enF8Btab2NbuALyzRfpmkfR0ibRVbfCt-ZxWdW9vt9AmA@mail.gmail.com>
2015-01-22 19:26             ` Keith Busch
2015-01-22 18:59   ` 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=54C14875.2040806@fb.com \
    --to=axboe@fb.com \
    /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.