{"push_id":900378005,"size":1,"distinct_size":1,"ref":"refs/heads/m","head":"43f14e894df1909801e23c94966cfc208a896408","before":"09e8f0a7ef179438cc0d1e7732ff1e69e8398d7f","commits":[{"sha":"43f14e894df1909801e23c94966cfc208a896408","author":{"email":"e5b39230c99b4d3ebd6aa54f6d823f95134bc39d@parallels.com","name":"Kirill Tkhai"},"message":"sched: Teach scheduler to understand TASK_ON_RQ_MIGRATING state\n\nThis is a new p->on_rq state which will be used to indicate that a task\nis in a process of migrating between two RQs. It allows to get\nrid of double_rq_lock(), which we used to use to change a rq of\na queued task before.\n\nLet's consider an example. To move a task between src_rq and\ndst_rq we will do the following:\n\n\traw_spin_lock(&src_rq->lock);\n\t/* p is a task which is queued on src_rq */\n\tp = ...;\n\n\tdequeue_task(src_rq, p, 0);\n\tp->on_rq = TASK_ON_RQ_MIGRATING;\n\tset_task_cpu(p, dst_cpu);\n\traw_spin_unlock(&src_rq->lock);\n\n    \t/*\n    \t * Both RQs are unlocked here.\n    \t * Task p is dequeued from src_rq\n    \t * but its on_rq value is not zero.\n    \t */\n\n\traw_spin_lock(&dst_rq->lock);\n\tp->on_rq = TASK_ON_RQ_QUEUED;\n\tenqueue_task(dst_rq, p, 0);\n\traw_spin_unlock(&dst_rq->lock);\n\nWhile p->on_rq is TASK_ON_RQ_MIGRATING, task is considered as\n\"migrating\", and other parallel scheduler actions with it are\nnot available to parallel callers. The parallel caller is\nspining till migration is completed.\n\nThe unavailable actions are changing of cpu affinity, changing\nof priority etc, in other words all the functionality which used\nto require task_rq(p)->lock before (and related to the task).\n\nTo implement TASK_ON_RQ_MIGRATING support we primarily are using\nthe following fact. Most of scheduler users (from which we are\nprotecting a migrating task) use task_rq_lock() and\n__task_rq_lock() to get the lock of task_rq(p). These primitives\nknow that task's cpu may change, and they are spining while the\nlock of the right RQ is not held. We add one more condition into\nthem, so they will be also spinning until the migration is\nfinished.\n\nChange-Id: I2045b3c04d66d73b33280b07c65257f42ac1f1f2\nSigned-off-by: Kirill Tkhai <ktkhai@parallels.com>\nCc: Peter Zijlstra <peterz@infradead.org>\nCc: Paul Turner <pjt@google.com>\nCc: Oleg Nesterov <oleg@redhat.com>\nCc: Steven Rostedt <rostedt@goodmis.org>\nCc: Mike Galbraith <umgwanakikbuti@gmail.com>\nCc: Kirill Tkhai <tkhai@yandex.ru>\nCc: Tim Chen <tim.c.chen@linux.intel.com>\nCc: Nicolas Pitre <nicolas.pitre@linaro.org>\nCc: Linus Torvalds <torvalds@linux-foundation.org>\nLink: http://lkml.kernel.org/r/1408528062.23412.88.camel@tkhai\nSigned-off-by: Ingo Molnar <mingo@kernel.org>","distinct":true,"url":"https://api.github.com/repos/DirtyUnicorns/android_kernel_moto_shamu/commits/43f14e894df1909801e23c94966cfc208a896408"}]}