lkml.org 
[lkml]   [2005]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: Add prefetch switch stack hook in scheduler function
    Date
    On Fri, 29 Jul 2005 09:04:48 +0200, 
    Ingo Molnar <mingo@elte.hu> wrote:
    >ok, how about the additional patch below? Does this do the trick on
    >ia64? It makes complete sense on every architecture to prefetch from
    >below the current kernel stack, in the expectation of the next task
    >touching the stack. The only difference is that for ia64 the 'expected
    >minimum stack footprint' is larger, due to the switch_stack.
    >...
    >Index: linux/kernel/sched.c
    >===================================================================
    >--- linux.orig/kernel/sched.c
    >+++ linux/kernel/sched.c
    >@@ -2869,7 +2869,14 @@ go_idle:
    > * its thread_info, its kernel stack and mm:
    > */
    > prefetch(next->thread_info);
    >- prefetch(kernel_stack(next));
    >+ /*
    >+ * Prefetch (at least) a cacheline below the current
    >+ * kernel stack (in expectation of any new task touching
    >+ * the stack at least minimally), and a cacheline above
    >+ * the stack:
    >+ */
    >+ prefetch_range(kernel_stack(next) - MIN_KERNEL_STACK_FOOTPRINT,
    >+ MIN_KERNEL_STACK_FOOTPRINT + L1_CACHE_BYTES);
    > prefetch(next->mm);
    >
    > if (!rt_task(next) && next->activated > 0) {

    Surely the prefetch range has to depend on which direction the stack
    grows. For stacks that grow down, we want esp/ksp upwards,

    prefetch_range(kernel_stack(next),
    MIN_KERNEL_STACK_FOOTPRINT + L1_CACHE_BYTES);

    For stacks that grow up, we want esp/ksp downwards

    prefetch_range(kernel_stack(next) - MIN_KERNEL_STACK_FOOTPRINT,
    MIN_KERNEL_STACK_FOOTPRINT + L1_CACHE_BYTES);

    BTW, for ia64 you may as well prefetch pt_regs, that is also quite
    large.

    #define MIN_KERNEL_STACK_FOOTPRINT (IA64_SWITCH_STACK_SIZE + IA64_PT_REGS_SIZE)

    -
    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/

    \
     
     \ /
      Last update: 2005-07-29 09:42    [W:3.068 / U:0.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site