Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164506
b: refs/heads/master
c: 672917d
h: refs/heads/master
v: v3
  • Loading branch information
Corrado Zoccolo authored and Linus Torvalds committed Sep 22, 2009
1 parent 19cae6e commit 7e79c26
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69d25870f20c4b2563304f2b79c5300dd60a067e
refs/heads/master: 672917dcc781ead7652a8b11b1fba14e38ac15b8
20 changes: 19 additions & 1 deletion trunk/drivers/cpuidle/governors/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@

struct menu_device {
int last_state_idx;
int needs_update;

unsigned int expected_us;
u64 predicted_us;
Expand Down Expand Up @@ -166,6 +167,8 @@ static inline int performance_multiplier(void)

static DEFINE_PER_CPU(struct menu_device, menu_devices);

static void menu_update(struct cpuidle_device *dev);

/**
* menu_select - selects the next idle state to enter
* @dev: the CPU
Expand All @@ -180,6 +183,11 @@ static int menu_select(struct cpuidle_device *dev)
data->last_state_idx = 0;
data->exit_us = 0;

if (data->needs_update) {
menu_update(dev);
data->needs_update = 0;
}

/* Special case when user has set very strict latency requirement */
if (unlikely(latency_req == 0))
return 0;
Expand Down Expand Up @@ -231,13 +239,23 @@ static int menu_select(struct cpuidle_device *dev)
}

/**
* menu_reflect - attempts to guess what happened after entry
* menu_reflect - records that data structures need update
* @dev: the CPU
*
* 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)
{
struct menu_device *data = &__get_cpu_var(menu_devices);
data->needs_update = 1;
}

/**
* menu_update - attempts to guess what happened after entry
* @dev: the CPU
*/
static void menu_update(struct cpuidle_device *dev)
{
struct menu_device *data = &__get_cpu_var(menu_devices);
int last_idx = data->last_state_idx;
Expand Down

0 comments on commit 7e79c26

Please sign in to comment.