diff options
| author | Tejun Heo <tj@kernel.org> | 2016-09-06 12:35:56 -0400 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2016-09-06 12:35:56 -0400 |
| commit | 2536524a91fe5c5a9fddd282fd4e79ee0976aefe (patch) | |
| tree | 30eb5b4cd6d9ed4fda69526537d4fac454cbc5e6 /kernel/sched/core.c | |
| parent | 7d36dd00ab8d57134cce86ad4febc2f5bbdf3e72 (diff) | |
| parent | bc4dee5aa72723632a1f83fd0d3720066c93b433 (diff) | |
| download | linux-2536524a91fe5c5a9fddd282fd4e79ee0976aefe.tar.bz2 | |
Merge branch 'master' into for-4.9
Diffstat (limited to 'kernel/sched/core.c')
| -rw-r--r-- | kernel/sched/core.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5c883fe8e440..2a906f20fba7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -74,6 +74,7 @@ #include <linux/context_tracking.h> #include <linux/compiler.h> #include <linux/frame.h> +#include <linux/prefetch.h> #include <asm/switch_to.h> #include <asm/tlb.h> @@ -2972,6 +2973,23 @@ EXPORT_PER_CPU_SYMBOL(kstat); EXPORT_PER_CPU_SYMBOL(kernel_cpustat); /* + * The function fair_sched_class.update_curr accesses the struct curr + * and its field curr->exec_start; when called from task_sched_runtime(), + * we observe a high rate of cache misses in practice. + * Prefetching this data results in improved performance. + */ +static inline void prefetch_curr_exec_start(struct task_struct *p) +{ +#ifdef CONFIG_FAIR_GROUP_SCHED + struct sched_entity *curr = (&p->se)->cfs_rq->curr; +#else + struct sched_entity *curr = (&task_rq(p)->cfs)->curr; +#endif + prefetch(curr); + prefetch(&curr->exec_start); +} + +/* * Return accounted runtime for the task. * In case the task is currently running, return the runtime plus current's * pending runtime that have not been accounted yet. @@ -3005,6 +3023,7 @@ unsigned long long task_sched_runtime(struct task_struct *p) * thread, breaking clock_gettime(). */ if (task_current(rq, p) && task_on_rq_queued(p)) { + prefetch_curr_exec_start(p); update_rq_clock(rq); p->sched_class->update_curr(rq); } |