From: Zwane Mwaikambo kapmd does a conditional check in order to decide whether to set the task's cpu affinity mask. This can change during runtime, therefore we unconditionally set it. There is an early exit in set_cpus_allowed if the current processor is in the allowed mask anyway. 25-akpm/arch/i386/kernel/apm.c | 19 ++++++------------- 1 files changed, 6 insertions(+), 13 deletions(-) diff -puN arch/i386/kernel/apm.c~apm-set_cpus_allowed-fix arch/i386/kernel/apm.c --- 25/arch/i386/kernel/apm.c~apm-set_cpus_allowed-fix Mon May 19 15:34:54 2003 +++ 25-akpm/arch/i386/kernel/apm.c Mon May 19 15:34:54 2003 @@ -512,9 +512,8 @@ static unsigned long apm_save_cpus(void) { unsigned long x = current->cpus_allowed; /* Some bioses don't like being called from CPU != 0 */ - set_cpus_allowed(current, 1 << 0); - if (unlikely(smp_processor_id() != 0)) - BUG(); + set_cpus_allowed(current, 1UL << 0); + BUG_ON(smp_processor_id() != 0); return x; } @@ -914,11 +913,8 @@ static void apm_power_off(void) */ #ifdef CONFIG_SMP /* Some bioses don't like being called from CPU != 0 */ - if (smp_processor_id() != 0) { - set_cpus_allowed(current, 1 << 0); - if (unlikely(smp_processor_id() != 0)) - BUG(); - } + set_cpus_allowed(current, 1UL << 0); + BUG_ON(smp_processor_id() != 0); #endif if (apm_info.realmode_power_off) { @@ -1708,11 +1704,8 @@ static int apm(void *unused) * Some bioses don't like being called from CPU != 0. * Method suggested by Ingo Molnar. */ - if (smp_processor_id() != 0) { - set_cpus_allowed(current, 1 << 0); - if (unlikely(smp_processor_id() != 0)) - BUG(); - } + set_cpus_allowed(current, 1UL << 0); + BUG_ON(smp_processor_id() != 0); #endif if (apm_info.connection_version == 0) { _