From: Vatika Harlalka <vatikaharlalka@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, tglx@linutronix.de,
rafael.j.wysocki@intel.com, fweisbec@gmail.com,
schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org,
preetium@andrew.cmu.edu
Cc: preeti.murthy@gmail.com
Subject: [PATCH 1/2] nohz_full: Move tick related code to tick.c
Date: Thu, 13 Aug 2015 14:55:45 +0530 [thread overview]
Message-ID: <9fe1d890ce20e976a585fd8dddd8d2ee2220ca75.1439454836.git.vatikaharlalka@gmail.com> (raw)
In-Reply-To: <cover.1439454836.git.vatikaharlalka@gmail.com>
Offloading task_tick off nohz_full cpus introduces tick related code
in the scheduler code. It is therefore better to create a new file
tick.c and move the existing tick related code there.
Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
kernel/sched/Makefile | 2 +-
kernel/sched/core.c | 27 ---------------------------
kernel/sched/tick.c | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 28 deletions(-)
create mode 100644 kernel/sched/tick.c
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 46be870..3b31182 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -11,7 +11,7 @@ ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer
endif
-obj-y += core.o proc.o clock.o cputime.o
+obj-y += core.o proc.o clock.o cputime.o tick.o
obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o
obj-y += wait.o completion.o idle.o
obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 57bd333..64beceb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2481,33 +2481,6 @@ unsigned long long task_sched_runtime(struct task_struct *p)
return ns;
}
-/*
- * This function gets called by the timer code, with HZ frequency.
- * We call it with interrupts disabled.
- */
-void scheduler_tick(void)
-{
- int cpu = smp_processor_id();
- struct rq *rq = cpu_rq(cpu);
- struct task_struct *curr = rq->curr;
-
- sched_clock_tick();
-
- raw_spin_lock(&rq->lock);
- update_rq_clock(rq);
- curr->sched_class->task_tick(rq, curr, 0);
- update_cpu_load_active(rq);
- raw_spin_unlock(&rq->lock);
-
- perf_event_task_tick();
-
-#ifdef CONFIG_SMP
- rq->idle_balance = idle_cpu(cpu);
- trigger_load_balance(rq);
-#endif
- rq_last_tick_reset(rq);
-}
-
#ifdef CONFIG_NO_HZ_FULL
/**
* scheduler_tick_max_deferment
diff --git a/kernel/sched/tick.c b/kernel/sched/tick.c
new file mode 100644
index 0000000..3bc32c7
--- /dev/null
+++ b/kernel/sched/tick.c
@@ -0,0 +1,43 @@
+#include <linux/smp.h>
+#include <linux/cpumask.h>
+#include <linux/tick.h>
+#include <linux/sched.h>
+#include <linux/spinlock.h>
+#include <linux/percpu.h>
+#include <linux/perf_event.h>
+#include <linux/workqueue.h>
+#include <linux/jiffies.h>
+#include "sched.h"
+
+/*
+ * This function gets called by the timer code, with HZ frequency.
+ * We call it with interrupts disabled.
+ */
+
+void scheduler_tick(void)
+{
+ int cpu = smp_processor_id();
+ struct rq *rq = cpu_rq(cpu);
+ struct task_struct *curr;
+
+ raw_spin_lock(&rq->lock);
+ curr = rq->curr;
+ raw_spin_unlock(&rq->lock);
+
+ sched_clock_tick();
+
+ raw_spin_lock(&rq->lock);
+ update_rq_clock(rq);
+ curr->sched_class->task_tick(rq, curr, 0);
+ update_cpu_load_active(rq);
+ raw_spin_unlock(&rq->lock);
+
+ perf_event_task_tick();
+
+#ifdef CONFIG_SMP
+ rq->idle_balance = idle_cpu(cpu);
+ trigger_load_balance(rq);
+#endif
+ rq_last_tick_reset(rq);
+}
+
--
2.4.2
next prev parent reply other threads:[~2015-08-13 9:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 9:25 [PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus Vatika Harlalka
2015-08-13 9:25 ` Vatika Harlalka [this message]
2015-08-13 12:22 ` Peter Zijlstra
2015-08-13 12:44 ` Frederic Weisbecker
2015-08-13 15:05 ` Peter Zijlstra
2015-08-13 15:36 ` Frederic Weisbecker
2015-08-13 19:22 ` Vatika Harlalka
2015-08-20 12:50 ` preetium
2015-08-21 15:55 ` Frederic Weisbecker
[not found] ` <CACFGFQQ8mBzS-NhfNsp2nao2XpUksxu3t_Jse2zL2EQHLAK_Hg@mail.gmail.com>
2015-09-11 17:05 ` Vatika Harlalka
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=9fe1d890ce20e976a585fd8dddd8d2ee2220ca75.1439454836.git.vatikaharlalka@gmail.com \
--to=vatikaharlalka@gmail.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=preeti.murthy@gmail.com \
--cc=preetium@andrew.cmu.edu \
--cc=rafael.j.wysocki@intel.com \
--cc=schwidefsky@de.ibm.com \
--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;
as well as URLs for NNTP newsgroup(s).