lkml.org 
[lkml]   [2014]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Too many rescheduling interrupts (still!)
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.


\
 
 \ /
  Last update: 2014-02-12 22:01    [W:0.511 / U:0.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site