Subject: saving string space in kernels [was: CVS commit: syssrc]
To: None <enami@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 12/14/2000 00:04:41
enami tsugutomo wrote:

> Module Name:	syssrc
> Committed By:	enami
> Date:		Wed Dec 13 08:06:12 UTC 2000
> 
> Modified Files:
> 
> 	syssrc/sys/uvm: uvm_map.c uvm_map.h
> 
> Log Message:
> 
> Use single const char array instead of over 200 string constant.

How far should we take this?  Looking at my 1.5 alpha kernel with
RaidFrame I see some obvious ones:

thoreau:~ 15643> strings /netbsd | grep 'vm_map_lock_read: intrsafe map' | wc
      29      87     899
thoreau:~ 15644> strings /netbsd | grep 'vmmapbsy' | wc
     283     283    2568
thoreau:~ 15645> strings /netbsd | grep 'vm_map_lock: failed to get lock' | wc
     283    1415    9056
thoreau:~ 15646> strings /netbsd | grep '%s 0x%lx not aligned to %lu bytes' | wc
      38     304    1521
thoreau:~ 15647> strings /netbsd | grep '^bus addr$' | wc    
      38      76     342
thoreau:~ 15648> strings /netbsd | grep 'raidframe error at line %d file %s$' | wc
      18     126     630
thoreau:~ 15649> strings /netbsd | grep 'raidframe error at line %d file %s ' | wc
      44     440    2508

i386 has some other large usages as well:

euclid:~ 81> strings /netbsd | grep 'va >= (PDSLOT_KERN << PDSHIFT)' | wc
     263    1315    8153
euclid:~ 82> strings /netbsd | grep 'va < (PDSLOT_KERN << PDSHIFT)' | wc
     263    1315    7890
euclid:~ 83> strings /netbsd | grep '^diagnostic $' | wc
     271     271    3252

These would not be insignificant space savings...

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Sales, Support and Service:  http://www.wasabisystems.com/