Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 1998 16:33:40 +0200 (CEST)
From:      Mikael Karpberg <karpen@ocean.campus.luth.se>
To:        Peter.Jeremy@alcatel.com.au (Peter Jeremy)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Waste space in kernel data structures
Message-ID:  <199804131433.QAA03720@ocean.campus.luth.se>
In-Reply-To: <199804130458.OAA04968@gsms01.alcatel.com.au> from Peter Jeremy at "Apr 13, 98 02:58:09 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804131433.QAA03720>