This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: What *is* the API for sched_getaffinity? Should sched_getaffinity always succeed when using cpu_set_t?
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: KOSAKI Motohiro <kosaki dot motohiro at gmail dot com>, chrubis at suse dot cz, libc-alpha <libc-alpha at sourceware dot org>
- Date: Fri, 19 Jul 2013 08:26:55 +0400 (MSK)
- Subject: Re: What *is* the API for sched_getaffinity? Should sched_getaffinity always succeed when using cpu_set_t?
- References: <51E42BFE dot 7000301 at redhat dot com> <51E4A0BB dot 2070802 at gmail dot com> <20130716110445 dot GA20826 at rei> <CAHGf_=qxR-abdjwmJUw8vApSioDhKhvsc54Yx-fpw5V-whpioQ at mail dot gmail dot com> <51E5DCB2 dot 1070305 at gmail dot com> <20130717100527 dot GA24881 at rei> <51E6EA7E dot 6050601 at gmail dot com> <20130718110505 dot GA32439 at rei> <51E85763 dot 5090809 at gmail dot com> <51E8691C dot 6040609 at redhat dot com>
On 07/18/2013 05:00 PM, KOSAKI Motohiro wrote:
> > Why application should think the cpus are 8? I mean cpu offlining is typically
> > not short term.
[snip]
On Thu, 18 Jul 2013, Carlos O'Donell wrote:
> The manual is wrong.
>
> You should use _SC_NPROCESSORS_ONLN.
>
> The manual should be fixed.
>
> There is no reason to recommend using configured processors to
> assist in achieving maximum parallelism performance.
Is that really so? IIUC, on ARM, Linux kernel can dynamically bring CPUs
online/offline in response to load as a power saving measure, and for example
if you run 'top' you'll see the reported number of CPUs fluctuate.
So using the number of CPUs that are online *right now* does not seem
appropriate, because on an otherwise idle system a just-started application
will see just one CPU as online.
Alexander