From 14f06415d41036f52beeb24e0725d1d92ca1258d Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Mon, 12 Nov 2012 09:17:07 +0000 Subject: [PATCH] --- yaml --- r: 344810 b: refs/heads/master c: e42c8ff2999de1239a57d434bfbd8e9f2a56e814 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/mempolicy.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 001fa8fe9b78..a3e5e0f68d41 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bac0382c6ad764156025978845147e5a6eccca09 +refs/heads/master: e42c8ff2999de1239a57d434bfbd8e9f2a56e814 diff --git a/trunk/mm/mempolicy.c b/trunk/mm/mempolicy.c index 4c1c8d83ac6a..fd20e28fd2ad 100644 --- a/trunk/mm/mempolicy.c +++ b/trunk/mm/mempolicy.c @@ -2317,9 +2317,37 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long } /* Migrate the page towards the node whose CPU is referencing it */ - if (pol->flags & MPOL_F_MORON) + if (pol->flags & MPOL_F_MORON) { + int last_nid; + polnid = numa_node_id(); + /* + * 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 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. + */ + last_nid = page_xchg_last_nid(page, polnid); + if (last_nid != polnid) + goto out; + } + if (curnid != polnid) ret = polnid; out: