diff for duplicates of <20121121182537.GB29893@gmail.com> diff --git a/a/1.txt b/N1/1.txt index 149a447..2ec9dca 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -72,3 +72,104 @@ Thanks, Ingo ---------------------> +>From 30f93abc6cb3fd387a134d6b94ff5ac396be1c88 Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra <a.p.zijlstra@chello.nl> +Date: Tue, 13 Nov 2012 12:58:32 +0100 +Subject: [PATCH] sched, numa, mm: Add the scanning page fault machinery + +Add the NUMA working set scanning/hinting page fault machinery, +with no policy yet. + +[ The earliest versions had the mpol_misplaced() function from + Lee Schermerhorn - this was heavily modified later on. ] + +Also-written-by: Lee Schermerhorn <lee.schermerhorn@hp.com> +Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> +Cc: Linus Torvalds <torvalds@linux-foundation.org> +Cc: Andrew Morton <akpm@linux-foundation.org> +Cc: Andrea Arcangeli <aarcange@redhat.com> +Cc: Rik van Riel <riel@redhat.com> +Cc: Mel Gorman <mgorman@suse.de> +Cc: Thomas Gleixner <tglx@linutronix.de> +Cc: Hugh Dickins <hughd@google.com> +[ split it out of the main policy patch - as suggested by Mel Gorman ] +Signed-off-by: Ingo Molnar <mingo@kernel.org> +--- + include/linux/init_task.h | 8 +++ + include/linux/mempolicy.h | 6 +- + include/linux/mm_types.h | 4 ++ + include/linux/sched.h | 41 ++++++++++++-- + init/Kconfig | 73 +++++++++++++++++++----- + kernel/sched/core.c | 15 +++++ + kernel/sysctl.c | 31 ++++++++++- + mm/huge_memory.c | 1 + + mm/mempolicy.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++ + 9 files changed, 294 insertions(+), 22 deletions(-) + +[...] + +diff --git a/mm/mempolicy.c b/mm/mempolicy.c +index d04a8a5..318043a 100644 +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2175,6 +2175,143 @@ static void sp_free(struct sp_node *n) + kmem_cache_free(sn_cache, n); + } + ++/* ++ * Multi-stage node selection is used in conjunction with a periodic ++ * migration fault to build a temporal task<->page relation. By ++ * using a two-stage filter we remove short/unlikely relations. ++ * ++ * Using P(p) ~ n_p / n_t as per frequentist probability, we can ++ * equate a task's usage of a particular page (n_p) per total usage ++ * of this page (n_t) (in a given time-span) to a probability. ++ * ++ * Our periodic faults will then sample this probability and getting ++ * the same result twice in a row, given these samples are fully ++ * independent, is then given by P(n)^2, provided our sample period ++ * is sufficiently short compared to the usage pattern. ++ * ++ * This quadric squishes small probabilities, making it less likely ++ * we act on an unlikely task<->page relation. ++ * ++ * Return the best node ID this page should be on, or -1 if it should ++ * stay where it is. ++ */ ++static int ++numa_migration_target(struct page *page, int page_nid, ++ struct task_struct *p, int this_cpu, ++ int cpu_last_access) ++{ ++ int nid_last_access; ++ int this_nid; ++ ++ if (task_numa_shared(p) < 0) ++ return -1; ++ ++ /* ++ * Possibly migrate towards the current node, depends on ++ * task_numa_placement() and access details. ++ */ ++ nid_last_access = cpu_to_node(cpu_last_access); ++ this_nid = cpu_to_node(this_cpu); ++ ++ if (nid_last_access != this_nid) { ++ /* ++ * 'Access miss': the page got last accessed from a remote node. ++ */ ++ return -1; ++ } ++ /* ++ * 'Access hit': the page got last accessed from our node. ++ * ++ * Migrate the page if needed. ++ */ ++ ++ /* The page is already on this node: */ ++ if (page_nid == this_nid) ++ return -1; ++ ++ return this_nid; ++} +[...] diff --git a/a/content_digest b/N1/content_digest index be882c9..2811b15 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -92,6 +92,107 @@ "\n" "\tIngo\n" "\n" - ---------------------> + "--------------------->\n" + ">From 30f93abc6cb3fd387a134d6b94ff5ac396be1c88 Mon Sep 17 00:00:00 2001\n" + "From: Peter Zijlstra <a.p.zijlstra@chello.nl>\n" + "Date: Tue, 13 Nov 2012 12:58:32 +0100\n" + "Subject: [PATCH] sched, numa, mm: Add the scanning page fault machinery\n" + "\n" + "Add the NUMA working set scanning/hinting page fault machinery,\n" + "with no policy yet.\n" + "\n" + "[ The earliest versions had the mpol_misplaced() function from\n" + " Lee Schermerhorn - this was heavily modified later on. ]\n" + "\n" + "Also-written-by: Lee Schermerhorn <lee.schermerhorn@hp.com>\n" + "Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>\n" + "Cc: Linus Torvalds <torvalds@linux-foundation.org>\n" + "Cc: Andrew Morton <akpm@linux-foundation.org>\n" + "Cc: Andrea Arcangeli <aarcange@redhat.com>\n" + "Cc: Rik van Riel <riel@redhat.com>\n" + "Cc: Mel Gorman <mgorman@suse.de>\n" + "Cc: Thomas Gleixner <tglx@linutronix.de>\n" + "Cc: Hugh Dickins <hughd@google.com>\n" + "[ split it out of the main policy patch - as suggested by Mel Gorman ]\n" + "Signed-off-by: Ingo Molnar <mingo@kernel.org>\n" + "---\n" + " include/linux/init_task.h | 8 +++\n" + " include/linux/mempolicy.h | 6 +-\n" + " include/linux/mm_types.h | 4 ++\n" + " include/linux/sched.h | 41 ++++++++++++--\n" + " init/Kconfig | 73 +++++++++++++++++++-----\n" + " kernel/sched/core.c | 15 +++++\n" + " kernel/sysctl.c | 31 ++++++++++-\n" + " mm/huge_memory.c | 1 +\n" + " mm/mempolicy.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++\n" + " 9 files changed, 294 insertions(+), 22 deletions(-)\n" + "\n" + "[...]\n" + "\n" + "diff --git a/mm/mempolicy.c b/mm/mempolicy.c\n" + "index d04a8a5..318043a 100644\n" + "--- a/mm/mempolicy.c\n" + "+++ b/mm/mempolicy.c\n" + "@@ -2175,6 +2175,143 @@ static void sp_free(struct sp_node *n)\n" + " \tkmem_cache_free(sn_cache, n);\n" + " }\n" + " \n" + "+/*\n" + "+ * Multi-stage node selection is used in conjunction with a periodic\n" + "+ * migration fault to build a temporal task<->page relation. By\n" + "+ * using a two-stage filter we remove short/unlikely relations.\n" + "+ *\n" + "+ * Using P(p) ~ n_p / n_t as per frequentist probability, we can\n" + "+ * equate a task's usage of a particular page (n_p) per total usage\n" + "+ * of this page (n_t) (in a given time-span) to a probability.\n" + "+ *\n" + "+ * Our periodic faults will then sample this probability and getting\n" + "+ * the same result twice in a row, given these samples are fully\n" + "+ * independent, is then given by P(n)^2, provided our sample period\n" + "+ * is sufficiently short compared to the usage pattern.\n" + "+ *\n" + "+ * This quadric squishes small probabilities, making it less likely\n" + "+ * we act on an unlikely task<->page relation.\n" + "+ *\n" + "+ * Return the best node ID this page should be on, or -1 if it should\n" + "+ * stay where it is.\n" + "+ */\n" + "+static int\n" + "+numa_migration_target(struct page *page, int page_nid,\n" + "+\t\t struct task_struct *p, int this_cpu,\n" + "+\t\t int cpu_last_access)\n" + "+{\n" + "+\tint nid_last_access;\n" + "+\tint this_nid;\n" + "+\n" + "+\tif (task_numa_shared(p) < 0)\n" + "+\t\treturn -1;\n" + "+\n" + "+\t/*\n" + "+\t * Possibly migrate towards the current node, depends on\n" + "+\t * task_numa_placement() and access details.\n" + "+\t */\n" + "+\tnid_last_access = cpu_to_node(cpu_last_access);\n" + "+\tthis_nid = cpu_to_node(this_cpu);\n" + "+\n" + "+\tif (nid_last_access != this_nid) {\n" + "+\t\t/*\n" + "+\t\t * 'Access miss': the page got last accessed from a remote node.\n" + "+\t\t */\n" + "+\t\treturn -1;\n" + "+\t}\n" + "+\t/*\n" + "+\t * 'Access hit': the page got last accessed from our node.\n" + "+\t *\n" + "+\t * Migrate the page if needed.\n" + "+\t */\n" + "+\n" + "+\t/* The page is already on this node: */\n" + "+\tif (page_nid == this_nid)\n" + "+\t\treturn -1;\n" + "+\n" + "+\treturn this_nid;\n" + "+}\n" + [...] -bd2bef8a4466128f133bb9bfcd45268ce1120650a9e4cec2910e939665eadc6b +3d5df55320f5b90b0c0f92a459dc91c6af7830399096bf57e5ffd84f2bb201c2
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.