NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/38169: Simplifcation for running LWP migration

The following reply was made to PR kern/38169; it has been noted by GNATS.

From: Andrew Doran <>
Subject: Re: kern/38169: Simplifcation for running LWP migration
Date: Sun, 18 May 2008 14:49:03 +0100

 I think the approach described in the PR could be even simpler:
 - Maintain a pointer to an LWP in schedstate_percpu that denotes an LWP that  
   the CPU is working on forcibly migrating (spc_migrating).
 - Add to the meaning of the LSRUN state so that it also means an LWP could
   be noted in l->l_cpu->ci_schedstate.spc_migrating, instead of residing on
   that CPU's run queue.
 - Adjust sched_enqueue() and sched_dequeue() to account for spc_migrating.
   The changes should be fairly minor. It may be possible to adjust dequeue()
   only, as spc_migrating would only need to be set by an ONPROC LWP when
   travelling through mi_switch().
 - In sched_nextlwp(), return NULL if curcpu()->ci_schedstate.spc_migrating
   is non-NULL (a forced migration is in progress). Returning NULL here would
   force a switch to the idle loop.
 - In the idle loop, before other processing, examine spc_migrating. If it's
   non-NULL, do a double locking dance and try to migrate the LWP onto the
   CPU pointed by l_target_cpu. Then proceed as normal, looking for more jobs   
   to run.

Home | Main Index | Thread Index | Old Index