From owner-freebsd-hackers Mon Apr 13 07:40:28 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA05018 for freebsd-hackers-outgoing; Mon, 13 Apr 1998 07:40:28 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ocean.campus.luth.se (ocean.campus.luth.se [130.240.194.116]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA04875 for ; Mon, 13 Apr 1998 14:40:14 GMT (envelope-from karpen@ocean.campus.luth.se) Received: (from karpen@localhost) by ocean.campus.luth.se (8.8.8/8.8.8) id QAA03720; Mon, 13 Apr 1998 16:33:41 +0200 (CEST) (envelope-from karpen) From: Mikael Karpberg Message-Id: <199804131433.QAA03720@ocean.campus.luth.se> Subject: Re: Waste space in kernel data structures In-Reply-To: <199804130458.OAA04968@gsms01.alcatel.com.au> from Peter Jeremy at "Apr 13, 98 02:58:09 pm" To: Peter.Jeremy@alcatel.com.au (Peter Jeremy) Date: Mon, 13 Apr 1998 16:33:40 +0200 (CEST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL32 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG According to Peter Jeremy: > I have noticed a couple of cases in the 2.x kernel where data > structures (particularly private device driver structures) have been > laid out without due consideration for alignment requirements - > resulting in assorted padding bytes. In addition, the standard > `boolean' type is a char - which is mostly wasted. > > Has anyone looked at how much kernel memory space is wasted by > compiler padding and felt that it would be worthwhile doing a cleanup? > Has anyone looked at whether the data space that could be saved by > converting boolean flags to a single bit outweighs the speed loss and > possible code bloat? I haven't looked into this, but my guess is it's be a great waste of effort to fix the 'char-boolean' thing. It's very likely to just slow the kernel down for a very very little space gain. If you could compact a VERY common structure with lots of such booleans, and those booleans were used pretty seldom, it's MIGHT be worth it. Rearranging structures that are laid out like "int, char, int, char, int" or something for basically no reason could be worth fixing though, since that will be a win only. I wouldn't think that TOO much space is wasted in that way though. Most people hacking the kernel have at least a small clue about things like this. ;-) /Mikael To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message