Re: [PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus

2015-09-11 Thread Vatika Harlalka
> 1. If LB_BIAS is false for nohz_full CPUs. This will help us figure out if
> rq->cpu_load
> is read for them.

lb_bias feature is not disabled for full dynticks. rq->cpu_load[] is
never used for them.
nohz_full cpus verify the condition on_null_domain(rq)

> 2. When a cpu reports scheduling stats for all cpus such as
> sum_exec_runtime,
> does it consider cpu_isolated_map (most likely it will) ? If it does, we
> need to be
> able to remotely update those statistics before reporting them. i.e. call
> update_curr(rq) on behalf of the nohz_full cpus.

Yeah, cpu stats are reported and updated for all cpus.

The next step would be to offload these on other cpus now for nohz_full cpus
running a single task now?

Thanks
Vatika

>
>
>
> --
> This is Preeti, signing off.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus

2015-09-11 Thread Vatika Harlalka
> 1. If LB_BIAS is false for nohz_full CPUs. This will help us figure out if
> rq->cpu_load
> is read for them.

lb_bias feature is not disabled for full dynticks. rq->cpu_load[] is
never used for them.
nohz_full cpus verify the condition on_null_domain(rq)

> 2. When a cpu reports scheduling stats for all cpus such as
> sum_exec_runtime,
> does it consider cpu_isolated_map (most likely it will) ? If it does, we
> need to be
> able to remotely update those statistics before reporting them. i.e. call
> update_curr(rq) on behalf of the nohz_full cpus.

Yeah, cpu stats are reported and updated for all cpus.

The next step would be to offload these on other cpus now for nohz_full cpus
running a single task now?

Thanks
Vatika

>
>
>
> --
> This is Preeti, signing off.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:sched/urgent] nohz: Affine unpinned timers to housekeepers

2015-09-02 Thread tip-bot for Vatika Harlalka
Commit-ID:  9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Gitweb: http://git.kernel.org/tip/9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Author: Vatika Harlalka 
AuthorDate: Tue, 1 Sep 2015 16:50:59 +0200
Committer:  Ingo Molnar 
CommitDate: Wed, 2 Sep 2015 10:33:22 +0200

nohz: Affine unpinned timers to housekeepers

The problem addressed in this patch is about affining unpinned
timers. Adaptive or Full Dynticks CPUs are currently disturbed
by unnecessary jitter due to firing of such timers on them.

This patch will affine timers to online CPUs which are not full
dynticks in NOHZ_FULL configured systems. It should not
introduce overhead in nohz full off case due to static keys.

Signed-off-by: Vatika Harlalka 
Signed-off-by: Frederic Weisbecker 
Reviewed-by: Preeti U Murthy 
Acked-by: Thomas Gleixner 
Cc: Chris Metcalf 
Cc: Christoph Lameter 
Cc: Linus Torvalds 
Cc: Paul E. McKenney 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1441119060-2230-2-git-send-email-fweis...@gmail.com
Signed-off-by: Ingo Molnar 
---
 include/linux/tick.h | 9 +
 kernel/sched/core.c  | 7 +--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index 48d901f..e312219 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -147,11 +147,20 @@ static inline void tick_nohz_full_add_cpus_to(struct 
cpumask *mask)
cpumask_or(mask, mask, tick_nohz_full_mask);
 }
 
+static inline int housekeeping_any_cpu(void)
+{
+   return cpumask_any_and(housekeeping_mask, cpu_online_mask);
+}
+
 extern void tick_nohz_full_kick(void);
 extern void tick_nohz_full_kick_cpu(int cpu);
 extern void tick_nohz_full_kick_all(void);
 extern void __tick_nohz_task_switch(void);
 #else
+static inline int housekeeping_any_cpu(void)
+{
+   return smp_processor_id();
+}
 static inline bool tick_nohz_full_enabled(void) { return false; }
 static inline bool tick_nohz_full_cpu(int cpu) { return false; }
 static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { }
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8b864ec..0902e4d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)
int i, cpu = smp_processor_id();
struct sched_domain *sd;
 
-   if (!idle_cpu(cpu))
+   if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
return cpu;
 
