Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1209279

[PATCH 2/2] hrtimer: Unconfuse a bit switch_hrtimer_base

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!bofh.it!news.nic.it!robomod
From Frederic Weisbecker <fweisbec@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] hrtimer: Unconfuse a bit switch_hrtimer_base
Date Tue, 18 Aug 2015 16:20:01 +0200
Message-ID <pYPU5-fd-13@gated-at.bofh.it> (permalink)
References <pYPU5-fd-15@gated-at.bofh.it>
X-Original-To Thomas Gleixner <tglx@linutronix.de>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yqeYfUFhlcNbaCDPKg4fn4vI3nIpn/a61w0P5NPfOvM=; b=DEqjqaIxTw851heYShR5w4IB9RBW5Q61nIiHP1mi05gEjFL3t7YGJH3aU/4jnWaAlW Oi9v0iwNMUtlFESwUQiOluGpHcnhUs5Fce6rVNCF3u94x5a+FEKg2EelVmVP5SJpIIu9 btDIEeLecmH5XZBjtTs9l6aMiuessTf+F6rp3+3E3dRhhQ2xwa3/gN6jntMWcQHGDd4D r8eoXp1ZcJLdAoh4wU7y8vcnl3TbPBag+8Q94GSM+nF+njh3a2cd1kUxWFNbZooJ7/dP joF+Rj+nW0R06Doe5GZ5IOX1gD5XsCE/OxkTTjQ0qvoCyK13sVVWct4CkaGvXT2NvojK 7Dhw==
X-Received by 10.180.10.74 with SMTP id g10mr36080668wib.64.1439907532922; Tue, 18 Aug 2015 07:18:52 -0700 (PDT)
X-Mailer git-send-email 2.1.4
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 72
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, Frederic Weisbecker <fweisbec@gmail.com>
X-Original-Date Tue, 18 Aug 2015 16:18:29 +0200
X-Original-Message-ID <1439907509-9553-3-git-send-email-fweisbec@gmail.com>
X-Original-References <1439907509-9553-1-git-send-email-fweisbec@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1209279

Show key headers only | View raw


The variable called "this_base" is confusing because its name suggests
it's of "struct hrtimer_clock_base" type, along with "base" and "new_base"
which doesn't help understanding this complicated function.

Make its name clearer and fix the misleading comments while at it.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 kernel/time/hrtimer.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index f9eb21b..1828ed0 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -196,18 +196,20 @@ struct hrtimer_cpu_base *get_target_base(struct hrtimer_cpu_base *base,
 #endif
 
 /*
- * Switch the timer base to the current CPU when possible.
+ * Switch the timer base to a power-optimized selected CPU target.
+ * If that would involve clock reprogramming, which we can't do on a remote
+ * target, just switch to the current CPU.
  */
 static inline struct hrtimer_clock_base *
 switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,
 		    int pinned)
 {
-	struct hrtimer_cpu_base *new_cpu_base, *this_base;
+	struct hrtimer_cpu_base *new_cpu_base, *this_cpu_base;
 	struct hrtimer_clock_base *new_base;
 	int basenum = base->index;
 
-	this_base = this_cpu_ptr(&hrtimer_bases);
-	new_cpu_base = get_target_base(this_base, pinned);
+	this_cpu_base = this_cpu_ptr(&hrtimer_bases);
+	new_cpu_base = get_target_base(this_cpu_base, pinned);
 again:
 	new_base = &new_cpu_base->clock_base[basenum];
 
@@ -229,19 +231,19 @@ again:
 		raw_spin_unlock(&base->cpu_base->lock);
 		raw_spin_lock(&new_base->cpu_base->lock);
 
-		if (new_cpu_base != this_base &&
+		if (new_cpu_base != this_cpu_base &&
 		    hrtimer_check_target(timer, new_base)) {
 			raw_spin_unlock(&new_base->cpu_base->lock);
 			raw_spin_lock(&base->cpu_base->lock);
-			new_cpu_base = this_base;
+			new_cpu_base = this_cpu_base;
 			timer->base = base;
 			goto again;
 		}
 		timer->base = new_base;
 	} else {
-		if (new_cpu_base != this_base &&
+		if (new_cpu_base != this_cpu_base &&
 		    hrtimer_check_target(timer, new_base)) {
-			new_cpu_base = this_base;
+			new_cpu_base = this_cpu_base;
 			goto again;
 		}
 	}
-- 
2.1.4

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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] hrtimer: Unconfuse a bit switch_hrtimer_base Frederic Weisbecker <fweisbec@gmail.com> - 2015-08-18 16:20 +0200
  [tip:timers/core] hrtimer: Unconfuse switch_hrtimer_base() a bit tip-bot for Frederic Weisbecker <tipbot@zytor.com> - 2015-08-18 18:50 +0200

csiph-web