mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	avi@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
	tglx@linutronix.de, Don Zickus <dzickus@redhat.com>
Subject: [PATCH 2/5] time: Minimize number of touch_softlockup_watchdog
Date: Wed, 21 Dec 2011 16:17:42 -0500	[thread overview]
Message-ID: <1324502265-24521-3-git-send-email-dzickus@redhat.com> (raw)
In-Reply-To: <1324502265-24521-1-git-send-email-dzickus@redhat.com>

Another patch where I was worried about overhead on a change
in the softlockup code.  Currently on my x86 box it seems the
tick code was touch the softlockup every millisecond.

To minimize, I moved the touch_softlockup_watchdog to a
common function, tick_do_update_jiffies64.  Then the code
only ever touches the softlockup when there was a greater
than 1 second jump in the tick.

Considering the softlockup fires ever 20 seconds or so, this
should be safe for now.

This saves about a 1 thousand calls/per second.

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 kernel/time/tick-sched.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 31cc061..00578c0 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -73,6 +73,8 @@ static void tick_do_update_jiffies64(ktime_t now)
 
 			last_jiffies_update = ktime_add_ns(last_jiffies_update,
 							   incr * ticks);
+			if (incr > NSEC_PER_SEC)
+				touch_softlockup_watchdog();
 		}
 		do_timer(++ticks);
 
@@ -144,8 +146,6 @@ static void tick_nohz_update_jiffies(ktime_t now)
 	local_irq_save(flags);
 	tick_do_update_jiffies64(now);
 	local_irq_restore(flags);
-
-	touch_softlockup_watchdog();
 }
 
 /*
@@ -572,7 +572,6 @@ void tick_nohz_restart_sched_tick(void)
 		account_idle_ticks(ticks);
 #endif
 
-	touch_softlockup_watchdog();
 	/*
 	 * Cancel the scheduled timer and restore the tick
 	 */
@@ -625,7 +624,6 @@ static void tick_nohz_handler(struct clock_event_device *dev)
 	 * do when we go busy again does not account too much ticks.
 	 */
 	if (ts->tick_stopped) {
-		touch_softlockup_watchdog();
 		ts->idle_jiffies++;
 	}
 
@@ -783,7 +781,6 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
 		 * when we go busy again does not account too much ticks.
 		 */
 		if (ts->tick_stopped) {
-			touch_softlockup_watchdog();
 			ts->idle_jiffies++;
 		}
 		update_process_times(user_mode(regs));
-- 
1.7.7.4


  parent reply	other threads:[~2011-12-21 21:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 21:17 [PATCH 0/5] softlockup, sched: convert softlockup to real-time timestamping Don Zickus
2011-12-21 21:17 ` [PATCH 1/5] sched: Minimize the number of touch_softlockup_watchdogs Don Zickus
2011-12-21 21:17 ` Don Zickus [this message]
2011-12-21 21:17 ` [PATCH 3/5] watchdog: Remove touch_all_softlockup_watchdogs Don Zickus
2011-12-21 21:17 ` [PATCH 4/5] watchdog: Softlockup has regular windows where it is not armed Don Zickus
2011-12-21 21:17 ` [PATCH 5/5] kgdb, softlockup: Remove touch_softlockup_watchdog_sync Don Zickus

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=1324502265-24521-3-git-send-email-dzickus@redhat.com \
    --to=dzickus@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --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

all inboxes | Powered by JetHome®