• Martin Schwidefsky's avatar
    nohz: Reuse ktime in sub-functions of tick_check_idle. · eed3b9cf
    Martin Schwidefsky authored
    On a system with NOHZ=y tick_check_idle calls tick_nohz_stop_idle and
    tick_nohz_update_jiffies. Given the right conditions (ts->idle_active
    and/or ts->tick_stopped) both function get a time stamp with ktime_get.
    The same time stamp can be reused if both function require one.
    
    On s390 this change has the additional benefit that gcc inlines the
    tick_nohz_stop_idle function into tick_check_idle. The number of
    instructions to execute tick_check_idle drops from 225 to 144
    (without the ktime_get optimization it is 367 vs 215 instructions).
    
    before:
    
     0)               |  tick_check_idle() {
     0)               |    tick_nohz_stop_idle() {
     0)               |      ktime_get() {
     0)               |        read_tod_clock() {
     0)   0.601 us    |        }
     0)   1.765 us    |      }
     0)   3.047 us    |    }
     0)               |    ktime_get() {
     0)               |      read_tod_clock() {
     0)   0.570 us    |      }
     0)   1.727 us    |    }
     0)               |    tick_do_update_jiffies64() {
     0)   0.609 us    |    }
     0)   8.055 us    |  }
    
    after:
    
     0)               |  tick_check_idle() {
     0)               |    ktime_get() {
     0)               |      read_tod_clock() {
     0)   0.617 us    |      }
     0)   1.773 us    |    }
     0)               |    tick_do_update_jiffies64() {
     0)   0.593 us    |    }
     0)   4.477 us    |  }
    Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
    Cc: john stultz <johnstul@us.ibm.com>
    LKML-Reference: <20090929122533.206589318@de.ibm.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    eed3b9cf
tick-sched.c 19.5 KB