lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150813092942.GA17540@vatika-Inspiron-3443>
Date:	Thu, 13 Aug 2015 14:59:42 +0530
From:	Vatika Harlalka <vatikaharlalka@...il.com>
To:	mingo@...hat.com, peterz@...radead.org, tglx@...utronix.de,
	rafael.j.wysocki@...el.com, fweisbec@...il.com,
	schwidefsky@...ibm.com, linux-kernel@...r.kernel.org,
	preetium@...rew.cmu.edu
Subject: [PATCH 2/2] nohz_full: Offload task_tick to remote housekeeping cpu

From: Vatika Harlalka <vatikaharlalka@...il.com>
To: mingo@...hat.com,peterz@...radead.org, tglx@...utronix.de, rafael.j.wysocki@...el.com, fweisbec@...il.com,schwidefsky@...ibm.com,linux-kernel@...r.kernel.org, mingo@...hat.com,peterz@...radead.org, preetium@...rew.cmu.edu
Cc: preeti.murthy@...il.com
Bcc: 
Subject: [PATCH 2/2] nohz_full: Offload task_tick to remote housekeeping cpu
Message-ID: <6c49894de23f55e72990eefbf48a1fc237168f13.1439454836.git.vatikaharlalka@...il.com>
Reply-To: 
In-Reply-To: <cover.1439454836.git.vatikaharlalka@...il.com>

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

Signed-off-by: Vatika Harlalka <vatikaharlalka@...il.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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