lkml.org 
[lkml]   [2013]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] kthread: Prevent unpark race which puts threads on the wrong cpu
    On 04/11/2013 03:19 AM, Thomas Gleixner wrote:
    > --- linux-2.6.orig/kernel/smpboot.c
    > +++ linux-2.6/kernel/smpboot.c
    > @@ -185,8 +185,18 @@ __smpboot_create_thread(struct smp_hotpl
    > }
    > get_task_struct(tsk);
    > *per_cpu_ptr(ht->store, cpu) = tsk;
    > - if (ht->create)
    > - ht->create(cpu);
    > + if (ht->create) {
    > + /*
    > + * Make sure that the task has actually scheduled out
    > + * into park position, before calling the create
    > + * callback. At least the migration thread callback
    > + * requires that the task is off the runqueue.
    > + */
    > + if (!wait_task_inactive(tsk, TASK_PARKED))
    > + WARN_ON(1);
    > + else
    > + ht->create(cpu);
    > + }
    > return 0;
    > }

    This one appears to be doing the trick. I'll run the cpus in an
    online/offline loop for a bit and make sure it's stable. It's passed
    several round so far, which is way more than it's done up to this point,
    though.


    \
     
     \ /
      Last update: 2013-04-11 20:41    [W:3.554 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site