rcu_read_lock();
for_each_domain(cpu, sd) {
for_each_cpu(i, sched_domain_span(sd)) {
-   if (!idle_cpu(i)) {
+   if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
cpu = i;
goto unlock;
}
}
}
+
+   if (!is_housekeeping_cpu(cpu))
+   cpu = housekeeping_any_cpu();
 unlock:
rcu_read_unlock();
return cpu;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:sched/urgent] nohz: Affine unpinned timers to housekeepers

2015-09-02 Thread tip-bot for Vatika Harlalka
Commit-ID:  9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Gitweb: http://git.kernel.org/tip/9642d18eee2cd169b60c6ac0f20bda745b5a3d1e
Author: Vatika Harlalka <vatikaharla...@gmail.com>
AuthorDate: Tue, 1 Sep 2015 16:50:59 +0200
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Wed, 2 Sep 2015 10:33:22 +0200

nohz: Affine unpinned timers to housekeepers

The problem addressed in this patch is about affining unpinned
timers. Adaptive or Full Dynticks CPUs are currently disturbed
by unnecessary jitter due to firing of such timers on them.

This patch will affine timers to online CPUs which are not full
dynticks in NOHZ_FULL configured systems. It should not
introduce overhead in nohz full off case due to static keys.

Signed-off-by: Vatika Harlalka <vatikaharla...@gmail.com>
Signed-off-by: Frederic Weisbecker <fweis...@gmail.com>
Reviewed-by: Preeti U Murthy <pre...@linux.vnet.ibm.com>
Acked-by: Thomas Gleixner <t...@linutronix.de>
Cc: Chris Metcalf <cmetc...@ezchip.com>
Cc: Christoph Lameter <c...@linux.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Paul E. McKenney <paul...@linux.vnet.ibm.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Link: 
http://lkml.kernel.org/r/1441119060-2230-2-git-send-email-fweis...@gmail.com
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 include/linux/tick.h | 9 +
 kernel/sched/core.c  | 7 +--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index 48d901f..e312219 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -147,11 +147,20 @@ static inline void tick_nohz_full_add_cpus_to(struct 
cpumask *mask)
cpumask_or(mask, mask, tick_nohz_full_mask);
 }
 
+static inline int housekeeping_any_cpu(void)
+{
+   return cpumask_any_and(housekeeping_mask, cpu_online_mask);
+}
+
 extern void tick_nohz_full_kick(void);
 extern void tick_nohz_full_kick_cpu(int cpu);
 extern void tick_nohz_full_kick_all(void);
 extern void __tick_nohz_task_switch(void);
 #else
+static inline int housekeeping_any_cpu(void)
+{
+   return smp_processor_id();
+}
 static inline bool tick_nohz_full_enabled(void) { return false; }
 static inline bool tick_nohz_full_cpu(int cpu) { return false; }
 static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { }
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 8b864ec..0902e4d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -623,18 +623,21 @@ int get_nohz_timer_target(void)
int i, cpu = smp_processor_id();
struct sched_domain *sd;
 
-   if (!idle_cpu(cpu))
+   if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
return cpu;
 
rcu_read_lock();
for_each_domain(cpu, sd) {
for_each_cpu(i, sched_domain_span(sd)) {
-   if (!idle_cpu(i)) {
+   if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
cpu = i;
goto unlock;
}
}
}
+
+   if (!is_housekeeping_cpu(cpu))
+   cpu = housekeeping_any_cpu();
 unlock:
rcu_read_unlock();
return cpu;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus

2015-08-13 Thread Vatika Harlalka
Hi Peter :)

I'm very sorry about this. I should've gone through what was written
on the topic before
attempting to write this patch. I'll go through the link and work on
what is discussed
to make a new relevant patch.

Thanks
Vatika
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] nohz_full: Offload task_tick to remote housekeeping cpu

2015-08-13 Thread Vatika Harlalka
From: Vatika Harlalka 
To: mi...@redhat.com,pet...@infradead.org, t...@linutronix.de, 
rafael.j.wyso...@intel.com, 
fweis...@gmail.com,schwidef...@de.ibm.com,linux-kernel@vger.kernel.org, 
mi...@redhat.com,pet...@infradead.org, preet...@andrew.cmu.edu
Cc: preeti.mur...@gmail.com
Bcc: 
Subject: [PATCH 2/2] nohz_full: Offload task_tick to remote housekeeping cpu
Message-ID: 
<6c49894de23f55e72990eefbf48a1fc237168f13.1439454836.git.vatikaharla...@gmail.com>
Reply-To: 
In-Reply-To: 

