mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Don Mullis <dwm@meer.net>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: [patch] Re: 2.6.19-rc6-mm1 -- sched-improve-migration-accuracy.patch slows boot
Date: Mon, 27 Nov 2006 11:50:11 +0100	[thread overview]
Message-ID: <1164624611.5892.27.camel@Homer.simpson.net> (raw)
In-Reply-To: <1164591509.2894.76.camel@localhost.localdomain>

On Sun, 2006-11-26 at 17:38 -0800, Don Mullis wrote: 
> > This must be a bisection false positive.  The patch in question is
> > essentially a no-op for a UP kernel.

Duh!  Except for the bug, which doesn't care either way.

> Testing alternately with 
> 	1) all -mm1 patches applied, and 
> 	2) all except sched-improve-migration-accuracy*.path applied,
> confirms the misbehavior.

While fixing a sched_time accounting buglet, I stupidly broke sleep_avg
accounting, and quite thoroughly for cpu hogs.  Since I updated a task's
timestamp at tick time, but sleep_avg adjustment only takes place at
schedule time, every tick a task took without scheduling resulted in a
tick of run time lost for sleep_avg accounting.  The below should fix
it, can you confirm?

Fix sleep_avg breakage induced by sched-improve-migration-accuracy.path
Use p->last_ran to fix sched_time buglet instead of p->timestamp.

Signed-off-by: Mike Galbraith <efault@gmx.de>

