Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Stop allocating struct cpu_info in BSS; No need to ...



details:   https://anonhg.NetBSD.org/src/rev/bcc6c3d1845d
branches:  trunk
changeset: 935170:bcc6c3d1845d
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Jun 27 01:26:32 2020 +0000

description:
Stop allocating struct cpu_info in BSS; No need to db_read_bytes()
against cpu_info, just ci_data.cpu_callout is enough.

Save 1408 bytes of BSS for, e.g., aarch64.

diffstat:

 sys/kern/kern_timeout.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (48 lines):

diff -r 1e97a0b246c5 -r bcc6c3d1845d sys/kern/kern_timeout.c
--- a/sys/kern/kern_timeout.c   Sat Jun 27 00:46:37 2020 +0000
+++ b/sys/kern/kern_timeout.c   Sat Jun 27 01:26:32 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_timeout.c,v 1.65 2020/06/02 02:04:35 rin Exp $    */
+/*     $NetBSD: kern_timeout.c,v 1.66 2020/06/27 01:26:32 rin Exp $    */
 
 /*-
  * Copyright (c) 2003, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.65 2020/06/02 02:04:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_timeout.c,v 1.66 2020/06/27 01:26:32 rin Exp $");
 
 /*
  * Timeouts are kept in a hierarchical timing wheel.  The c_time is the
@@ -184,7 +184,6 @@
 
 #ifdef DDB
 static struct callout_cpu ccb;
-static struct cpu_info cib;
 #endif
 
 #ifndef CRASH /* _KERNEL */
@@ -853,15 +852,17 @@
         * some other CPU was paused while holding the lock.
         */
        for (ci = db_cpu_first(); ci != NULL; ci = db_cpu_next(ci)) {
-               db_read_bytes((db_addr_t)ci, sizeof(cib), (char *)&cib);
-               cc = cib.ci_data.cpu_callout;
+               db_read_bytes((db_addr_t)ci +
+                   offsetof(struct cpu_info, ci_data.cpu_callout),
+                   sizeof(cc), (char *)&cc);
                db_read_bytes((db_addr_t)cc, sizeof(ccb), (char *)&ccb);
                db_show_callout_bucket(&ccb, &cc->cc_todo, &ccb.cc_todo);
        }
        for (b = 0; b < BUCKETS; b++) {
                for (ci = db_cpu_first(); ci != NULL; ci = db_cpu_next(ci)) {
-                       db_read_bytes((db_addr_t)ci, sizeof(cib), (char *)&cib);
-                       cc = cib.ci_data.cpu_callout;
+                       db_read_bytes((db_addr_t)ci +
+                           offsetof(struct cpu_info, ci_data.cpu_callout),
+                           sizeof(cc), (char *)&cc);
                        db_read_bytes((db_addr_t)cc, sizeof(ccb), (char *)&ccb);
                        db_show_callout_bucket(&ccb, &cc->cc_wheel[b],
                            &ccb.cc_wheel[b]);



Home | Main Index | Thread Index | Old Index