Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/sys Fix bug, the computation of cpuset_nentr...



details:   https://anonhg.NetBSD.org/src/rev/29aa42c35b75
branches:  trunk
changeset: 451239:29aa42c35b75
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat May 11 11:53:55 2019 +0000

description:
Fix bug, the computation of cpuset_nentries was incorrect, we must do +1
to be able to address the last 32 bits.

On a machine with 80 CPUs, this caused "cpuctl identify >64" to return
garbage.

diffstat:

 common/lib/libc/sys/cpuset.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 3a67da2fed42 -r 29aa42c35b75 common/lib/libc/sys/cpuset.c
--- a/common/lib/libc/sys/cpuset.c      Sat May 11 07:44:00 2019 +0000
+++ b/common/lib/libc/sys/cpuset.c      Sat May 11 11:53:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuset.c,v 1.20 2018/07/26 00:13:19 kamil Exp $        */
+/*     $NetBSD: cpuset.c,v 1.21 2019/05/11 11:53:55 maxv Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #ifndef _STANDALONE
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: cpuset.c,v 1.20 2018/07/26 00:13:19 kamil Exp $");
+__RCSID("$NetBSD: cpuset.c,v 1.21 2019/05/11 11:53:55 maxv Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef _LIBC
@@ -54,7 +54,7 @@
 
 #define        CPUSET_SHIFT    5
 #define        CPUSET_MASK     31
-#define CPUSET_NENTRIES(nc)    ((nc) > 32 ? ((nc) >> CPUSET_SHIFT) : 1)
+#define        CPUSET_NENTRIES(nc)     (((nc) >> CPUSET_SHIFT) + 1)
 #ifndef __lint__
 #define CPUSET_SIZE(n) (sizeof( \
        struct {  \



Home | Main Index | Thread Index | Old Index