diff options
| author | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2016-06-07 15:18:37 -0700 |
|---|---|---|
| committer | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2016-10-17 12:45:51 -0700 |
| commit | dc09dd60a03e083c8e9ed2a971e1fda6f1a36309 (patch) | |
| tree | 762482c1c9e80f8d0fccc965da7cbca1ec8117df /kernel/sched/sched.h | |
| parent | 7bd09f24415cb4809973ed4f536c717b91dc0e18 (diff) | |
sched: Optimize the next top task search logic upon task migration
find_next_top_index() is responsible for finding the second top task
on a CPU when the top task migrates away from that CPU. This operation
is expensive as we need to iterate the entire array of top tasks to
find the second top task.
Optimize this by introducing bitmaps for tracking top task indices.
There are two bitmaps; one for the previous window and one for the
current window. Each bit in a bitmap tracks whether the corresponding
bucket in the top task hashmap has a non zero refcount. The bit is set
when the refcount becomes non zero and is cleared when it becomes zero.
Finding the second top task upon migration is then simply a matter of
finding the highest set bit in the bitmap.
Change-Id: Ibafaf66eed756b0328704dfaa89c17ab0d84e359
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Diffstat (limited to 'kernel/sched/sched.h')
| -rw-r--r-- | kernel/sched/sched.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 5cbf374696ee..4fd56b04c336 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -753,6 +753,8 @@ struct rq { u64 nt_curr_runnable_sum; u64 nt_prev_runnable_sum; struct load_subtractions load_subs[NUM_TRACKED_WINDOWS]; + DECLARE_BITMAP_ARRAY(top_tasks_bitmap, + NUM_TRACKED_WINDOWS, NUM_LOAD_INDICES); u8 *top_tasks[NUM_TRACKED_WINDOWS]; u8 curr_table; int prev_top; @@ -1417,6 +1419,7 @@ extern int cpu_upmigrate_discourage_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, u64 upmigrate_discourage); extern void sched_hmp_parse_dt(void); extern void init_sched_hmp_boost_policy(void); +extern void clear_top_tasks_bitmap(unsigned long *bitmap); #else /* CONFIG_SCHED_HMP */ |
