From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754275AbbKLLaR (ORCPT ); Thu, 12 Nov 2015 06:30:17 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:35871 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753873AbbKLLaO (ORCPT ); Thu, 12 Nov 2015 06:30:14 -0500 Message-ID: <56447843.4000804@bjorling.me> Date: Thu, 12 Nov 2015 12:30:11 +0100 From: =?UTF-8?B?TWF0aWFzIEJqw7hybGluZw==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org CC: axboe@fb.com Subject: Re: [PATCH] null_blk: Register as a LightNVM device References: <1447236398-9421-1-git-send-email-m@bjorling.me> <5643B2C6.9010400@kernel.dk> <5643BD05.8000007@kernel.dk> In-Reply-To: <5643BD05.8000007@kernel.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/11/2015 11:11 PM, Jens Axboe wrote: > 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. > Good idea. I'll apply it. Thanks