[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4612D175.30604@redhat.com>
Date: Tue, 03 Apr 2007 15:13:09 -0700
From: Ulrich Drepper <drepper@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: getting processor numbers
Andrew Morton wrote:
> Did we mean to go off-list?
Oops, no, pressed the wrong button.
>> Andrew Morton wrote:
>>> So I'd have thought that in general an application should be querying its
>>> present affinity mask - something like sched_getaffinity()? That fixes the
>>> CPU hotplug issues too, of course.
>> Does it really?
>>
>> My recollection is that the affinity masks of running processes is not
>> updated on hotplugging. Is this addressed?
>
> ah, yes, you're correct.
>
> Inside a cpuset:
>
> sched_setaffinity() is constrained to those CPUs which are in the
> cpuset.
>
> If a cpu if on/offlined we update each cpuset's cpu mask appropriately
> but we do not update all the tasks presently running in the cpuset.
>
> Outside a cpuset:
>
> sched_setaffinity() is constrained to all possible cpus
>
> We don't update each task's cpus_allowed when a CPU is removed.
>
>
> I think we trivially _could_ update each tasks's cpus_allowed mask when a
> CPU is removed, actually.
I think it has to be done. But that's not so trivial. What happens if
all the CPUs a process was supposed to be runnable on vanish.
Shouldn't, if no affinity mask is defined, new processors be added? I
agree that if the process has a defined affinity mask no new processors
should be added _automatically_.
>> If yes, sched_getaffinity is a solution until the NUMA topology
>> framework can provide something better. Even without a popcnt
>> instruction in the CPU (64-bit albeit) it's twice as fast as the the
>> stat() method proposed.
>
> I'm surprised - I'd have expected sched_getaffinity() to be vastly quicker
> that doing fileystem operations.
You mean because it's only a factor of two? Well, it's not once you
count the whole overhead.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
Download attachment "signature.asc" of type "application/pgp-signature" (252 bytes)
Powered by blists - more mailing lists