public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/28865] linux: _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN are inaccurate without /sys and /proc
Date: Tue, 08 Feb 2022 22:34:09 +0000	[thread overview]
Message-ID: <bug-28865-131-2o13H8UHw8@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28865-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28865

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The release/2.35/master branch has been updated by Dmitry Levin
<ldv@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=491f2ef1f0ff849490f374917957018d07ee0586

commit 491f2ef1f0ff849490f374917957018d07ee0586
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Sat Feb 5 08:00:00 2022 +0000

    linux: fix accuracy of get_nprocs and get_nprocs_conf [BZ #28865]

    get_nprocs() and get_nprocs_conf() use various methods to obtain an
    accurate number of processors.  Re-introduce __get_nprocs_sched() as
    a source of information, and fix the order in which these methods are
    used to return the most accurate information.  The primary source of
    information used in both functions remains unchanged.

    This also changes __get_nprocs_sched() error return value from 2 to 0,
    but all its users are already prepared to handle that.

    Old fallback order:
      get_nprocs:
        /sys/devices/system/cpu/online -> /proc/stat -> 2
      get_nprocs_conf:
        /sys/devices/system/cpu/ -> /proc/stat -> 2

    New fallback order:
      get_nprocs:
        /sys/devices/system/cpu/online -> /proc/stat -> sched_getaffinity -> 2
      get_nprocs_conf:
        /sys/devices/system/cpu/ -> /proc/stat -> sched_getaffinity -> 2

    Fixes: 342298278e ("linux: Revert the use of sched_getaffinity on
get_nproc")
    Closes: BZ #28865
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

    (cherry picked from commit e1d32b836410767270a3adf1f82b1a47e6e4cd51)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

      parent reply	other threads:[~2022-02-08 22:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 19:43 [Bug libc/28865] New: " ldv at sourceware dot org
2022-02-08 22:24 ` [Bug libc/28865] " cvs-commit at gcc dot gnu.org
2022-02-08 22:27 ` ldv at sourceware dot org
2022-02-08 22:34 ` cvs-commit at gcc dot gnu.org
2022-02-08 22:34 ` cvs-commit at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28865-131-2o13H8UHw8@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).