Lines Matching +full:higher +full:- +full:than +full:- +full:threshold
2 * ladder.c - the residency ladder algorithm
8 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
32 } threshold; member
46 * ladder_do_selection - prepares private data for a state change
56 ldev->states[old_idx].stats.promotion_count = 0; in ladder_do_selection()
57 ldev->states[old_idx].stats.demotion_count = 0; in ladder_do_selection()
58 dev->last_state_idx = new_idx; in ladder_do_selection()
62 * ladder_select_state - selects the next state to enter
72 int last_idx = dev->last_state_idx; in ladder_select_state()
73 int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0; in ladder_select_state()
74 s64 latency_req = cpuidle_governor_latency_req(dev->cpu); in ladder_select_state()
83 last_state = &ldev->states[last_idx]; in ladder_select_state()
85 last_residency = dev->last_residency_ns - drv->states[last_idx].exit_latency_ns; in ladder_select_state()
88 if (last_idx < drv->state_count - 1 && in ladder_select_state()
89 !dev->states_usage[last_idx + 1].disable && in ladder_select_state()
90 last_residency > last_state->threshold.promotion_time_ns && in ladder_select_state()
91 drv->states[last_idx + 1].exit_latency_ns <= latency_req) { in ladder_select_state()
92 last_state->stats.promotion_count++; in ladder_select_state()
93 last_state->stats.demotion_count = 0; in ladder_select_state()
94 if (last_state->stats.promotion_count >= last_state->threshold.promotion_count) { in ladder_select_state()
102 (dev->states_usage[last_idx].disable || in ladder_select_state()
103 drv->states[last_idx].exit_latency_ns > latency_req)) { in ladder_select_state()
106 for (i = last_idx - 1; i > first_idx; i--) { in ladder_select_state()
107 if (drv->states[i].exit_latency_ns <= latency_req) in ladder_select_state()
115 last_residency < last_state->threshold.demotion_time_ns) { in ladder_select_state()
116 last_state->stats.demotion_count++; in ladder_select_state()
117 last_state->stats.promotion_count = 0; in ladder_select_state()
118 if (last_state->stats.demotion_count >= last_state->threshold.demotion_count) { in ladder_select_state()
119 ladder_do_selection(dev, ldev, last_idx, last_idx - 1); in ladder_select_state()
120 return last_idx - 1; in ladder_select_state()
129 * ladder_enable_device - setup for the governor
137 int first_idx = drv->states[0].flags & CPUIDLE_FLAG_POLLING ? 1 : 0; in ladder_enable_device()
138 struct ladder_device *ldev = &per_cpu(ladder_devices, dev->cpu); in ladder_enable_device()
142 dev->last_state_idx = first_idx; in ladder_enable_device()
144 for (i = first_idx; i < drv->state_count; i++) { in ladder_enable_device()
145 state = &drv->states[i]; in ladder_enable_device()
146 lstate = &ldev->states[i]; in ladder_enable_device()
148 lstate->stats.promotion_count = 0; in ladder_enable_device()
149 lstate->stats.demotion_count = 0; in ladder_enable_device()
151 lstate->threshold.promotion_count = PROMOTION_COUNT; in ladder_enable_device()
152 lstate->threshold.demotion_count = DEMOTION_COUNT; in ladder_enable_device()
154 if (i < drv->state_count - 1) in ladder_enable_device()
155 lstate->threshold.promotion_time_ns = state->exit_latency_ns; in ladder_enable_device()
157 lstate->threshold.demotion_time_ns = state->exit_latency_ns; in ladder_enable_device()
164 * ladder_reflect - update the correct last_state_idx
171 dev->last_state_idx = index; in ladder_reflect()
183 * init_ladder - initializes the governor
189 * governor is better so give it a higher rating than the menu in init_ladder()