linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] provide an API to userspace doing memory snapshot
@ 2013-03-27  8:52 wenchaolinux
  2013-03-28  2:15 ` wenchaolinux
  0 siblings, 1 reply; 2+ messages in thread
From: wenchaolinux @ 2013-03-27  8:52 UTC (permalink / raw)
  To: walken, riel, viro, mingo, linux-mm

Hi,
  I'd like to add/export an system call which allow userspace program
to take snapshot for a region of memory. Since it is not implemented yet
I will describe it as C APIs, it is quite simple now and if it is worthy
I'll improve the interface later:

Simple prototype:
C API in userspace:
/*
 *   This function will mark a section of memory as COW, and return
 * a new virtual address of it. User space program can dump out the
 * content as a snapshot while other thread continue modify the content
 * in the region.
 *   @addr: the virtual address to be snapshotted.
 *   @length: the length of it.
 *   This function returns a new virtual address which can be used as
 * snapshot. Return NULL on fail.
 */
void *memory_snapshot_create(void *addr, uint64_t length);

/*
 *   This function will free the memory snapshot.
 *   @addr: the virtual snapshot addr to be freed, it should be the
 * returned one in memory_snapshot_create().
 */
void memory_snapshot_delete(void *addr);

In kernel space:
  The pages in those virtual address will be marked as COW. Take a
page with physical addr P0 as example, it will have two virtual addr:
old A0 and new A1. When modified, kernel should create a new page P1
with same contents, and mapping A1 to P1. When NUMA is used, P1 can
be a slower page.
  It is quite like fork(), but only COW part of pages.

Background:
  To provide a good snapshot for KVM, disk and RAM both need to be
snapshotted. A good way to do it is tagging the contents as COW,
which erase unnecessary I/O. Block device have this support, but
RAM is missing, so I'd like to add it. It can be done by fork(),
but it brings many unnecessary troubles and can't benefit when
NUMA is used, the core I need is COW the pages. Although the
requirement comes from virtualization but it do not use virtualization
tech and serve more than virtualization, any APP have some
un-interceptable changing pages, can use it, so I wonder whether can
add it as common memory API.

  That's my plan, hope to get your opinion for it.

Best Regards
Wenchao Xia

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [RFC] provide an API to userspace doing memory snapshot
  2013-03-27  8:52 [RFC] provide an API to userspace doing memory snapshot wenchaolinux
@ 2013-03-28  2:15 ` wenchaolinux
  0 siblings, 0 replies; 2+ messages in thread
From: wenchaolinux @ 2013-03-28  2:15 UTC (permalink / raw)
  To: linux-mm

Hi,
  I'd like to add/export an system call which allow userspace program
to take snapshot for a region of memory. Since it is not implemented yet
I will describe it as C APIs, it is quite simple now and if it is worthy
I'll improve the interface later:

Simple prototype:
C API in userspace:
/*
 *   This function will mark a section of memory as COW, and return
 * a new virtual address of it. User space program can dump out the
 * content as a snapshot while other thread continue modify the content
 * in the region.
 *   @addr: the virtual address to be snapshotted.
 *   @length: the length of it.
 *   This function returns a new virtual address which can be used as
 * snapshot. Return NULL on fail.
 */
void *memory_snapshot_create(void *addr, uint64_t length);

/*
 *   This function will free the memory snapshot.
 *   @addr: the virtual snapshot addr to be freed, it should be the
 * returned one in memory_snapshot_create().
 */
void memory_snapshot_delete(void *addr);

In kernel space:
  The pages in those virtual address will be marked as COW. Take a
page with physical addr P0 as example, it will have two virtual addr:
old A0 and new A1. When modified, kernel should create a new page P1
with same contents, and mapping A1 to P1. When NUMA is used, P1 can
be a slower page.
  It is quite like fork(), but only COW part of pages.

Background:
  To provide a good snapshot for KVM, disk and RAM both need to be
snapshotted. A good way to do it is tagging the contents as COW,
which erase unnecessary I/O. Block device have this support, but
RAM is missing, so I'd like to add it. It can be done by fork(),
but it brings many unnecessary troubles and can't benefit when
NUMA is used, the core I need is COW the pages. Although the
requirement comes from virtualization but it do not use virtualization
tech and serve more than virtualization, any APP have some
un-interceptable changing pages, can use it, so I wonder whether can
add it as common memory API.

  That's my plan, hope to get your opinion for it.

Best Regards
Wenchao Xia



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-03-28  2:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27  8:52 [RFC] provide an API to userspace doing memory snapshot wenchaolinux
2013-03-28  2:15 ` wenchaolinux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).