public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/28991] New: sysconf(_SC_NPROCESSORS_CONF) should read /sys/devices/system/cpu/possible
@ 2022-03-23  0:29 robert at ocallahan dot org
  2022-03-23 11:57 ` [Bug libc/28991] " adhemerval.zanella at linaro dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: robert at ocallahan dot org @ 2022-03-23  0:29 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 28991
           Summary: sysconf(_SC_NPROCESSORS_CONF) should read
                    /sys/devices/system/cpu/possible
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: robert at ocallahan dot org
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Currently on Linux `__get_nprocs_conf` first tries to enumerate
`/sys/devices/system/cpu`. This enumerates the CPUs that are present in the
system (but possibly offline). However, new CPUs can be added via hotplugging
that were not previously enumerated. This is a problem for applications that
want to allocate an array and index it by CPU ID (e.g. the `cpu_id` field of
`struct rseq`). Currently on Linux the only safe way to allocate such an array
is to read `/sys/devices/system/cpu/possible` to determine the array size. Not
many applications are doing that.

Rather than require applications to do that (which is non-portable as well as
being painful), I think it would make more sense to modify `__get_nprocs_conf`
to try reading `/sys/devices/system/cpu/possible` instead of enumerating the
CPUs.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-05-16 17:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23  0:29 [Bug libc/28991] New: sysconf(_SC_NPROCESSORS_CONF) should read /sys/devices/system/cpu/possible robert at ocallahan dot org
2022-03-23 11:57 ` [Bug libc/28991] " adhemerval.zanella at linaro dot org
2022-03-23 12:00 ` adhemerval.zanella at linaro dot org
2022-03-23 12:52 ` schwab@linux-m68k.org
2022-03-23 13:34 ` adhemerval.zanella at linaro dot org
2022-03-23 13:43 ` schwab@linux-m68k.org
2022-03-23 13:48 ` adhemerval.zanella at linaro dot org
2022-03-23 13:49 ` adhemerval.zanella at linaro dot org
2022-03-23 14:11 ` schwab@linux-m68k.org
2022-03-23 14:33 ` adhemerval.zanella at linaro dot org
2022-03-23 14:42 ` schwab@linux-m68k.org
2022-03-23 14:48 ` adhemerval.zanella at linaro dot org
2022-03-23 15:15 ` schwab@linux-m68k.org
2022-03-23 18:43 ` robert at ocallahan dot org
2022-03-23 18:52 ` robert at ocallahan dot org
2022-05-16 17:30 ` adhemerval.zanella at linaro dot org
2022-05-16 17:36 ` adhemerval.zanella at linaro dot org

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).