public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Gregory Haskins" <ghaskins@novell.com>
To: "Peter Zijlstra" <peterz@infradead.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	"Steven Rostedt" <rostedt@goodmis.org>, <tglx@linutronix.de>,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	<linux-kernel@vger.kernel.org>, <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 2/2] sched: fix cpupri priocount
Date: Wed, 04 Jun 2008 15:52:07 -0600	[thread overview]
Message-ID: <4846D647.BA47.005A.0@novell.com> (raw)
In-Reply-To: <1212613754.19205.25.camel@lappy.programming.kicks-ass.net>

>>> On Wed, Jun 4, 2008 at  5:09 PM, in message
<1212613754.19205.25.camel@lappy.programming.kicks-ass.net>, Peter Zijlstra
<peterz@infradead.org> wrote: 
> On Wed, 2008-06-04 at 15:04 -0400, Gregory Haskins wrote:
>> A rounding error was pointed out by Peter Zijlstra which would result
>> in the structure holding priorities to be off by one.
>> 
>> Signed-off-by: Gregory Haskins <ghaskins@novell.com>
>> CC: Peter Zijlstra <peterz@infradead.org>
>> ---
>> 
>>  kernel/sched_cpupri.h |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/kernel/sched_cpupri.h b/kernel/sched_cpupri.h
>> index 16d29b9..817c55c 100644
>> --- a/kernel/sched_cpupri.h
>> +++ b/kernel/sched_cpupri.h
>> @@ -4,7 +4,7 @@
>>  #include <linux/sched.h>
>>  
>>  #define CPUPRI_NR_PRIORITIES 2+MAX_RT_PRIO
>> -#define CPUPRI_NR_PRI_WORDS CPUPRI_NR_PRIORITIES/BITS_PER_LONG
>> +#define CPUPRI_NR_PRI_WORDS (CPUPRI_NR_PRIORITIES + 
> BITS_PER_LONG/2)/BITS_PER_LONG
> 
> (33 + 16) / 32 = 49 / 32 = 1
> 
> So its still wrong ;-)
> 
> Please use DECLARE_BITMAP and or BITS_TO_LONGS to avoid these issues.

Indeed.  Here is a new version:

(Thanks, Peter!)

------

    sched: fix cpupri priocount

    A rounding error was pointed out by Peter Zijlstra which would result
    in the structure holding priorities to be off by one.

    Signed-off-by: Gregory Haskins <ghaskins@novell.com>
    CC: Peter Zijlstra <peterz@infradead.org>

diff --git a/kernel/sched_cpupri.h b/kernel/sched_cpupri.h
index 16d29b9..51e6553 100644
--- a/kernel/sched_cpupri.h
+++ b/kernel/sched_cpupri.h
@@ -4,7 +4,7 @@
 #include <linux/sched.h>

 #define CPUPRI_NR_PRIORITIES 2+MAX_RT_PRIO
-#define CPUPRI_NR_PRI_WORDS CPUPRI_NR_PRIORITIES/BITS_PER_LONG
+#define CPUPRI_NR_PRI_WORDS BITS_TO_LONGS(CPUPRI_NR_PRIORITIES)

 #define CPUPRI_INVALID -1
 #define CPUPRI_IDLE     0


      parent reply	other threads:[~2008-06-04 21:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04 19:03 [PATCH 0/2] sched: hotplug and cpupri fixes (v2) Gregory Haskins
2008-06-04 19:04 ` [PATCH 1/2] sched: fix cpupri hotplug support Gregory Haskins
2008-06-04 19:04 ` [PATCH 2/2] sched: fix cpupri priocount Gregory Haskins
2008-06-04 21:09   ` Peter Zijlstra
2008-06-04 21:35     ` Rune Torgersen
2008-06-04 21:52     ` Gregory Haskins [this message]

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=4846D647.BA47.005A.0@novell.com \
    --to=ghaskins@novell.com \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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