From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 9 15:43:32 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F20A6440; Tue, 9 Apr 2013 15:43:31 +0000 (UTC) (envelope-from bright@mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id E177A2A2; Tue, 9 Apr 2013 15:43:31 +0000 (UTC) Received: from Alfreds-MacBook-Pro-9.local (c-67-180-208-218.hsd1.ca.comcast.net [67.180.208.218]) by elvis.mu.org (Postfix) with ESMTPSA id 85A061A3C44; Tue, 9 Apr 2013 08:43:25 -0700 (PDT) Message-ID: <51643712.6010609@mu.org> Date: Tue, 09 Apr 2013 08:43:14 -0700 From: Alfred Perlstein User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Adrian Chadd Subject: Re: GSOC 2013 project " Kernel Size Reduction for Embedded System " References: <20130408224423.GA64696@stack.nl> <5163622F.60604@mu.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Amit Rawat , Jilles Tjoelker X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 15:43:32 -0000 On 4/8/13 6:42 PM, Adrian Chadd wrote: > Well, it's relatively easy to experience what it's like. No it's not. We all have jobs that demand different things from us. Taking the time to guess at the problem, only to be told "you're doing it wrong" by someone actually in the position to build the list of requirements is not only a big honking waste of time but not fun nor interesting. Either gather some acceptable feature/performance regressions together that "small" can live with or stop evangelizing. Looking at .o files and guessing what to trim isn't going to work. It sounds like what you want is some magic where you get all the features and your small image while not having to compromise on features/speed. Cool, maybe someone will invent something amazing that gives you less from more, but until then it makes sense to actually be pragmatic and put together a list of things to trim based on sacrifice, not just "because they are big". -Alfred > > Reboot your machine with 32mb. Try to do things like bring up network > interfaces. Snark when stupid stuff occurs, like you can't allocate > enough mbufs for the driver RX path _and_ run the ifconfig command to > completion to bring said interface up. > > There's just a lot of code. You can start by cross-building one of the > MIPS kernels targeting a small system (eg AP121) and look at the > text/data sections of the resulting .o's. Group them together into > subsystems and take a look. > > Now, as for what we can get away with - I'm still going through > another round of review. Yes, there's likely a bunch of syscalls or > syscall behaviours that we just don't need in the embedded world. > Things like all the POSIX compatible fine grained locking? Likely > don't need. But there's some reasonably big areas of bloat that we > could easy hit right now. I've chopped out some of the more silly > abuses in the past (posix acl code that only gets used by ZFS, always > being compiled in? Sigh.) > > Eg: > > text data bss dec hex filename > 59772 160 49184 109116 1aa3c kern_umtx.o > > That's a lot of both code and bss just for mutex handling, don't you > think? Do we really need 59KiB of code and 48KiB of BSS just for mutex > handling? > > text data bss dec hex filename > 184 0 12160 12344 3038 sc_machdep.o > > .. 8 consoles? 12k of BSS? again, not much, but .. > > adrian@lucy:~/work/freebsd/svn/src/sys/cam]> cat > /tmp/AP121-nodebug.txt | egrep 'ata' > text data bss dec hex filename > 11536 0 0 11536 2d10 ata_all.o > 17624 1504 16 19144 4ac8 ata_da.o > 6388 448 16 6852 1ac4 ata_pmp.o > 18960 304 0 19264 4b40 ata_xpt.o > > .. 52 odd KiB tied up in CAM ATA transport, which we don't use unless > the ATA code is compiled in. It's just sitting there, waiting for an > ATA device to come along. > > lucy# cat /tmp/AP121-nodebug.txt | grep "vfs_" | grep -v devfs | sort -k3 > 4160 48 0 4208 1070 vfs_acl.o > 4752 48 0 4800 12c0 vfs_export.o > 5464 0 0 5464 1558 vfs_extattr.o > 8128 288 0 8416 20e0 vfs_default.o > 11020 160 0 11180 2bac vfs_cluster.o > 7916 96 16 8028 1f5c vfs_lookup.o > 19908 144 16 20068 4e64 vfs_vnops.o > 34504 208 16 34728 87a8 vfs_syscalls.o > 3068 64 32 3164 c5c vfs_hash.o > 22700 208 32 22940 599c vfs_mount.o > 1760 144 160 2064 810 vfs_init.o > 14520 16 160 14696 3968 vfs_mountroot.o > 13996 1568 176 15740 3d7c vfs_cache.o > 64852 1680 256 66788 104e4 vfs_subr.o > 52188 2000 304 54492 d4dc vfs_bio.o > > .. 260KiB just for VFS handling. > > etc, etc. > > I'd love to fix this, but I have to make a choice right now between > porting to more of the Atheros wifi/soc platforms, or tackling this > particular issue. I'd love for others to help out here. I'm sure that > reducing code size in general is going be beneficial on the lower end > platforms, even just in cache savings. > > Thanks, > > > Adrian > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >