Firstly, we should return if we fail to get spin lock in cpu_down.
Secondly, in credit scheduler, the idlers need be limited only to
online map.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
int err = 0;
/* spin_trylock() avoids deadlock with stop_machine_run(). */
- if (!spin_trylock(&cpu_add_remove_lock)) {
- err = -EBUSY;
- goto out;
- }
+ if (!spin_trylock(&cpu_add_remove_lock))
+ return -EBUSY;
if (num_online_cpus() == 1) {
err = -EBUSY;
* like run two VCPUs on co-hyperthreads while there are idle cores
* or sockets.
*/
- idlers = csched_priv.idlers;
+ cpus_and(idlers, cpu_online_map, csched_priv.idlers);
cpu_set(cpu, idlers);
cpus_and(cpus, cpus, idlers);
cpu_clear(cpu, cpus);