From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ie0-f173.google.com (mail-ie0-f173.google.com [209.85.223.173]) by kanga.kvack.org (Postfix) with ESMTP id 4D7C26B0031 for ; Tue, 24 Sep 2013 03:01:24 -0400 (EDT) Received: by mail-ie0-f173.google.com with SMTP id ar20so8274619iec.4 for ; Tue, 24 Sep 2013 00:01:24 -0700 (PDT) Received: by mail-ve0-f169.google.com with SMTP id db12so3323955veb.28 for ; Tue, 24 Sep 2013 00:01:21 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 24 Sep 2013 15:01:20 +0800 Message-ID: Subject: sched: Set preferred NUMA node based on number of private faults From: "Figo.zhang" Content-Type: multipart/alternative; boundary=047d7b343eca3407ba04e71bb437 Sender: owner-linux-mm@kvack.org List-ID: To: Mel Gorman Cc: Linux-MM --047d7b343eca3407ba04e71bb437 Content-Type: text/plain; charset=ISO-8859-1 diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 4baf12e..8e2a364 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2292,9 +2292,11 @@ 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) { - int last_nid; + int last_nidpid; + int this_nidpid; polnid = numa_node_id(); + this_nidpid = nid_pid_to_nidpid(polnid, current->pid); /* * Multi-stage node selection is used in conjunction @@ -2317,8 +2319,8 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long * it less likely we act on an unlikely task<->page * relation. */ - last_nid = page_nid_xchg_last(page, polnid); - if (last_nid != polnid) + last_nidpid = page_nidpid_xchg_last(page, this_nidpid); + if (!nidpid_pid_unset(last_nidpid) && nidpid_to_nid(last_nidpid) != polnid) =>if the page is the first access, so nidpid_pid_unset(last_nidpid) return true, so we should not check and migrate the first access page if curnid != polnid. - last_nid = page_nid_xchg_last(page, polnid); - if (last_nid != polnid) + last_nidpid = page_nidpid_xchg_last(page, this_nidpid); + if (nidpid_pid_unset(last_nidpid)) + goto out; + else if (nidpid_to_nid(last_nidpid) != polnid) --047d7b343eca3407ba04e71bb437 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
diff --git= a/mm/mempolicy.c b/mm/mempolicy.c
index 4baf12e..8e2a364 100644
--- = a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2292,9 +2292,11 @@ int mpol_misplaced(struct pag= e *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) {
- int last_ni= d;
+ int last_nidpid;
+ int this_nid= pid;
polnid =3D numa_node_id();
+ this_nidpid =3D nid_pid_to_nidpid(polnid, current->pid);
/*
* Multi-stage node selection is used= in conjunction
@@ -2317,8 +2319,8 @@ int mpol_misplaced(struct page *page, struct vm_area_= struct *vma, unsigned long
* it less likel= y we act on an unlikely task<->page
* relation.
*/=
- last_nid =3D page_nid_xchg_last(page, polnid);
- if (last_nid !=3D polnid)
+ las= t_nidpid =3D page_nidpid_xchg_last(page, this_nidpid);
+ if (!nidpid_pid_unset(last_nidpid) && nidpid_to_nid(last_nidpid)= !=3D polnid)

=3D>if the page is the first access, so nidpid_pid_unset(last_nidpid) re= turn true, so we should not check and migrate the first access page if curn= id !=3D polnid.


- last_nid =3D page_nid= _xchg_last(page, polnid);
- if (last_nid !=3D polnid)
+ last_nidpid =3D page_nidpid_xchg_last(page, this_nidpid);
+ if (nidpid_pid_unset(last_nidpid))
+ goto out;
+ else if (nidpid_to_nid(last_nid= pid) !=3D polnid)

<= div class=3D"" style=3D"color:green;font-family:monospace;font-size:13px;li= ne-height:normal;white-space:pre">
--047d7b343eca3407ba04e71bb437-- -- 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: email@kvack.org