Skip to content

Commit f1ea763

Browse files
Zeph / Liz Loss-Cutler-Hullmchehab
authored andcommitted
Check CPUs online, not configured.
When the number of CPUs detected is greater than the number of CPUs in the system, rasdaemon will crash when it receives some events. Looking deeper, we also fail to use the poll method for similar reasons in this case. All of this can be prevented by checking to see how many CPUs are currently online (sysconf(_SC_NPROCESSORS_ONLN)) instead of how many CPUs the current kernel was configured to support (sysconf(_SC_NPROCESSORS_CONF)). For the kernel side of the discussion, see https://lore.kernel.org/lkml/CAM6Wdxft33zLeeXHhmNX5jyJtfGTLiwkQSApc=10fqf+rQh9DA@mail.gmail.com/T/ Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent f63b4c9 commit f1ea763

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ras-events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static void parse_ras_data(struct pthread_data *pdata, struct kbuffer *kbuf,
350350

351351
static int get_num_cpus(struct ras_events *ras)
352352
{
353-
return sysconf(_SC_NPROCESSORS_CONF);
353+
return sysconf(_SC_NPROCESSORS_ONLN);
354354
#if 0
355355
char fname[MAX_PATH + 1];
356356
int num_cpus = 0;

0 commit comments

Comments
 (0)