Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1265656
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once |
| Date | 2015-11-09 14:30 +0100 |
| Message-ID | <qsUGe-6X1-13@gated-at.bofh.it> (permalink) |
| References | <qmNep-6xZ-1@gated-at.bofh.it> <qmNeq-6xZ-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat, Oct 24, 2015 at 01:16:21AM +0900, byungchul.park@lge.com wrote:
> +++ b/kernel/sched/core.c
> @@ -1264,6 +1264,8 @@ EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
>
> void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
> {
> + unsigned int prev_cpu = task_cpu(p);
> +
> #ifdef CONFIG_SCHED_DEBUG
> /*
> * We should never call set_task_cpu() on a blocked task,
> @@ -1289,15 +1291,14 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
> #endif
>
> trace_sched_migrate_task(p, new_cpu);
> + __set_task_cpu(p, new_cpu);
>
> - if (task_cpu(p) != new_cpu) {
> + if (prev_cpu != new_cpu) {
> if (p->sched_class->migrate_task_rq)
> - p->sched_class->migrate_task_rq(p, new_cpu);
> + p->sched_class->migrate_task_rq(p, prev_cpu);
> p->se.nr_migrations++;
> perf_event_task_migrate(p);
> }
> -
> - __set_task_cpu(p, new_cpu);
> }
I don't think this is safe, see the comment in __set_task_cpu(). We want
that to be last.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-09 14:30 +0100
Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-10 02:20 +0100
Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-10 13:20 +0100
Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-11 01:00 +0100
Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-11 11:20 +0100
csiph-web