- dynticks-core-fix-idle-time-accounting.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     dynticks core: Fix idle time accounting

has been removed from the -mm tree.  Its filename is

     dynticks-core-fix-idle-time-accounting.patch

This patch was dropped because an updated version was merged

------------------------------------------------------
Subject: dynticks core: Fix idle time accounting
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

The extended sleeps during idle must be accounted to the idle thread.  The
original accounting fixup was too naive.  The time must be accounted when
the idle thread is interrupted and the jiffies update code has forwarded
jiffies.  Otherwise the accounting is done on random targets.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 kernel/hrtimer.c |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff -puN kernel/hrtimer.c~dynticks-core-fix-idle-time-accounting kernel/hrtimer.c
--- a/kernel/hrtimer.c~dynticks-core-fix-idle-time-accounting
+++ a/kernel/hrtimer.c
@@ -44,6 +44,7 @@
 #include <linux/profile.h>
 #include <linux/seq_file.h>
 #include <linux/err.h>
+#include <linux/kernel_stat.h>
 
 #include <asm/uaccess.h>
 
@@ -447,10 +448,11 @@ static const ktime_t nsec_per_hz = { .tv
  * want to wake up a complete idle cpu just to update jiffies, so we need
  * something more intellegent than a mere "do this only on CPUx".
  */
-static void update_jiffies64(ktime_t now)
+static unsigned long update_jiffies64(ktime_t now)
 {
 	unsigned long seq;
 	ktime_t delta;
+	unsigned long ticks = 0;
 
 	/* Preevaluate to avoid lock contention */
 	do {
@@ -459,14 +461,13 @@ static void update_jiffies64(ktime_t now
 	} while (read_seqretry(&xtime_lock, seq));
 
 	if (delta.tv64 < nsec_per_hz.tv64)
-		return;
+		return 0;
 
 	/* Reevalute with xtime_lock held */
 	write_seqlock(&xtime_lock);
 
 	delta = ktime_sub(now, last_jiffies_update);
 	if (delta.tv64 >= nsec_per_hz.tv64) {
-		unsigned long ticks = 1;
 
 		delta = ktime_sub(delta, nsec_per_hz);
 		last_jiffies_update = ktime_add(last_jiffies_update,
@@ -480,11 +481,13 @@ static void update_jiffies64(ktime_t now
 
 			last_jiffies_update = ktime_add_ns(last_jiffies_update,
 							   incr * ticks);
-			ticks++;
 		}
+		ticks++;
 		do_timer(ticks);
 	}
 	write_sequnlock(&xtime_lock);
+
+	return ticks;
 }
 
 #ifdef CONFIG_NO_HZ
@@ -500,7 +503,7 @@ static void update_jiffies64(ktime_t now
 void hrtimer_update_jiffies(void)
 {
 	struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
-	unsigned long flags;
+	unsigned long flags, ticks;
 	ktime_t now;
 
 	if (!cpu_base->tick_stopped || !cpu_base->hres_active)
@@ -509,7 +512,17 @@ void hrtimer_update_jiffies(void)
 	now = ktime_get();
 
 	local_irq_save(flags);
-	update_jiffies64(now);
+	ticks = update_jiffies64(now);
+	if (ticks) {
+		/*
+		 * We stopped the tick in idle and this function got called to
+		 * update jiffies. Update process times would randomly account
+		 * the time we slept to whatever the context of the next sched
+		 * tick is. Enforce that this is accounted to idle !
+		 */
+		account_system_time(current, HARDIRQ_OFFSET,
+				    jiffies_to_cputime(ticks));
+	}
 	local_irq_restore(flags);
 }
 
@@ -604,15 +617,6 @@ void hrtimer_restart_sched_tick(void)
 	local_irq_disable();
 	update_jiffies64(now);
 
-	/*
-	 * Update process times would randomly account the time we slept to
-	 * whatever the context of the next sched tick is.  Enforce that this
-	 * is accounted to idle !
-	 */
-	add_preempt_count(HARDIRQ_OFFSET);
-	update_process_times(0);
-	sub_preempt_count(HARDIRQ_OFFSET);
-
 	/* Account the idle time */
 	delta = ktime_sub(now, cpu_base->idle_entrytime);
 	cpu_base->idle_sleeptime = ktime_add(cpu_base->idle_sleeptime, delta);
_

Patches currently in -mm which might be from tglx@xxxxxxxxxxxxx are

dynticks-core-fix-idle-time-accounting.patch
dyntick-add-nohz-stats-to-proc-stat.patch
dynticks-i386-arch-code.patch
high-res-timers-dynticks-enable-i386-support.patch
debugging-feature-timer-stats.patch
debugging-feature-timer-stats-fix.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux