mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: Mateusz.Blaszczyk@nask.pl, rml@tech9.net,
	linux-kernel@vger.kernel.org, wli@holomorphy.com,
	torvalds@osdl.org
Subject: [patch, 2.6.9-rc4-mm1, 2.6.9-rc4] fix the prof=schedule feature
Date: Fri, 15 Oct 2004 11:20:26 +0200	[thread overview]
Message-ID: <20041015092026.GA16458@elte.hu> (raw)
In-Reply-To: <20041015020712.1514f48c.akpm@osdl.org>


* Andrew Morton <akpm@osdl.org> wrote:

> > in the next mail i will send a patch against 2.6.9-rc4 too (which
> > luckily doesnt have the crash bug, but has the feature mismerge).
> 
> OK.  So it sounds like no additional patch will be needed for -mm?

the sched.c chunks below are still needed. prof=schedule must be driven
from schedule(), not from setscheduler().

The profile.c one is a cleanup. [ and you surely must be a great fan of
profiler cleanups by now B-) ]

the patch applies to 2.6.9-rc4 cleanly as well, and the sched.c bits are
necessary there too. I have tested this patch with and without
prof=schedule and it now produces the expected results:

   314 work_resched                              14.2727
   389 log_wait_commit                            1.2006
   391 kjournald                                  0.6872
   499 need_resched                               9.9800
  1549 worker_thread                              2.5310
  1649 wait_for_completion                        7.4615
  2551 do_exit                                    2.6435
  2999 schedule_timeout                          16.7542
  3073 io_schedule                               64.0208
  7863 preempt_schedule                         126.8226

the above is the scheduling profile of a bootup. ~40% of the reschedules
were caused by PREEMPT, ~20% by IO and the remaining ~40% by process
communication.

without this patch the output is a boring empty profile ...

	Ingo

Signed-off-by: Ingo Molnar <mingo@elte.hu>

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -2646,6 +2646,7 @@ asmlinkage void __sched schedule(void)
 			dump_stack();
 		}
 	}
+	profile_hit(SCHED_PROFILING, __builtin_return_address(0));
 
 need_resched:
 	preempt_disable();
@@ -3222,7 +3223,6 @@ static int setscheduler(pid_t pid, int p
 				policy != SCHED_NORMAL)
 			goto out_unlock;
 	}
-	profile_hit(SCHED_PROFILING, __builtin_return_address(0));
 
 	/*
 	 * Valid priorities for SCHED_FIFO and SCHED_RR are
--- linux/kernel/profile.c.orig
+++ linux/kernel/profile.c
@@ -22,14 +22,14 @@ static int __init profile_setup(char * s
 	int par;
 
 	if (!strncmp(str, "schedule", 8)) {
-		prof_on = 2;
+		prof_on = SCHED_PROFILING;
 		printk(KERN_INFO "kernel schedule profiling enabled\n");
 		if (str[7] == ',')
 			str += 8;
 	}
 	if (get_option(&str,&par)) {
 		prof_shift = par;
-		prof_on = 1;
+		prof_on = CPU_PROFILING;
 		printk(KERN_INFO "kernel profiling enabled (shift: %ld)\n",
 			prof_shift);
 	}


  reply	other threads:[~2004-10-15  9:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-15  7:13 Oops sched_setscheduler in 2.6.9-rc4-mm1 Mateusz.Blaszczyk
2004-10-15  9:03 ` [patch, 2.6.9-rc4-mm1] fix oops in sched_setscheduler Ingo Molnar
2004-10-15  9:07   ` Andrew Morton
2004-10-15  9:20     ` Ingo Molnar [this message]
2004-10-15 10:52   ` Mateusz.Blaszczyk
2004-10-15 10:56   ` William Lee Irwin III
2004-10-15 11:49     ` Ingo Molnar

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=20041015092026.GA16458@elte.hu \
    --to=mingo@elte.hu \
    --cc=Mateusz.Blaszczyk@nask.pl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.net \
    --cc=torvalds@osdl.org \
    --cc=wli@holomorphy.com \
    /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®