Offload task_tick to remote housekeeping cpus for nohz_full cpus on which
ticks are stopped.

Signed-off-by: Vatika Harlalka 
---
 include/linux/tick.h |  2 ++
 kernel/sched/tick.c  | 42 ++
 kernel/time/tick-sched.c |  5 +
 3 files changed, 49 insertions(+)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index f8492da5..42faf5f 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -92,6 +92,7 @@ static inline void tick_broadcast_exit(void)
 
 #ifdef CONFIG_NO_HZ_COMMON
 extern int tick_nohz_tick_stopped(void);
+extern int tick_nohz_remote_tick_stopped(int cpu);
 extern void tick_nohz_idle_enter(void);
 extern void tick_nohz_idle_exit(void);
 extern void tick_nohz_irq_exit(void);
@@ -100,6 +101,7 @@ extern u64 get_cpu_idle_time_us(int cpu, u64 
*last_update_time);
 extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
 #else /* !CONFIG_NO_HZ_COMMON */
 static inline int tick_nohz_tick_stopped(void) { return 0; }
+static inline int tick_nohz_remote_tick_stopped(int cpu) { return 0; }
 static inline void tick_nohz_idle_enter(void) { }
 static inline void tick_nohz_idle_exit(void) { }
 
diff --git a/kernel/sched/tick.c b/kernel/sched/tick.c
index 3bc32c7..f2b1f9f 100644
--- a/kernel/sched/tick.c
+++ b/kernel/sched/tick.c
@@ -41,3 +41,45 @@ void scheduler_tick(void)
rq_last_tick_reset(rq);
 }
 
+#ifdef CONFIG_NO_HZ_FULL
+
+static struct delayed_work work;
+
+/*
+ * Offload task_tick() to remote housekeeping cpus for
+ * nohz_full cpus. This is in the direction of stopping
+ * ticks on nohz_full cpus altogether.
+ */
+
+static void remote_task_tick(struct work_struct *dwork)
+{
+   int cpu;
+
+   get_online_cpus();
+   for_each_cpu_and(cpu, tick_nohz_full_mask, cpu_online_mask) {
+   struct rq *rq = cpu_rq(cpu);
+   unsigned long flags;
+   struct task_struct *curr;
+
+   raw_spin_lock_irqsave(>lock, flags);
+   curr = rq->curr;
+
+   if (tick_nohz_remote_tick_stopped(cpu) && !is_idle_task(curr))
+   curr->sched_class->task_tick(rq, curr, 0);
+
+   raw_spin_unlock_irqrestore(>lock, flags);
+   }
+   put_online_cpus();
+   schedule_delayed_work(, HZ);
+}
+static int __init queue_remote_task_tick(void)
+{
+   if (tick_nohz_full_running) {
+   INIT_DELAYED_WORK(, remote_task_tick);
+   schedule_delayed_work(, HZ);
+   }
+   return 0;
+}
+core_initcall(queue_remote_task_tick);
+#endif
+
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 9142591..5de79b3 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -421,6 +421,11 @@ int tick_nohz_tick_stopped(void)
return __this_cpu_read(tick_cpu_sched.tick_stopped);
 }
 
