• A
    sched: Fix sched_getaffinity() · 84fba5ec
    Anton Blanchard 提交于
    taskset on 2.6.34-rc3 fails on one of my ppc64 test boxes with
    the following error:
    
      sched_getaffinity(0, 16, 0x10029650030) = -1 EINVAL (Invalid argument)
    
    This box has 128 threads and 16 bytes is enough to cover it.
    
    Commit cd3d8031 (sched:
    sched_getaffinity(): Allow less than NR_CPUS length) is
    comparing this 16 bytes agains nr_cpu_ids.
    
    Fix it by comparing nr_cpu_ids to the number of bits in the
    cpumask we pass in.
    Signed-off-by: NAnton Blanchard <anton@samba.org>
    Reviewed-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Sharyathi Nagesh <sharyath@in.ibm.com>
    Cc: Ulrich Drepper <drepper@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Jack Steiner <steiner@sgi.com>
    Cc: Russ Anderson <rja@sgi.com>
    Cc: Mike Travis <travis@sgi.com>
    LKML-Reference: <20100406070218.GM5594@kryten>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    84fba5ec
sched.c 219.0 KB