Linux CXL
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Dongsheng Yang <dongsheng.yang@linux.dev>
Cc: agk@redhat.com, snitzer@kernel.org, axboe@kernel.dk, hch@lst.de,
	 dan.j.williams@intel.com, Jonathan.Cameron@Huawei.com,
	 linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev,
	 dm-devel@lists.linux.dev
Subject: Re: [PATCH v2 00/11] dm-pcache – persistent-memory cache for block devices
Date: Mon, 7 Jul 2025 22:16:19 +0200 (CEST)	[thread overview]
Message-ID: <85b5cb31-b272-305f-8910-c31152485ecf@redhat.com> (raw)
In-Reply-To: <20250707065809.437589-1-dongsheng.yang@linux.dev>



On Mon, 7 Jul 2025, Dongsheng Yang wrote:

> Hi Mikulas,
> 	This is V2 for dm-pcache, please take a look.
> 
> Code:
>     https://github.com/DataTravelGuide/linux tags/pcache_v2
> 
> Changelogs
> 
> V2 from V1:
> 	- introduce req_alloc() and req_init() in backing_dev.c, then we
> 	  can do req_alloc() before holding spinlock and do req_init()
> 	  in subtree_walk().
> 	- introduce pre_alloc_key and pre_alloc_req in walk_ctx, that
> 	  means we can pre-allocate cache_key or backing_dev_request
> 	  before subtree walking.
> 	- use mempool_alloc() with NOIO for the allocation of cache_key
> 	  and backing_dev_req.
> 	- some coding style changes from comments of Jonathan.

Hi

mempool_alloc with GFP_NOIO never fails - so you don't have to check the 
returned value for NULL and propagate the error upwards.

"backing_req->kmem.bvecs = kmalloc_array(n_vecs, sizeof(struct bio_vec), 
GFP_NOIO)" - this call may fail and you should handle the error gracefully 
(i.e. don't end the bio with an error). Would it be possible to trim the 
request to BACKING_DEV_REQ_INLINE_BVECS vectors and retry it? 
Alternativelly, you can create a mempool for the largest possible n_vecs 
and allocate from this mempool if kmalloc_array fails.

I'm sending two patches for dm-pcache - the first patch adds the include 
file linux/bitfield.h - it is needed in my config. The second patch makes 
slab caches per-module rather than per-device, if you have them 
per-device, there are warnings about duplicate cache names.


BTW. What kind of persistent memory do you use? (afaik Intel killed the 
Optane products and I don't know of any replacement)

Some times ago I created a filesystem for persistent memory - see 
git://leontynka.twibright.com/nvfs.git - I'd be interested if you can test 
it on your persistent memory implementation.

Mikulas


  parent reply	other threads:[~2025-07-07 20:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07  6:57 [PATCH v2 00/11] dm-pcache – persistent-memory cache for block devices Dongsheng Yang
2025-07-07  6:57 ` [PATCH v2 01/11] dm-pcache: add pcache_internal.h Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 02/11] dm-pcache: add backing device management Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 03/11] dm-pcache: add cache device Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 04/11] dm-pcache: add segment layer Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 05/11] dm-pcache: add cache_segment Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 06/11] dm-pcache: add cache_writeback Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 07/11] dm-pcache: add cache_gc Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 08/11] dm-pcache: add cache_key Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 09/11] dm-pcache: add cache_req Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 10/11] dm-pcache: add cache core Dongsheng Yang
2025-07-07  6:58 ` [PATCH v2 11/11] dm-pcache: initial dm-pcache target Dongsheng Yang
2025-07-07 20:16 ` Mikulas Patocka [this message]
2025-07-07 20:17   ` [PATCH v2 00/11] dm-pcache – persistent-memory cache for block devices Mikulas Patocka
2025-07-07 20:17   ` Mikulas Patocka
2025-07-09  9:45   ` Dongsheng Yang
2025-07-10 10:59     ` Dongsheng Yang
2025-07-14 15:43     ` Mikulas Patocka

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=85b5cb31-b272-305f-8910-c31152485ecf@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=dongsheng.yang@linux.dev \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=snitzer@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox