lkml.org 
[lkml]   [2006]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] -mm: Small schedule() optimization

    * Con Kolivas <kernel@kolivas.org> wrote:

    > > - if (likely(!current->exit_state)) {
    > > - if (unlikely(in_atomic())) {
    > > + if (unlikely(in_atomic())) {
    > > + if (likely(!current->exit_state)) {
    >
    > I suspect that once we're in_atomic() then we're no longer likely to
    > be !current->exit_state
    >
    > Probably better to just
    > if (unlikely(in_atomic())) {
    > if (!current->exit_state) {
    >
    > Ingo?

    yeah. There's not much point in nesting likely/unlikely. In fact we can
    just merge the two conditions, as per updated patch below.

    Ingo

    ---
    From: Andreas Mohr <andi@lisas.de>

    small schedule() microoptimization.

    Signed-off-by: Andreas Mohr <andi@lisas.de>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

    --- linux/kernel/sched.c.orig
    +++ linux/kernel/sched.c
    @@ -2873,13 +2873,11 @@ asmlinkage void __sched schedule(void)
    * schedule() atomically, we ignore that path for now.
    * Otherwise, whine if we are scheduling when we should not be.
    */
    - if (likely(!current->exit_state)) {
    - if (unlikely(in_atomic())) {
    - printk(KERN_ERR "scheduling while atomic: "
    - "%s/0x%08x/%d\n",
    - current->comm, preempt_count(), current->pid);
    - dump_stack();
    - }
    + if (unlikely(in_atomic() && !current->exit_state)) {
    + printk(KERN_ERR "scheduling while atomic: "
    + "%s/0x%08x/%d\n",
    + current->comm, preempt_count(), current->pid);
    + dump_stack();
    }
    profile_hit(SCHED_PROFILING, __builtin_return_address(0));

    -
    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: 2006-03-17 10:18    [W:0.029 / U:59.884 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site