fix sched_[sg]etaffinity(tid==0, ...) (LTP sched_getaffinity01)
This commit is contained in:
@@ -2009,6 +2009,7 @@ SYSCALL_DECLARE(sched_setaffinity)
|
|||||||
struct process *thread;
|
struct process *thread;
|
||||||
int cpu_id;
|
int cpu_id;
|
||||||
unsigned long irqstate;
|
unsigned long irqstate;
|
||||||
|
extern int num_processors;
|
||||||
|
|
||||||
if (sizeof(k_cpu_set) > len) {
|
if (sizeof(k_cpu_set) > len) {
|
||||||
kprintf("%s:%d\n Too small buffer.", __FILE__, __LINE__);
|
kprintf("%s:%d\n Too small buffer.", __FILE__, __LINE__);
|
||||||
@@ -2023,11 +2024,13 @@ SYSCALL_DECLARE(sched_setaffinity)
|
|||||||
|
|
||||||
// XXX: We should build something like cpu_available_mask in advance
|
// XXX: We should build something like cpu_available_mask in advance
|
||||||
CPU_ZERO(&cpu_set);
|
CPU_ZERO(&cpu_set);
|
||||||
extern int num_processors;
|
|
||||||
for (cpu_id = 0; cpu_id < num_processors; cpu_id++)
|
for (cpu_id = 0; cpu_id < num_processors; cpu_id++)
|
||||||
if (CPU_ISSET(cpu_id, &k_cpu_set))
|
if (CPU_ISSET(cpu_id, &k_cpu_set))
|
||||||
CPU_SET(cpu_id, &cpu_set);
|
CPU_SET(cpu_id, &cpu_set);
|
||||||
|
|
||||||
|
if(tid == 0)
|
||||||
|
tid = cpu_local_var(current)->tid;
|
||||||
|
|
||||||
for (cpu_id = 0; cpu_id < num_processors; cpu_id++) {
|
for (cpu_id = 0; cpu_id < num_processors; cpu_id++) {
|
||||||
irqstate = ihk_mc_spinlock_lock(&get_cpu_local_var(cpu_id)->runq_lock);
|
irqstate = ihk_mc_spinlock_lock(&get_cpu_local_var(cpu_id)->runq_lock);
|
||||||
list_for_each_entry(thread, &get_cpu_local_var(cpu_id)->runq, sched_list)
|
list_for_each_entry(thread, &get_cpu_local_var(cpu_id)->runq, sched_list)
|
||||||
@@ -2064,6 +2067,7 @@ SYSCALL_DECLARE(sched_getaffinity)
|
|||||||
int found = 0;
|
int found = 0;
|
||||||
int i;
|
int i;
|
||||||
unsigned long irqstate;
|
unsigned long irqstate;
|
||||||
|
extern int num_processors;
|
||||||
|
|
||||||
if (sizeof(k_cpu_set) > len) {
|
if (sizeof(k_cpu_set) > len) {
|
||||||
kprintf("%s:%d Too small buffer.\n", __FILE__, __LINE__);
|
kprintf("%s:%d Too small buffer.\n", __FILE__, __LINE__);
|
||||||
@@ -2071,7 +2075,9 @@ SYSCALL_DECLARE(sched_getaffinity)
|
|||||||
}
|
}
|
||||||
len = MIN2(len, sizeof(k_cpu_set));
|
len = MIN2(len, sizeof(k_cpu_set));
|
||||||
|
|
||||||
extern int num_processors;
|
if(tid == 0)
|
||||||
|
tid = cpu_local_var(current)->tid;
|
||||||
|
|
||||||
for (i = 0; i < num_processors && !found; i++) {
|
for (i = 0; i < num_processors && !found; i++) {
|
||||||
struct process *thread;
|
struct process *thread;
|
||||||
irqstate = ihk_mc_spinlock_lock(&get_cpu_local_var(i)->runq_lock);
|
irqstate = ihk_mc_spinlock_lock(&get_cpu_local_var(i)->runq_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user