Commit 8f309a3f authored by William Lee Irwin III's avatar William Lee Irwin III Committed by Linus Torvalds

[PATCH] Fix CPU bitmask truncation

Fix task->cpus_allowed bitmask truncations on 64.bit architectures.

Originally by Bjorn Helgaas for 2.4.x.
parent c2e95c3f
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
.prio = MAX_PRIO-20, \ .prio = MAX_PRIO-20, \
.static_prio = MAX_PRIO-20, \ .static_prio = MAX_PRIO-20, \
.policy = SCHED_NORMAL, \ .policy = SCHED_NORMAL, \
.cpus_allowed = -1, \ .cpus_allowed = ~0UL, \
.mm = NULL, \ .mm = NULL, \
.active_mm = &init_mm, \ .active_mm = &init_mm, \
.run_list = LIST_HEAD_INIT(tsk.run_list), \ .run_list = LIST_HEAD_INIT(tsk.run_list), \
......
...@@ -210,7 +210,7 @@ static int stopref(void *cpu) ...@@ -210,7 +210,7 @@ static int stopref(void *cpu)
struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
setscheduler(current->pid, SCHED_FIFO, &param); setscheduler(current->pid, SCHED_FIFO, &param);
#endif #endif
set_cpus_allowed(current, 1 << (unsigned long)cpu); set_cpus_allowed(current, 1UL << (unsigned long)cpu);
/* Ack: we are alive */ /* Ack: we are alive */
atomic_inc(&stopref_thread_ack); atomic_inc(&stopref_thread_ack);
...@@ -271,7 +271,7 @@ static int stop_refcounts(void) ...@@ -271,7 +271,7 @@ static int stop_refcounts(void)
/* FIXME: racy with set_cpus_allowed. */ /* FIXME: racy with set_cpus_allowed. */
old_allowed = current->cpus_allowed; old_allowed = current->cpus_allowed;
set_cpus_allowed(current, 1 << (unsigned long)cpu); set_cpus_allowed(current, 1UL << (unsigned long)cpu);
atomic_set(&stopref_thread_ack, 0); atomic_set(&stopref_thread_ack, 0);
stopref_num_threads = 0; stopref_num_threads = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment