lkml.org 
[lkml]   [2005]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.6.12-rc4-mm1
On Thu, May 12, 2005 at 03:31:00AM -0700, Andrew Morton wrote:
> +uml-remove-elfh.patch
> +uml-critical-change-memcpy-to-memmove.patch
> UML important updates

uml-remove-elfh looks empty.

Anyway, the real patch, of minor importance, follows in an attachment.
This is a pure bugfix, as the intention was apparent, but not carried
out, but the bug never caused exceptions or corruption. The check for
a comma following "profile=schedule" on the command line had an off by
one that caused it never to trigger. The option checking also
accidentally clobbered prof_on = SCHED_PROFILING, granted that it was
reached (which prior to dealing with that off by one, it never was).

I took the liberty of translating all of the hardcoded string length
constants to strlen(schedstr) plus the appropriate offsets for the sake
of clarity and side benefit of putting a string used only in __init in
__initdata, but left others not multiply referenced in .rodata.


-- wli
profile=schedule parsing is not quite what it should be.
First, str[7] is 'e', not ',', but then even if it did fall through,
prof_on = SCHED_PROFILING would be clobbered inside if (get_option(...))
So a small amount of rearrangement is done in this patch to correct it.

Index: mm1-2.6.12-rc4/kernel/profile.c
===================================================================
--- mm1-2.6.12-rc4.orig/kernel/profile.c 2005-05-14 17:09:17.000000000 -0700
+++ mm1-2.6.12-rc4/kernel/profile.c 2005-05-14 17:45:05.000000000 -0700
@@ -49,15 +49,19 @@

static int __init profile_setup(char * str)
{
+ static char __initdata schedstr[] = "schedule";
int par;

- if (!strncmp(str, "schedule", 8)) {
+ if (!strncmp(str, schedstr, strlen(schedstr))) {
prof_on = SCHED_PROFILING;
- printk(KERN_INFO "kernel schedule profiling enabled\n");
- if (str[7] == ',')
- str += 8;
- }
- if (get_option(&str,&par)) {
+ if (str[strlen(schedstr)] == ',')
+ str += strlen(schedstr) + 1;
+ if (get_option(&str, &par))
+ prof_shift = par;
+ printk(KERN_INFO
+ "kernel schedule profiling enabled (shift: %ld)\n",
+ prof_shift);
+ } else if (get_option(&str, &par)) {
prof_shift = par;
prof_on = CPU_PROFILING;
printk(KERN_INFO "kernel profiling enabled (shift: %ld)\n",
\
 
 \ /
  Last update: 2005-05-15 03:24    [W:0.220 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site