[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <46439BBA.2070705@redhat.com>
Date: Thu, 10 May 2007 15:24:58 -0700
From: Ulrich Drepper <drepper@...hat.com>
To: Andi Kleen <ak@...e.de>
CC: Linux Kernel <linux-kernel@...r.kernel.org>
Subject: getcpu after sched_setaffinity
The attached test program fails on a dual core (and probably SMP)
machine on x86-64. Depending on where the thread starts, in one of the
iterations the sched_setffinity() call succeeds but then sched_getcpu()
fails to report the correct CPU.
In set_cpus_allowed migrate_task() is called if the new CPU set does not
include the current CPU. I hope that migrate_task() also works for
p==current.
This leaves the x86-64 vgetcpu() implementation as the weak point. Is
the caching causing problems? Should migrate_task() make sure the cache
is reset?
You need a very recent glibc to compile (glibc-2.5.90-22 in rawhide).
If this is not available replace the sched_getcpu() call. But make sure
you pass a pointer to a cache.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
View attachment "tst-getcpu.c" of type "text/plain" (875 bytes)
Powered by blists - more mailing lists