[PATCH 1/2] nohz_full: Move tick related code to tick.c
From: Vatika Harlalka
Date: Thu Aug 13 2015 - 05:25:45 EST
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@xxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/