lkml.org 
[lkml]   [2011]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: [RFC][PATCH 18/18] sched: Sort hotplug vs ttwu queueing
    From
    Date
    On Wed, 2011-01-05 at 21:47 +0100, Oleg Nesterov wrote:
    > On 01/04, Peter Zijlstra wrote:
    > >
    > > +#ifdef CONFIG_HOTPLUG_CPU
    > > +static void ttwu_queue_unplug(struct rq *rq)
    > > +{
    > > + struct task_struct *p, *list = xchg(&rq->wake_list, NULL);
    > > + unsigned long flags;
    > > + int cpu;
    > > +
    > > + if (!list)
    > > + return;
    > > +
    > > + while (list) {
    > > + p = list;
    > > + list = list->wake_entry;
    > > +
    > > + raw_spin_lock_irqsave(&p->pi_lock, flags);
    > > + cpu = select_task_rq(p, SD_BALANCE_WAKE, 0);
    > > + set_task_cpu(p, cpu);
    > > + ttwu_queue(p, cpu);
    > > + raw_spin_unlock_irqrestore(&p->pi_lock, flags);
    > > + }
    > > +}
    > > +#endif
    > > +
    > > /**
    > > * try_to_wake_up - wake up a thread
    > > * @p: the thread to be awakened
    > > @@ -6151,6 +6174,11 @@ migration_call(struct notifier_block *nf
    > > migrate_nr_uninterruptible(rq);
    > > calc_global_load_remove(rq);
    > > break;
    > > +
    > > + case CPU_DEAD:
    > > + ttwu_queue_unplug(cpu_rq(cpu));
    >
    > I think this is not strictly needed...
    >
    > Afaics, take_cpu_down() can simply call sched_ttwu_pending() at the
    > start. This will activate the pending tasks on the (almost) dead
    > cpu but we don't care, they will be migrated later.

    At the end, __cpu_disable() is the one clearing all the cpu mask bits.
    So we could call it from CPU_DYING I guess.

    > When __stop_machine(take_cpu_down) returns nobody can use this CPU
    > as a target, iow rq->wake_list can't be used again.

    Right, so something like the below should suffice, I've folded that into
    patch 17.

    ---
    Index: linux-2.6/kernel/sched.c
    ===================================================================
    --- linux-2.6.orig/kernel/sched.c
    +++ linux-2.6/kernel/sched.c
    @@ -6129,6 +6129,7 @@ migration_call(struct notifier_block *nf

    #ifdef CONFIG_HOTPLUG_CPU
    case CPU_DYING:
    + sched_ttwu_pending();
    /* Update our root-domain */
    raw_spin_lock_irqsave(&rq->lock, flags);
    if (rq->rd) {


    \
     
     \ /
      Last update: 2011-01-06 11:59    [W:0.024 / U:93.992 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site