+int tick_nohz_remote_tick_stopped(int cpu)
+{
+   return per_cpu(tick_cpu_sched, cpu).tick_stopped;
+}
+
 /**
  * tick_nohz_update_jiffies - update jiffies when idle was interrupted
  *
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] nohz_full: Move tick related code to tick.c

2015-08-13 Thread Vatika Harlalka
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 
---
 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(>lock);
-   update_rq_clock(rq);
-   curr->sched_class->task_tick(rq, curr, 0);
-   update_cpu_load_active(rq);
-   raw_spin_unlock(>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 000..3bc32c7
--- /dev/null
+++ b/kernel/sched/tick.c
@@ -0,0 +1,43 @@
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#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(>lock);
+   curr = rq->curr;
+   raw_spin_unlock(>lock);
+
+   sched_clock_tick();
+
+   raw_spin_lock(>lock);
+   update_rq_clock(rq);
+   curr->sched_class->task_tick(rq, curr, 0);
+   update_cpu_load_active(rq);
+   raw_spin_unlock(>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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus

2015-08-13 Thread Vatika Harlalka
This patchset is for offloading task_tick() to a remote housekeeping
cpu. The larger aim is to stop ticks on nohz_full cpus. For this, extra
work must be done by housekeeping cpus. So, task_tick is called from a
delayed workqueue for nohz_full cpus and the work is requeued every second
for those nohz_full cpus whose ticks are stopped while they are busy. In
the rest of the cases it will lead to redundant accounting. To facilitate
this, a new function tick_nohz_remote_tick_stopped is added to indicate
whether ticks are stopped on a remote cpu.
Tick related code in core.c is moved to tick.c

Vatika Harlalka (2):
  nohz_full: Move tick related code to tick.c
  nohz_full: Offload task_tick to remote housekeeping cpu

 include/linux/tick.h |  2 ++
 kernel/sched/Makefile|  2 +-
 kernel/sched/core.c  | 27 ---
 kernel/sched/tick.c  | 85 
 kernel/time/tick-sched.c |  5 +++
 5 files changed, 93 insertions(+), 28 deletions(-)
 create mode 100644 kernel/sched/tick.c

-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus

2015-08-13 Thread Vatika Harlalka
This patchset is for offloading task_tick() to a remote housekeeping
cpu. The larger aim is to stop ticks on nohz_full cpus. For this, extra
work must be done by housekeeping cpus. So, task_tick is called from a
delayed workqueue for nohz_full cpus and the work is requeued every second
for those nohz_full cpus whose ticks are stopped while they are busy. In
the rest of the cases it will lead to redundant accounting. To facilitate
this, a new function tick_nohz_remote_tick_stopped is added to indicate
whether ticks are stopped on a remote cpu.
Tick related code in core.c is moved to tick.c

Vatika Harlalka (2):
  nohz_full: Move tick related code to tick.c
  nohz_full: Offload task_tick to remote housekeeping cpu

 include/linux/tick.h |  2 ++
 kernel/sched/Makefile|  2 +-
 kernel/sched/core.c  | 27 ---
 kernel/sched/tick.c  | 85 
 kernel/time/tick-sched.c |  5 +++
 5 files changed, 93 insertions(+), 28 deletions(-)
 create mode 100644 kernel/sched/tick.c

-- 
2.4.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] nohz_full: Offload task_tick to remote housekeeping cpu

2015-08-13 Thread Vatika Harlalka
From: Vatika Harlalka vatikaharla...@gmail.com
To: mi...@redhat.com,pet...@infradead.org, t...@linutronix.de, 
rafael.j.wyso...@intel.com, 
fweis...@gmail.com,schwidef...@de.ibm.com,linux-kernel@vger.kernel.org, 
mi...@redhat.com,pet...@infradead.org, preet...@andrew.cmu.edu
Cc: preeti.mur...@gmail.com
Bcc: 
Subject: [PATCH 2/2] nohz_full: Offload task_tick to remote housekeeping cpu
Message-ID: 
6c49894de23f55e72990eefbf48a1fc237168f13.1439454836.git.vatikaharla...@gmail.com
Reply-To: 
In-Reply-To: cover.1439454836.git.vatikaharla...@gmail.com

Offload task_tick to remote housekeeping cpus for nohz_full cpus on which
ticks are stopped.

Signed-off-by: Vatika Harlalka vatikaharla...@gmail.com
---
 include/linux/tick.h |  2 ++
 kernel/sched/tick.c  | 42 ++
 kernel/time/tick-sched.c |  5 +
 3 files changed, 49 insertions(+)

diff --git a/include/linux/tick.h b/include/linux/tick.h
index f8492da5..42faf5f 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -92,6 +92,7 @@ static inline void tick_broadcast_exit(void)
 
 #ifdef CONFIG_NO_HZ_COMMON
 extern int tick_nohz_tick_stopped(void);
+extern int tick_nohz_remote_tick_stopped(int cpu);
 extern void tick_nohz_idle_enter(void);
 extern void tick_nohz_idle_exit(void);
 extern void tick_nohz_irq_exit(void);
@@ -100,6 +101,7 @@ extern u64 get_cpu_idle_time_us(int cpu, u64 
*last_update_time);
 extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
 #else /* !CONFIG_NO_HZ_COMMON */
 static inline int tick_nohz_tick_stopped(void) { return 0; }
