From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932422AbWEMOi6 (ORCPT ); Sat, 13 May 2006 10:38:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932437AbWEMOi6 (ORCPT ); Sat, 13 May 2006 10:38:58 -0400 Received: from smtp104.mail.mud.yahoo.com ([209.191.85.214]:36452 "HELO smtp104.mail.mud.yahoo.com") by vger.kernel.org with SMTP id S932422AbWEMOi6 (ORCPT ); Sat, 13 May 2006 10:38:58 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.au; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=PzXVIe3NUUF5USUMdlDlkyxbhYS3pl3Mku48soiR9ggJkWeNYAIhXFf2bGXmo9LnIpgklMvXPzgCZsuF3FAgLfp3ui5nJ/03YlOiTXlzY8/mvbnrniDUqgzhaAdr7iO4j/Ug7W8Nu5sI9eackTG6mKUIJcFU5oij6l6PHFD50lc= ; Message-ID: <4465EF80.6010106@yahoo.com.au> Date: Sun, 14 May 2006 00:38:56 +1000 From: Nick Piggin User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007 Debian/1.7.12-1 X-Accept-Language: en MIME-Version: 1.0 To: Steven Rostedt CC: Ingo Molnar , akpm@osdl.org, LKML Subject: Re: [PATCH] Silly bitmap size accounting fix References: <20060512091451.GA18145@elte.hu> <4465386B.9090804@yahoo.com.au> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Steven Rostedt wrote: > On Sat, 13 May 2006, Nick Piggin wrote: > > >>Ingo Molnar wrote: >> >>>* Steven Rostedt wrote: >>> >>> >>> >>>>-#define BITMAP_SIZE ((((MAX_PRIO+1+7)/8)+sizeof(long)-1)/sizeof(long)) >>>>+#define BITMAP_SIZE ((((MAX_PRIO+7)/8)+sizeof(long)-1)/sizeof(long)) >>> >>> >>>Acked-by: Ingo Molnar >> >>Really?! What about the delimiter bit set at MAX_PRIO? > > > > // delimiter for bitsearch > __set_bit(MAX_PRIO, array->bitmap); > > > Ah! I see what you mean. New patch (add a comment). That would have caused someone a world of pain 3 years ahead ;) > > -- Steve > > Signed-off-by: Steven Rostedt OK I guess. Does it help to also spell out exactly what's going on there? > > Index: linux-2.6.17-rc3-mm1/kernel/sched.c > =================================================================== > --- linux-2.6.17-rc3-mm1.orig/kernel/sched.c 2006-05-12 04:02:32.000000000 -0400 > +++ linux-2.6.17-rc3-mm1/kernel/sched.c 2006-05-13 10:09:15.000000000 -0400 > @@ -192,6 +192,10 @@ static inline unsigned int task_timeslic > * These are the runqueue data structures: > */ > > +/* > + * Calculate BITMAP_SIZE. > + * The bitmask holds MAX_PRIO bits + 1 for the delimiter. + * Calculation is to find the minimum number of longs that holds MAX_PRIO+1 bits: + * size-in-chars = ceiling((MAX_PRIO+1) / CHAR_BITS) + * size-in-longs = ceiling(size-in-chars / sizeof(long)) > + */ > #define BITMAP_SIZE ((((MAX_PRIO+1+7)/8)+sizeof(long)-1)/sizeof(long)) > -- SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com