From owner-svn-src-head@FreeBSD.ORG Tue Nov 8 15:38:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F7CC106564A; Tue, 8 Nov 2011 15:38:22 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1612C8FC08; Tue, 8 Nov 2011 15:38:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA8FcLBC037639; Tue, 8 Nov 2011 15:38:21 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA8FcLUM037635; Tue, 8 Nov 2011 15:38:21 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201111081538.pA8FcLUM037635@svn.freebsd.org> From: Ed Schouten Date: Tue, 8 Nov 2011 15:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227343 - in head/sys: kern sys tools X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2011 15:38:22 -0000 Author: ed Date: Tue Nov 8 15:38:21 2011 New Revision: 227343 URL: http://svn.freebsd.org/changeset/base/227343 Log: Make kobj_methods constant. These structures hold no information that is modified during runtime. By marking this constant, we see approximately 600 symbols become read-only (amd64 GENERIC). While there, also mark the kobj_method structures generated by makeobjops.awk static. They are only referenced by the kobjop_desc structures within the same file. Before: $ ls -l kernel -rwxr-xr-x 1 ed wheel 15937309 Nov 8 16:29 kernel* $ size kernel text data bss dec hex filename 12260854 1358468 2848832 16468154 fb48ba kernel $ nm kernel | fgrep -c ' r ' 8240 After: $ ls -l kernel -rwxr-xr-x 1 ed wheel 15922469 Nov 8 16:25 kernel* $ size kernel text data bss dec hex filename 12302869 1302660 2848704 16454233 fb1259 kernel $ nm kernel | fgrep -c ' r ' 8838 Modified: head/sys/kern/subr_kobj.c head/sys/sys/kobj.h head/sys/tools/makeobjops.awk Modified: head/sys/kern/subr_kobj.c ============================================================================== --- head/sys/kern/subr_kobj.c Tue Nov 8 15:17:54 2011 (r227342) +++ head/sys/kern/subr_kobj.c Tue Nov 8 15:38:21 2011 (r227343) @@ -92,7 +92,7 @@ SYSINIT(kobj, SI_SUB_LOCK, SI_ORDER_ANY, * desc pointer is NULL, it is guaranteed never to match any read * descriptors. */ -static struct kobj_method null_method = { +static const struct kobj_method null_method = { 0, 0, }; Modified: head/sys/sys/kobj.h ============================================================================== --- head/sys/sys/kobj.h Tue Nov 8 15:17:54 2011 (r227342) +++ head/sys/sys/kobj.h Tue Nov 8 15:38:21 2011 (r227343) @@ -34,7 +34,7 @@ */ typedef struct kobj *kobj_t; typedef struct kobj_class *kobj_class_t; -typedef struct kobj_method kobj_method_t; +typedef const struct kobj_method kobj_method_t; typedef int (*kobjop_t)(void); typedef struct kobj_ops *kobj_ops_t; typedef struct kobjop_desc *kobjop_desc_t; Modified: head/sys/tools/makeobjops.awk ============================================================================== --- head/sys/tools/makeobjops.awk Tue Nov 8 15:17:54 2011 (r227342) +++ head/sys/tools/makeobjops.awk Tue Nov 8 15:38:21 2011 (r227343) @@ -307,7 +307,7 @@ function handle_method (static, doc) line_width, length(prototype))); # Print out the method desc - printc("struct kobj_method " mname "_method_default = {"); + printc("static const struct kobj_method " mname "_method_default = {"); printc("\t&" mname "_desc, (kobjop_t) " default_function); printc("};\n");