The BeleniX LiveCD Performance Story Part 2
Almost complete Non-DEBUG OpenSolaris builds. Having a DEBUG only OpenSolaris is one bit of a headache. It runs a little slower and the binaries are bigger. Who would want to use a DEBUG kernel for normal use. I say an almost complete Non-DEBUG because the closed binaries are still DEBUG versions and we cannot change that fact.
As a result of the closed binaries being DEBUG there are some special dependencies that need to be handled. Here are the steps I took to get a Non-DEBUG OpenSolaris build:
Remove "-F" and "-D" from the NIGHTLY_OPTIONS in opensolaris.sh
The ata driver in build 34 was closed source so it depended on a variable "simulator_run" that is defined in two places if the "_SIMULATOR_SUPPORT" flag is #define-ed. Thus I modified usr/src/uts/i86pc/Makefile.i86pc.shared and usr/src/uts/intel/Makefile.i86pc.shared to add "CFLAGS += $(SIMULATOR)". This enables the variable to be set to 0 and ata loads successfully.
Subsequently I found that audiovia823x will not load complaining about missing symbols. I found a bunch of code and dependencies in the DEBUG code. So I ended up building the entire audiosup framework in DEBUG mode. I added "CFLAGS += -DDEBUG" in usr/src/uts/intel/audiosup/Makefile. But I guess this is a suboptimal configuration so I will be investigating alternatives later. One option is t replace the audiovia823x module with a freeware version from Juergen Keil's audio drivers.
Changed the dependency of the xserver service that auto-configures Xorg and brings up the GUI desktops. Previously the xserver service used to run concurrently with the startup of inetd (among other services). Now inetd is a heavy hitter loading a variety of stuff from the CD. Xorg -configure has to load numerous modules from CD. Combined these two create heavy contention for CDROM access. In 0.4.2 I made inetd a dependency of xserver so now xserver will wait for inetd to initialize. This is actually chopped almost 10 seconds from the boottime. In addition it is logical to have this dependency as inetd is required for KDE and Xfce.
Modified various SMF scripts to improve service startup time. For eg some of the networking scripts like net-init, net-svc etc do a lot of processing much of which is redundant in a LiveCD environment. Thus they are conditionally skipped. Setting the hostname is also simplified. There is no need to execute smf_netstrategy here.
Increased the Compression segment size to 128KB. This gives twofold benefit. It improved compression ratio and I got 10MB more of diskspace. In addition combined with another change it allowed making library preloading more efficient. Previously while preloading libraries, the pagein utility used to mmap and then touch every page. This causes double-caching and also causes the same compression segment to be decompressed several times to get one page at a time. Instead I have modified the pagein utility to touch just one page in every 128K segment. This causes just one page to be double cached and the segment decompressed just once during preloading. Since a page size is 8K it results in just 6% of the total data to be double cached making preloading more effective in RAM constrained machines. The pagein utility also completes much quicker saving several seconds of boottime.