@@ -33,7 +33,7 @@ static int enabled_devices;
static int off __read_mostly;
static int initialized __read_mostly;
-int cpuidle_disabled(void)
+inline int cpuidle_disabled(void)
{
return off;
}
@@ -30,7 +30,7 @@ static DEFINE_PER_CPU(struct cpuidle_driver *, cpuidle_drivers);
* Returns a pointer to struct cpuidle_driver or NULL if no driver has been
* registered for @cpu.
*/
-static struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
+static inline struct cpuidle_driver *__cpuidle_get_cpu_driver(int cpu)
{
return per_cpu(cpuidle_drivers, cpu);
}
@@ -168,7 +168,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv,
* @dev: the CPU
* @index: the index of actual state entered
*/
-static void ladder_reflect(struct cpuidle_device *dev, int index)
+static inline void ladder_reflect(struct cpuidle_device *dev, int index)
{
struct ladder_device *ldev = &__get_cpu_var(ladder_devices);
if (index > 0)
@@ -135,11 +135,10 @@ struct menu_device {
#define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
-static int get_loadavg(void)
+static inline int get_loadavg(void)
{
unsigned long this = this_cpu_load();
-
return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10;
}
@@ -195,7 +194,7 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices);
static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev);
/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */
-static u64 div_round64(u64 dividend, u32 divisor)
+static inline u64 div_round64(u64 dividend, u32 divisor)
{
return div_u64(dividend + (divisor / 2), divisor);
}
@@ -373,7 +372,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
* NOTE: it's important to be fast here because this operation will add to
* the overall exit latency.
*/
-static void menu_reflect(struct cpuidle_device *dev, int index)
+static inline void menu_reflect(struct cpuidle_device *dev, int index)
{
struct menu_device *data = &__get_cpu_var(menu_devices);
data->last_state_idx = index;
@@ -8,7 +8,7 @@
#include "sched.h"
-unsigned long this_cpu_load(void)
+inline unsigned long this_cpu_load(void)
{
struct rq *this = this_rq();
return this->cpu_load[0];
Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org> --- This patch is intended to add some inline optimization for few functions in cpuidle code, which will save some function call work and negligible increase in the size of the code. using inline hint for functions - with minimal definition and are suitable for inlining - which are called frequently checked on panda 3.14.rc1, using menu governor. How to check for ladder? regards, sanjay --- drivers/cpuidle/cpuidle.c | 2 +- drivers/cpuidle/driver.c | 2 +- drivers/cpuidle/governors/ladder.c | 2 +- drivers/cpuidle/governors/menu.c | 7 +++---- kernel/sched/proc.c | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-)