public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	a.p.zijlstra@chello.nl, tglx@linutronix.de
Subject: [tip:numa/core] sched/numa: Simplify task_numa_fault()
Date: Thu, 18 Oct 2012 10:01:47 -0700	[thread overview]
Message-ID: <tip-dvswxo34oaiibm06zyvrv0q5@git.kernel.org> (raw)

Commit-ID:  f3bd8842a897685269b3fa48ad6f9d5590be67ab
Gitweb:     http://git.kernel.org/tip/f3bd8842a897685269b3fa48ad6f9d5590be67ab
Author:     Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 10 Oct 2012 14:13:15 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 15 Oct 2012 12:30:16 +0200

sched/numa: Simplify task_numa_fault()

Also fix numa_scan_seq off by one.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-dvswxo34oaiibm06zyvrv0q5@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/sched.h |   11 +----------
 kernel/sched/core.c   |    2 +-
 kernel/sched/fair.c   |    9 ++++-----
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 99a70eb..c7f8656 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1608,16 +1608,7 @@ static inline int tsk_home_node(struct task_struct *p)
 }
 
 extern void task_numa_placement(void);
-extern void __task_numa_fault(int node);
-static inline void task_numa_fault(int node)
-{
-	struct task_struct *p = current;
-
-	if (likely(p->numa_faults))
-		p->numa_faults[node]++;
-	else
-		__task_numa_fault(node);
-}
+extern void task_numa_fault(int node);
 #else
 static inline int tsk_home_node(struct task_struct *p)
 {
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ff4a3bd..b370f2f 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1543,7 +1543,7 @@ static void __sched_fork(struct task_struct *p)
 	p->node = -1;
 	p->node_stamp = 0ULL;
 	p->numa_scan_seq = p->mm ? p->mm->numa_scan_seq : 0;
-	p->numa_migrate_seq = p->mm ? p->mm->numa_scan_seq : 0;
+	p->numa_migrate_seq = p->mm ? p->mm->numa_scan_seq - 1 : 0;
 	p->numa_faults = NULL;
 #endif /* CONFIG_SCHED_NUMA */
 }
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 592291b..1a32930 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -823,18 +823,17 @@ unsigned int sysctl_sched_numa_settle_count = 2;
 /*
  * Got a PROT_NONE fault for a page on @node.
  */
-void __task_numa_fault(int node)
+void task_numa_fault(int node)
 {
 	struct task_struct *p = current;
 
-	if (!p->numa_faults) {
+	if (unlikely(!p->numa_faults)) {
 		p->numa_faults = kzalloc(sizeof(unsigned long) * nr_node_ids,
 					 GFP_KERNEL);
+		if (!p->numa_faults)
+			return;
 	}
 
-	if (!p->numa_faults)
-		return;
-
 	p->numa_faults[node]++;
 }
 

                 reply	other threads:[~2012-10-18 17:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-dvswxo34oaiibm06zyvrv0q5@git.kernel.org \
    --to=a.p.zijlstra@chello.nl \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox