On Wed, Feb 12, 2014 at 10:19:42AM -0800, Andy Lutomirski wrote: > > static void ttwu_queue_remote(struct task_struct *p, int cpu) > > { > > - if (llist_add(&p->wake_entry, &cpu_rq(cpu)->wake_list)) > > - smp_send_reschedule(cpu); > > + struct rq *rq = cpu_rq(cpu); > > + > > + if (llist_add(&p->wake_entry, &rq->wake_list)) { > > + set_tsk_need_resched(rq->idle); > > + smp_mb__after_clear_bit(); > > + if (!tsk_is_polling(rq->idle) || rq->curr != rq->idle) > > + smp_send_reschedule(cpu); > > + } > > At the very least this needs a comment pointing out that rq->lock is > intentionally not taken. This makes my brain hurt a little :)
Oh absolutely; I wanted to write one, but couldn't get a straight story so gave up for now. > > + /* > > + * We must clear polling before running > > sched_ttwu_pending(). > > + * Otherwise it becomes possible to have entries added in > > + * ttwu_queue_remote() and still not get an IPI to process > > + * them. > > + */ > > + __current_clr_polling(); > > + > > + set_preempt_need_resched(); > > + sched_ttwu_pending(); > > + > > tick_nohz_idle_exit(); > > schedule_preempt_disabled(); > > + __current_set_polling(); > > I wonder if this side has enough barriers to make this work. sched_ttwu_pending() does xchg() as first op and thereby orders itself against the clr_polling. I'll need a fresh brain for your proposal.. will read it again in the morning. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/