From: Jens Axboe <axboe@kernel.dk>
To: "Matias Bjørling" <m@bjorling.me>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: axboe@fb.com
Subject: Re: [PATCH] null_blk: Register as a LightNVM device
Date: Wed, 11 Nov 2015 15:11:17 -0700 [thread overview]
Message-ID: <5643BD05.8000007@kernel.dk> (raw)
In-Reply-To: <5643B2C6.9010400@kernel.dk>
[-- Attachment #1: Type: text/plain, Size: 1294 bytes --]
On 11/11/2015 02:27 PM, Jens Axboe wrote:
> On 11/11/2015 03:06 AM, Matias Bjørling wrote:
>> Add support for registering as a LightNVM device. This allows us to
>> evaluate the performance of the LightNVM library.
>>
>> In /drivers/Makefile, LightNVM is moved above block device drivers
>> to make sure that the LightNVM media managers have been initialized
>> before drivers under /drivers/block are initialized.
>
> Generally looks ok. One question:
>
>> +static void *null_lnvm_create_dma_pool(struct request_queue *q, char
>> *name)
>> +{
>> + mempool_t *virtmem_pool;
>> +
>> + ppa_cache = kmem_cache_create(name, PAGE_SIZE, 0, 0, NULL);
>> + if (!ppa_cache) {
>> + pr_err("null_nvm: Unable to create kmem cache\n");
>> + return NULL;
>> + }
>> +
>> + virtmem_pool = mempool_create_slab_pool(64, ppa_cache);
>> + if (!virtmem_pool) {
>> + pr_err("null_nvm: Unable to create virtual memory pool\n");
>> + return NULL;
>> + }
>> +
>> + return virtmem_pool;
>> +}
>
> Why create a slab cache if it's pages? Why not just have the mempool
> alloc/free alloc single pages?
Ala attached. Also fixes a leak of not freeing the ppa_cache slab cache.
Did you try and load/reload the module? I'm thinking it would have crashed.
--
Jens Axboe
[-- Attachment #2: null-lightnvm --]
[-- Type: text/plain, Size: 1272 bytes --]
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 1efaef6e54e9..31d5debc020e 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -446,8 +446,6 @@ static void null_del_dev(struct nullb *nullb)
#ifdef CONFIG_NVM
-static struct kmem_cache *ppa_cache;
-
static void null_lnvm_end_io(struct request *rq, int error)
{
struct nvm_rq *rqd = rq->end_io_data;
@@ -523,13 +521,7 @@ static void *null_lnvm_create_dma_pool(struct request_queue *q, char *name)
{
mempool_t *virtmem_pool;
- ppa_cache = kmem_cache_create(name, PAGE_SIZE, 0, 0, NULL);
- if (!ppa_cache) {
- pr_err("null_nvm: Unable to create kmem cache\n");
- return NULL;
- }
-
- virtmem_pool = mempool_create_slab_pool(64, ppa_cache);
+ virtmem_pool = mempool_create_page_pool(64, 0);
if (!virtmem_pool) {
pr_err("null_nvm: Unable to create virtual memory pool\n");
return NULL;
@@ -540,10 +532,8 @@ static void *null_lnvm_create_dma_pool(struct request_queue *q, char *name)
static void null_lnvm_destroy_dma_pool(void *pool)
{
- mempool_t *virtmem_pool = pool;
+ mempool_destroy(pool);
- mempool_destroy(virtmem_pool);
-}
static void *null_lnvm_dev_dma_alloc(struct request_queue *q, void *pool,
gfp_t mem_flags, dma_addr_t *dma_handler)
next prev parent reply other threads:[~2015-11-11 22:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 10:06 [PATCH] null_blk: Register as a LightNVM device Matias Bjørling
2015-11-11 21:27 ` Jens Axboe
2015-11-11 22:11 ` Jens Axboe [this message]
2015-11-12 11:30 ` Matias Bjørling
2015-11-12 8:53 ` Christoph Hellwig
2015-11-12 15:49 ` Jens Axboe
2015-11-12 15:52 ` Christoph Hellwig
2015-11-12 15:54 ` Jens Axboe
2015-11-12 15:58 ` Christoph Hellwig
2015-11-12 16:00 ` Jens Axboe
2015-11-12 18:29 ` Matias Bjørling
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=5643BD05.8000007@kernel.dk \
--to=axboe@kernel.dk \
--cc=axboe@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m@bjorling.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