All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] Allow persistent data on DAX device being used as KMEM
@ 2022-08-02 17:57 Srinivas Aji
  2022-08-02 18:02 ` [RFC PATCH 1/4] mm/memory_hotplug: Add MHP_ALLOCATE flag which treats hotplugged memory as allocated Srinivas Aji
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Srinivas Aji @ 2022-08-02 17:57 UTC (permalink / raw)
  To: linux-nvdimm, Linux MM
  Cc: Dan Williams, David Hildenbrand, Vivek Goyal, David Woodhouse,
	Gowans, James, Yue Li, Beau Beauchamp

Linux supports adding a DAX driver managed memory region as system
memory using the KMEM driver (from version 5.1). We would like to use
a persistent addressable memory segment as system memory and
simultaneously for storing some persistent data.

Motivation: It is already possible to partition an NVDIMM device for
RAM and storage by creating separate regions on the device and using
one of them with KMEM and another as fsdax. This patch set is a start
to trying to get zero copy snapshots of processes which are using the
DAX device as RAM. That requires dynamically sharing pages between
process RAM and the storage within a single NVDIMM region.

To do this, we add a layer for handling the persistent data which does
the following:

1. When a DAX device is added as KMEM, mark all the memory as
   allocated and pass it up to a module which is aware of the storage
   layout.

2. This module scans the memory, identifies the unused parts, and
   frees those memory pages.

3. Further memory from this device is allocated using the kernel
   memory allocation API. The memory allocation API currently allows
   the allocation to be limited only based on NUMA node. So this
   feature works only when the DAX device used as KMEM is the only
   memory from its NUMA node.

4. Discarding of blocks previously used for persistent data results in
   those blocks being freed to system memory.

As an example, we implement a simple persistence module using the
above framework to provide a block device. A block device assumes all
blocks are always available, but in this case we have to get the
blocks through the memory allocation API, at an offset not under our
control. To provide block device semantics, we maintain an array which
maps the logical block number to the real physical page, if one
exists. Block device Trim/Discard support is used to mark blocks as
unused.

While we have the block device here as an example, a memory filesystem
might be a more useful implementation. I am not sure if any of the
existing in-memory filesystem structures are suited for
persistence. Any suggestions for this are appreciated.

Srinivas Aji (4):
  mm/memory_hotplug: Add MHP_ALLOCATE flag which treats hotplugged
    memory as allocated
  device-dax: Add framework for keeping persistent data in DAX KMEM
  device-dax: Add a NONE type for DAX KMEM persistence
  device-dax: Add a block device persistent type, BLK, for DAX KMEM

 drivers/dax/Kconfig            |  13 +
 drivers/dax/Makefile           |   1 +
 drivers/dax/kmem.c             | 312 +++++++++++++++++-
 drivers/dax/kmem_blk.c         | 573 +++++++++++++++++++++++++++++++++
 drivers/dax/kmem_persist.h     |  47 +++
 include/linux/memory_hotplug.h |   4 +
 mm/internal.h                  |   3 +-
 mm/memory_hotplug.c            |  15 +-
 mm/page_alloc.c                |  19 +-
 9 files changed, 975 insertions(+), 12 deletions(-)
 create mode 100644 drivers/dax/kmem_blk.c
 create mode 100644 drivers/dax/kmem_persist.h

-- 
2.30.2



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-08-08 23:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 17:57 [RFC PATCH 0/4] Allow persistent data on DAX device being used as KMEM Srinivas Aji
2022-08-02 18:02 ` [RFC PATCH 1/4] mm/memory_hotplug: Add MHP_ALLOCATE flag which treats hotplugged memory as allocated Srinivas Aji
2022-08-02 18:03 ` [RFC PATCH 0/4] Allow persistent data on DAX device being used as KMEM David Hildenbrand
2022-08-02 18:53   ` Srinivas Aji
2022-08-02 18:07 ` [RFC PATCH 2/4] device-dax: Add framework for keeping persistent data in DAX KMEM Srinivas Aji
2022-08-02 18:10 ` [RFC PATCH 3/4] device-dax: Add a NONE type for DAX KMEM persistence Srinivas Aji
2022-08-02 18:12 ` [RFC PATCH 4/4] device-dax: Add a block device persistent type, BLK, for DAX KMEM Srinivas Aji
2022-08-03 20:00   ` kernel test robot
2022-08-03 21:19   ` Fabio M. De Francesco
2022-08-04 10:45   ` kernel test robot
2022-08-05 12:46 ` [RFC PATCH 0/4] Allow persistent data on DAX device being used as KMEM David Hildenbrand
2022-08-08 21:21   ` Srinivas Aji
2022-08-08 23:05     ` Dan Williams

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.