+static inline int tick_nohz_remote_tick_stopped(int cpu) { return 0; }
 static inline void tick_nohz_idle_enter(void) { }
 static inline void tick_nohz_idle_exit(void) { }
 
diff --git a/kernel/sched/tick.c b/kernel/sched/tick.c
index 3bc32c7..f2b1f9f 100644
--- a/kernel/sched/tick.c
+++ b/kernel/sched/tick.c
@@ -41,3 +41,45 @@ void scheduler_tick(void)
rq_last_tick_reset(rq);
 }
 
+#ifdef CONFIG_NO_HZ_FULL
+
+static struct delayed_work work;
+
+/*
+ * Offload task_tick() to remote housekeeping cpus for
+ * nohz_full cpus. This is in the direction of stopping
+ * ticks on nohz_full cpus altogether.
+ */
+
+static void remote_task_tick(struct work_struct *dwork)
+{
+   int cpu;
+
+   get_online_cpus();
+   for_each_cpu_and(cpu, tick_nohz_full_mask, cpu_online_mask) {
+   struct rq *rq = cpu_rq(cpu);
+   unsigned long flags;
+   struct task_struct *curr;
+
+   raw_spin_lock_irqsave(rq-lock, flags);
+   curr = rq-curr;
+
+   if (tick_nohz_remote_tick_stopped(cpu)  !is_idle_task(curr))
+   curr-sched_class-task_tick(rq, curr, 0);
+
+   raw_spin_unlock_irqrestore(rq-lock, flags);
+   }
+   put_online_cpus();
+   schedule_delayed_work(work, HZ);
+}
+static int __init queue_remote_task_tick(void)
+{
+   if (tick_nohz_full_running) {
+   INIT_DELAYED_WORK(work, remote_task_tick);
+   schedule_delayed_work(work, HZ);
+   }
+   return 0;
+}
+core_initcall(queue_remote_task_tick);
+#endif
+
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 9142591..5de79b3 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -421,6 +421,11 @@ int tick_nohz_tick_stopped(void)
return __this_cpu_read(tick_cpu_sched.tick_stopped);
 }
 
+int tick_nohz_remote_tick_stopped(int cpu)
+{
+   return per_cpu(tick_cpu_sched, cpu).tick_stopped;
+}
+
 /**
  * tick_nohz_update_jiffies - update jiffies when idle was interrupted
  *
-- 
2.4.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] nohz_full: Move tick related code to tick.c

2015-08-13 Thread Vatika Harlalka
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 vatikaharla...@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 000..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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] nohz_full: Offload task_tick to remote housekeeping cpus for nohz_full cpus

2015-08-13 Thread Vatika Harlalka
Hi Peter :)

I'm very sorry about this. I should've gone through what was written
on the topic before
attempting to write this patch. I'll go through the link and work on
what is discussed
to make a new relevant patch.

Thanks
Vatika
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] nohz: Affining unpinned timers

2015-08-02 Thread Vatika Harlalka
If everyone thinks its alright, could this patch be applied please? :)

Thanks
Vatika
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RESEND] nohz: Affining unpinned timers

2015-08-02 Thread Vatika Harlalka
If everyone thinks its alright, could this patch be applied please? :)

Thanks
Vatika
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: rts5208: Fixed 80 char & indent warnings

2015-03-24 Thread Vatika Harlalka
Hi,

Please refer :

http://lxr.linux.no/#linux+v3.19.1/Documentation/CodingStyle

for reference on kernel coding conventions. These are also the
basis for various checkpatch.pl errors.

You can also refer to :
http://kernelnewbies.org/CheckpatchTips
for reference on things to look out for while resolving checkpatch
errors.

Thanks :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: rts5208: Fixed 80 char indent warnings

2015-03-24 Thread Vatika Harlalka
Hi,

Please refer :

http://lxr.linux.no/#linux+v3.19.1/Documentation/CodingStyle

for reference on kernel coding conventions. These are also the
basis for various checkpatch.pl errors.

You can also refer to :
http://kernelnewbies.org/CheckpatchTips
for reference on things to look out for while resolving checkpatch
errors.

Thanks :)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/