mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] O(1) scheduler, -D1, 2.5.2-pre9, 2.4.17
Date: Tue, 8 Jan 2002 22:32:52 +1100	[thread overview]
Message-ID: <20020108113251.GB20897@krispykreme> (raw)
In-Reply-To: <200201071922.g07JMN106760@penguin.transmeta.com> <Pine.LNX.4.33.0201072222100.15970-100000@localhost.localdomain>
In-Reply-To: <Pine.LNX.4.33.0201072222100.15970-100000@localhost.localdomain>


Hi Ingo,

I tested 2.5.2-pre10 today. There is some bitop abuse that needs fixing
for big endian machines to work :)

At the moment we have:

	#define BITMAP_SIZE ((MAX_PRIO+7)/8)
	char bitmap[BITMAP_SIZE];

Which is initialised using:

	memset(array->bitmap, 0xff, BITMAP_SIZE);
	clear_bit(MAX_PRIO, array->bitmap);

This results in the following in memory (in ascending memory order):

ffffffffffffffff ffffffffffffffff fffffeffff000000

The problem here is that when we search the high word, we do so from
the right, therefore we get 128 all the time :)

The following patch fixes this. We need to define the bitmap to be in
terms of unsigned long, in this case its only lucky we have the correct
alignment. We also replace the memset of the bitmap with set_bit.

With the patch things look much better (and the kernel boots on my
ppc64 machine :)

ffffffffffffffff ffffffffffffffff 000000ffffffffff 

Anton

diff -urN linuxppc_2_5/include/asm-i386/mmu_context.h linuxppc_2_5_work/include/asm-i386/mmu_context.h
--- linuxppc_2_5/include/asm-i386/mmu_context.h	Tue Jan  8 17:09:47 2002
+++ linuxppc_2_5_work/include/asm-i386/mmu_context.h	Tue Jan  8 22:06:35 2002
@@ -16,7 +16,7 @@
 # error update this function.
 #endif
 
-static inline int sched_find_first_zero_bit(char *bitmap)
+static inline int sched_find_first_zero_bit(unsigned long *bitmap)
 {
 	unsigned int *b = (unsigned int *)bitmap;
 	unsigned int rt;
diff -urN linuxppc_2_5/kernel/sched.c linuxppc_2_5_work/kernel/sched.c
--- linuxppc_2_5/kernel/sched.c	Tue Jan  8 17:09:47 2002
+++ linuxppc_2_5_work/kernel/sched.c	Tue Jan  8 22:13:45 2002
@@ -20,15 +20,13 @@
 #include <linux/interrupt.h>
 #include <asm/mmu_context.h>
 
-#define BITMAP_SIZE ((MAX_PRIO+7)/8)
-
 typedef struct runqueue runqueue_t;
 
 struct prio_array {
 	int nr_active;
 	spinlock_t *lock;
 	runqueue_t *rq;
-	char bitmap[BITMAP_SIZE];
+	unsigned long bitmap[3];
 	list_t queue[MAX_PRIO];
 };
 
@@ -1306,11 +1304,12 @@
 			array = rq->arrays + j;
 			array->rq = rq;
 			array->lock = &rq->lock;
-			for (k = 0; k < MAX_PRIO; k++)
+			for (k = 0; k < MAX_PRIO; k++) {
 				INIT_LIST_HEAD(array->queue + k);
-			memset(array->bitmap, 0xff, BITMAP_SIZE);
+				__set_bit(k, array->bitmap);
+			}
 			// zero delimiter for bitsearch
-			clear_bit(MAX_PRIO, array->bitmap);
+			__clear_bit(MAX_PRIO, array->bitmap);
 		}
 	}
 	/*

  parent reply	other threads:[~2002-01-08 11:37 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200201071922.g07JMN106760@penguin.transmeta.com>
2002-01-07 21:36 ` Ingo Molnar
2002-01-08  8:49   ` FD Cami
2002-01-08 18:44     ` J Sloan
2002-01-08 11:32   ` Anton Blanchard [this message]
2002-01-08 11:43     ` Anton Blanchard
2002-01-08 14:34       ` Ingo Molnar
2002-01-09 23:15         ` Anton Blanchard
2002-01-10  1:09           ` Richard Henderson
2002-01-10 17:04             ` Ivan Kokshaysky
2002-01-10 20:42               ` george anzinger
2002-01-10 23:56               ` Ingo Molnar
2002-01-08 14:32     ` [patch] O(1) scheduler, -E1, 2.5.2-pre10, 2.4.17 Ingo Molnar
2002-01-07 20:24 [patch] O(1) scheduler, -D1, 2.5.2-pre9, 2.4.17 Ingo Molnar
2002-01-07 19:03 ` Brian Gerst
2002-01-07 21:19   ` Ingo Molnar
2002-01-09  3:39 ` Mike Kravetz
2002-01-09  3:32   ` Rusty Russell
2002-01-09 18:02     ` Davide Libenzi
2002-01-09  5:05   ` Davide Libenzi
2002-01-09 11:19     ` Rene Rebe
2002-01-09 15:34       ` Ryan Cumming
2002-01-09 11:37     ` Ingo Molnar
2002-01-09 18:24       ` Davide Libenzi
2002-01-09 21:24         ` Ingo Molnar
2002-01-09 19:38           ` Mike Kravetz
2002-01-10 18:21             ` Mike Kravetz
2002-01-10 19:08               ` Davide Libenzi
2002-01-10 19:09                 ` Linus Torvalds
2002-01-10 21:08                   ` Davide Libenzi
2002-01-10 19:15                 ` Mike Kravetz
2002-01-10 20:05                   ` Davide Libenzi
2002-01-09 22:34           ` Mark Hahn
2002-01-10 14:04             ` Ingo Molnar
2002-01-09 20:15       ` Linus Torvalds
2002-01-09 23:02         ` Ingo Molnar
2002-01-09 10:25   ` Ingo Molnar
2002-01-09 17:40     ` Mike Kravetz
2002-01-09  6:29 ` Brian
2002-01-09  6:40   ` Jeffrey W. Baker
2002-01-09  6:45   ` Ryan Cumming
2002-01-09  6:48   ` Ryan Cumming

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=20020108113251.GB20897@krispykreme \
    --to=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.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®