Skip to contentSkip to conversation

Dirty page tracking & on-the-fly memory mirroring

PATCH In review Jim Paradis 3 participants 3 messages Aug 1, 2009 – Aug 6, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Dirty page tracking & on-the-fly memory mirroring

This patch is a reference implementation of a memory-mirroring module ("pagesync"). It is the same code that Stratus uses minus some hardware-specific bits. This module scans through physical memory, clearing the hardware dirty bit of any dirty page and setting the software dirty bit. If a dirty page has the *hardware* dirty bit set on a subsequent scan, we know that the page has been re-dirtied and it is a candidate for being copied again.

This code is invoked through this API:

   struct pagesync_page_range {
       unsigned int start;
       unsigned int num;
   }

typedef int (*copy_proc)(unsigned long start_pfn,
unsigned long count,
int blackout, void *context);

typedef int (*sync_proc)(int max_range,
struct pagesync_page_range *copy_range, void *context);

int pagesync_synchronize_memory(copy_proc copy, sync_proc sync,
unsigned int threshold,
unsigned int passes,
void *context)

The "copy" and "sync" functions are system-specific and supplied by the caller. The "copy" function copies a range of memory from the current node to the destination node, while the "sync" function does final cleanups and cuts over to the new node.

Kconfig               |   12
mm/Makefile           |    4
mm/init_32.c          |    2
mm/pagesync.h         |   66 ++
mm/pagesync_harvest.c | 1124 ++++++++++++++++++++++++++++++++++++++++++++++++++
mm/pagesync_harvest.h |   69 +++
mm/pagesync_syncd.c   |  259 +++++++++++
mm/pagesync_syncd.h   |  185 ++++++++
8 files changed, 1721 insertions(+)
Signed-off-by [email protected]
arch/x86/Kconfig 2009-07-28 16:54:36.000000000 -0400 renamed from arch/x86/Kconfig.harvest 2009-07-21 13:52:56.000000000 -0400 +12 -0
diff -up linux-2.6-git-track/arch/x86/Kconfig.harvest linux-2.6-git-track/arch/x86/Kconfig
@@ -1138,6 +1138,18 @@ config TRACK_DIRTY_PAGES
      memory to another system or node.  Most users will
      say n here.
 
+config PAGESYNC_HARVEST
+    tristate "Enable reference implementation of pagesync harvest code"
+    default n
+    depends on TRACK_DIRTY_PAGES && EXPERIMENTAL
+    ---help---
+      Turning this on builds a reference implementation of
+      a page-harvesting driver.  This driver makes use of
+      dirty page tracking to allow on-the-fly mirroring of
+      system memory.  This could be useful, for example, for
+      failing over to a spare module in a cluster configuration.
+      Most users will say n here.
+

# Common NUMA Features
config NUMA
bool "Numa Memory Allocation and Scheduler Support"

arch/x86/mm/init_32.c 2009-07-21 18:30:57.000000000 -0400 renamed from arch/x86/mm/init_32.c.harvest 2009-07-21 13:46:54.000000000 -0400 +0 -0
diff -up linux-2.6-git-track/arch/x86/mm/init_32.c.harvest linux-2.6-git-track/arch/x86/mm/init_32.c
@@ -1075,3 +1075,5 @@ int __init reserve_bootmem_generic(unsig
{
    return reserve_bootmem(phys, len, flags);
}

+
+EXPORT_SYMBOL_GPL(swapper_pg_dir);

arch/x86/mm/Makefile 2009-07-21 18:37:41.000000000 -0400 renamed from arch/x86/mm/Makefile.harvest 2009-07-21 13:52:56.000000000 -0400 +0 -0
diff -up linux-2.6-git-track/arch/x86/mm/Makefile.harvest linux-2.6-git-track/arch/x86/mm/Makefile
@@ -21,4 +21,8 @@ obj-$(CONFIG_K8_NUMA)        += k8topology_64.

obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o
obj-$(CONFIG_TRACK_DIRTY_PAGES) += track.o

+obj-$(CONFIG_PAGESYNC_HARVEST) += pagesync.o +
+pagesync-objs := pagesync_harvest.o pagesync_syncd.o +
obj-$(CONFIG_MEMTEST) += memtest.o

arch/x86/mm/pagesync_harvest.c 2009-07-28 12:30:58.000000000 -0400 renamed from arch/x86/mm/pagesync_harvest.c.harvest 2009-07-21 18:30:57.000000000 -0400 +1123 -0

1,123 lines not on this page · raw message

arch/x86/mm/pagesync_harvest.h 2009-07-23 22:46:56.000000000 -0400 renamed from arch/x86/mm/pagesync_harvest.h.harvest 2009-07-21 18:30:57.000000000 -0400 +69 -0

69 lines not on this page · raw message

arch/x86/mm/pagesync.h 2009-07-22 13:11:21.000000000 -0400 renamed from arch/x86/mm/pagesync.h.harvest 2009-07-21 18:30:57.000000000 -0400 +66 -0

66 lines not on this page · raw message

arch/x86/mm/pagesync_syncd.c 2009-07-24 14:48:15.000000000 -0400 renamed from arch/x86/mm/pagesync_syncd.c.harvest 2009-07-21 18:30:57.000000000 -0400 +259 -0

259 lines not on this page · raw message

arch/x86/mm/pagesync_syncd.h 2009-07-23 22:41:59.000000000 -0400 renamed from arch/x86/mm/pagesync_syncd.h.harvest 2009-07-21 18:30:57.000000000 -0400 +185 -0

185 lines not on this page · raw message

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

#1 lore raw
Quoted 8 lines · Jim Paradis

This patch is a reference implementation of a memory-mirroring module ("pagesync"). It is the same code that Stratus uses minus some hardware-specific bits. This module scans through physical memory, clearing the hardware dirty bit of any dirty page and setting the software dirty bit. If a dirty page has the *hardware* dirty bit set on a subsequent scan, we know that the page has been re-dirtied and it is a candidate for being copied again.

As mentioned in the prevois mail example code is uttely useless. Please post the real code for the stratus hardware, and also make in built-in instead of opening big holes for external propritary modules.

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

#2 lore raw
In reply to Jim Paradis

arch/x86/mm/pagesync_harvest.c 2009-07-28 12:30:58.000000000 -0400 line 46

Quoted 8 lines · Jim Paradis
arch/x86/mm/pagesync_harvest.c 2009-07-28 12:30:58.000000000 -0400 renamed from arch/x86/mm/pagesync_harvest.c.harvest 2009-07-21 18:30:57.000000000 -0400 +8 -0
+#ifdef CONFIG_TRACK_DIRTY_PAGES
+
+#if PAGETABLE_LEVELS <= 3
+static inline unsigned pud_index(unsigned long address)
+{
+    return 0;
+}
+#endif

Needing special code for different page table levels is a really bad sign that it uses the wrong abstractions for page tables. It should be using the standard page walk idioms or perhaps even walk_page_range() now

-Andi

Signature · 7 lines
[email protected] -- Speaking for myself only.

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