--- linux-2.6.19-rc6-mm1/kernel/sched.c.org	2006-11-27 10:24:07.000000000 +0100
+++ linux-2.6.19-rc6-mm1/kernel/sched.c	2006-11-27 10:28:59.000000000 +0100
@@ -3024,8 +3024,8 @@ EXPORT_PER_CPU_SYMBOL(kstat);
 static inline void
 update_cpu_clock(struct task_struct *p, struct rq *rq, unsigned long long now)
 {
-	p->sched_time += now - p->timestamp;
-	p->timestamp = rq->most_recent_timestamp = now;
+	p->sched_time += now - p->last_ran;
+	p->last_ran = rq->most_recent_timestamp = now;
 }
 
 /*
@@ -3038,7 +3038,7 @@ unsigned long long current_sched_time(co
 	unsigned long flags;
 
 	local_irq_save(flags);
-	ns = p->sched_time + sched_clock() - p->timestamp;
+	ns = p->sched_time + sched_clock() - p->last_ran;
 	local_irq_restore(flags);
 
 	return ns;
@@ -3553,10 +3553,11 @@ switch_tasks:
 	prev->sleep_avg -= run_time;
 	if ((long)prev->sleep_avg <= 0)
 		prev->sleep_avg = 0;
+	prev->timestamp = prev->last_ran = now;
 
 	sched_info_switch(prev, next);
 	if (likely(prev != next)) {
-		next->timestamp = prev->last_ran = now;
+		next->timestamp = now;
 		rq->nr_switches++;
 		rq->curr = next;
 		++*switch_count;



  parent reply	other threads:[~2006-11-27 10:50 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 10:17 2.6.19-rc6-mm1 Andrew Morton
2006-11-23 10:38 ` 2.6.19-rc6-mm1 Reuben Farrelly
2006-11-23 14:06   ` [PATCH] x86_64: fix build without HOTPLUG_CPU (was Re: 2.6.19-rc6-mm1) Jiri Kosina
2006-11-23 15:08     ` Andi Kleen
2006-11-23 15:17       ` Jiri Kosina
2006-11-23 15:27         ` Andi Kleen
2006-11-23 15:37           ` Jiri Kosina
2006-11-23 16:33             ` Ingo Molnar
2006-11-23 11:23 ` 2.6.19-rc6-mm1 Mariusz Kozlowski
2006-11-23 18:36   ` 2.6.19-rc6-mm1 Andrew Morton
2006-11-23 19:24     ` 2.6.19-rc6-mm1 Mariusz Kozlowski
2006-11-23 20:20     ` 2.6.19-rc6-mm1 Andy Whitcroft
2006-11-23 20:56       ` 2.6.19-rc6-mm1 Andrew Morton
2006-11-24 19:34       ` 2.6.19-rc6-mm1 Matthew Frost
2006-11-23 20:23     ` 2.6.19-rc6-mm1 Benoit Boissinot
2006-11-23 12:22 ` 2.6.19-rc6-mm1 Mariusz Kozlowski
2006-11-23 13:03 ` 2.6.19-rc6-mm1 Andy Whitcroft
2006-11-23 17:26 ` MCORE2 include/asm/module.h:60:2: error: #error unknown processor family [was Re: 2.6.19-rc6-mm1] Mattia Dongili
2006-11-23 23:30 ` 2.6.19-rc6-mm1: no help text for TCP_MD5SIG_DEBUG Adrian Bunk
2006-11-24  1:37   ` David Miller
2006-11-24  0:17 ` 2.6.19-rc6-mm1: drivers/net/chelsio/: unused code Adrian Bunk
2006-11-27 18:24   ` Stephen Hemminger
2006-11-29  7:36     ` Adrian Bunk
2006-11-29  7:47       ` Andrew Morton
2007-02-20  0:02         ` Adrian Bunk
2007-02-20 21:31           ` Stephen Hemminger
2007-02-20 22:06             ` Adrian Bunk
2006-11-24  1:46 ` [-mm patch] make qla2x00_reg_remote_port() static Adrian Bunk
2006-11-27 17:22   ` Andrew Vasquez
2006-11-24  1:46 ` [-mm patch] make proc_pid_io_accounting() static Adrian Bunk
2006-11-24  1:46 ` [-mm patch] make readahead_debug_level static Adrian Bunk
2006-11-24 16:59 ` [PATCH] efi_limit_regions triggers link failure when CONFIG_EFI is not defined Andy Whitcroft
2006-11-24 17:05   ` Andi Kleen
2006-11-24 17:24     ` Andy Whitcroft
2006-11-24 17:33       ` Andi Kleen
2006-11-24 21:30         ` Andrew Morton
2006-11-26  2:13     ` Matthew Frost
2006-11-24 17:58 ` [PATCH] x86_64 vsyscall fails to compile when CONFIG_HOTPLUG_CPU is disabled Andy Whitcroft
2006-11-24 18:03   ` Jiri Kosina
2006-11-24 19:11   ` Andi Kleen
2006-11-24 21:58 ` [-mm patch] net/: possible cleanups Adrian Bunk
2006-12-01  1:28   ` David Miller
2006-11-25 19:15 ` [-mm patch] include/linux/bug.h must always #include <linux/module.h> Adrian Bunk
2006-11-25 19:17 ` [-mm patch] fs/stack.c should #include <linux/fs_stack.h> Adrian Bunk
2006-11-25 19:57   ` Josef Sipek
2006-11-25 19:21 ` [-mm patch] fs/reiser4/: more possible cleanups Adrian Bunk
2006-11-25 19:48 ` 2.6.19-rc6-mm1 -- sched-improve-migration-accuracy.patch slows boot Don Mullis
2006-11-26  6:24   ` Mike Galbraith
2006-11-27  1:38     ` Don Mullis
2006-11-27 10:16       ` Ingo Molnar
2006-11-28 18:47         ` Don Mullis
2006-11-27 10:50       ` Mike Galbraith [this message]
2006-11-27 17:17         ` [patch] " Don Mullis
2006-11-27 18:27           ` Mike Galbraith
2006-11-26  5:40 ` [-mm patch] sound/soc/soc-dapm.c: make 4 functions static Adrian Bunk
2006-11-27  4:21 ` [PATCH] paravirt reorder functions to avoid unspecified behaviour Andy Whitcroft
2006-11-27 11:13   ` Andi Kleen

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=1164624611.5892.27.camel@Homer.simpson.net \
    --to=efault@gmx.de \
    --cc=akpm@osdl.org \
    --cc=dwm@meer.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

Powered by JetHome