Re: [PATCH, RFC] remove task_cache entirely

William Lee Irwin III (wli@holomorphy.com)
Sun, 13 Jul 2003 05:40:46 -0700


On Sun, Jul 13, 2003 at 01:57:41PM +0200, Manfred Spraul wrote:
> kernel/fork.c contains a disabled cache for task stuctures. task
> structures are placed into the task cache only if "tsk==current", and
> "tsk==current" is impossible. There is even a WARN_ON against that in
> __put_task_struct().
> What should we do with it? I would remove it entirely - it's dead code.
> Any objections?
> One problem is that order-1 allocations are not cached per-cpu - what
> about using kmem_cache_alloc for the stack?

I've been slab allocating the stack on i386 for some time, and it has
gone without incident in pgcl, -wli, -mjb (?), and so on. kmalloc() is
fine; there isn't any particularly compelling reason for a dedicated
slab as there's no preconstruction to do, though it can be arranged.

Basically, it works, there's no obvious reason not to, and (even better)
it's not totally invisible to the VM and even makes overhead reportable.

akpm, this is a two line change with almost no effect apart from
theoretically improved SMP efficiency and more accurate reporting.
Shall we?

-- wli

diff -prauN mm1-2.5.75-1/include/asm-i386/thread_info.h mm1-2.5.75-stack-1/include/asm-i386/thread_info.h
--- mm1-2.5.75-1/include/asm-i386/thread_info.h 2003-07-10 13:05:26.000000000 -0700
+++ mm1-2.5.75-stack-1/include/asm-i386/thread_info.h 2003-07-13 05:35:08.000000000 -0700
@@ -87,8 +87,8 @@ static inline struct thread_info *curren

/* thread information allocation */
#define THREAD_SIZE (2*PAGE_SIZE)
-#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
-#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
+#define alloc_thread_info(task) ((struct thread_info *)kmalloc(THREAD_SIZE, GFP_KERNEL))
+#define free_thread_info(info) kfree(info)
#define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/