forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sched: make struct sched_statistics independent of fair sched class
If we want to use schedstats facility, we should move out of struct sched_statistics from the struct sched_entity or add it into other sctructs of sched entity as well. Obviously the latter one is bad because that requires more spaces. So we should move it into a common struct which can be used by all sched classes. The struct sched_statistics is the schedular statistics of a task_struct or a task_group. So we can move it into struct task_struct and struct task_group to achieve the goal. Below is the detailed explaination of the change in the structs. - Before this patch struct task_struct { |-> struct sched_entity { ... | ... struct sched_entity *se; ---| struct sched_statistics statistics; struct sched_rt_entity *rt; ... ... ... }; }; struct task_group { |--> se[0]->statistics : schedstats of CPU0 ... | #ifdef CONFIG_FAIR_GROUP_SCHED | struct sched_entity **se; --|--> se[1]->statistics : schedstats of CPU1 | #endif | |--> se[N]->statistics : schedstats of CPUn #ifdef CONFIG_FAIR_GROUP_SCHED struct sched_rt_entity **rt_se; (N/A) #endif ... }; The '**se' in task_group is allocated in the fair sched class, which is hard to be reused by other sched class. - After this patch struct task_struct { ... struct sched_statistics statistics; ... struct sched_entity *se; struct sched_rt_entity *rt; ... }; struct task_group { |---> stats[0] : of CPU0 ... | struct sched_statistics **stats; --|---> stats[1] : of CPU1 ... | |---> stats[n] : of CPUn #ifdef CONFIG_FAIR_GROUP_SCHED struct sched_entity **se; #endif #ifdef CONFIG_RT_GROUP_SCHED struct sched_rt_entity **rt_se; #endif ... }; After the patch it is clearly that both of se or rt_se can easily get the sched_statistics by a task_struct or a task_group. Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
- Loading branch information
1 parent
26dd631
commit a2e8aa5
Showing
9 changed files
with
206 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.