Module Name:    src
Committed By:   rin
Date:           Sat Jun 27 01:26:32 UTC 2020

Modified Files:
        src/sys/kern: kern_timeout.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/kern/kern_timeout.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_timeout.c
diff -u src/sys/kern/kern_timeout.c:1.65 src/sys/kern/kern_timeout.c:1.66
--- src/sys/kern/kern_timeout.c:1.65	Tue Jun  2 02:04:35 2020
+++ src/sys/kern/kern_timeout.c	Sat Jun 27 01:26:32 2020
@@ -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 @@ struct callout_cpu {
 
 #ifdef DDB
 static struct callout_cpu ccb;
-static struct cpu_info cib;
 #endif
 
 #ifndef CRASH /* _KERNEL */
@@ -853,15 +852,17 @@ db_show_callout(db_expr_t addr, bool had
 	 * 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]);

Reply via email to