/** * ladder_do_selection - prepares private data for a state change * @dev: the CPU * @ldev: the ladder device * @old_idx: the current state index * @new_idx: the new target state index
*/ staticinlinevoid ladder_do_selection(struct cpuidle_device *dev, struct ladder_device *ldev, int old_idx, int new_idx)
{
ldev->states[old_idx].stats.promotion_count = 0;
ldev->states[old_idx].stats.demotion_count = 0;
dev->last_state_idx = new_idx;
}
/** * ladder_select_state - selects the next state to enter * @drv: cpuidle driver * @dev: the CPU * @dummy: not used
*/ staticint ladder_select_state(struct cpuidle_driver *drv, struct cpuidle_device *dev, bool *dummy)
{ struct ladder_device *ldev = this_cpu_ptr(&ladder_devices); struct ladder_device_state *last_state; int last_idx = dev->last_state_idx; int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0;
s64 latency_req = cpuidle_governor_latency_req(dev->cpu);
s64 last_residency;
/* Special case when user has set very strict latency requirement */ if (unlikely(latency_req == 0)) {
ladder_do_selection(dev, ldev, last_idx, 0); return 0;
}
if (i < drv->state_count - 1)
lstate->threshold.promotion_time_ns = state->exit_latency_ns; if (i > first_idx)
lstate->threshold.demotion_time_ns = state->exit_latency_ns;
}
return 0;
}
/** * ladder_reflect - update the correct last_state_idx * @dev: the CPU * @index: the index of actual state entered
*/ staticvoid ladder_reflect(struct cpuidle_device *dev, int index)
{ if (index > 0)
dev->last_state_idx = index;
}
/** * init_ladder - initializes the governor
*/ staticint __init init_ladder(void)
{ /* * When NO_HZ is disabled, or when booting with nohz=off, the ladder * governor is better so give it a higher rating than the menu * governor.
*/ if (!tick_nohz_enabled)
ladder_governor.rating = 25;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.