All tasks structs are 8 kB aligned, which results in very bad cache behaviour when walking the task chains. The attached patch moves the task structure into a slab, with normal cache colouring. It's tested with i386 SMP.(i.e. it boots and runs X) 'current=%esp&0xffffe000' was replaced with reusing %cr2. There are 2 changes that might have side effects: 1) arch/i386/kernel/entry.S: <<<<<< error_code: [...] - GET_CURRENT(%ebx) call *%edi addl $8,%esp + GET_CURRENT(%ebx) <<<<< The pointer to current was loaded into %ebx before the call to the error handler, now that only happens after the call. As far as I can see the load before the call is not required. 2) arch/i386/kernel/smpboot.c: - stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle); + stack_start.esp = (void *) (THREAD_SIZE + (char *)TSK_TO_KSTACK(idle)); I don't understand why the top 3 kB of the stack are not used. -- Manfred