Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kernel size change



On Thu, 13 Jul 2023, Thomas Klausner wrote:

Here's the complete diff for readelf -We:

--- old	2023-07-13 12:58:51.079219761 +0200
+++ new	2023-07-13 12:58:37.280681398 +0200

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
-  [ 1] .text             PROGBITS        ffffffff80200000 200000 e00000 00  AX  0   0 4096
+  [ 1] .text             PROGBITS        ffffffff80200000 200000 1000000 00  AX  0   0 4096


OK, so it's the `.text' section which has increased from 0xe00000 (14 MB) to
0x1000000 (16 MB). Let's see why. Taking the recent -HEAD kernel and modules:

$ readelf -We netbsd.GENERIC | fgrep '1] .text '
  [ 1] .text             PROGBITS        ffffffff80200000 200000 e00000 00  AX  0   0 4096
$

That's still 14 MB. Let's find out how much of that is actually being used.
Taking all the functions listed in `.symtab' as a proxy,

find out the start address of the 1st kernel func. (should be the same as
the start of `.text'):

$ readelf -Wa netbsd.GENERIC | fgrep -w FUNC | sort -k2,2 | head -n1
 51197: ffffffff80200000   254 FUNC    GLOBAL DEFAULT    1 Xsyscall_svs
$

and the address of the last function in the `.text' section:

$ readelf -Wa netbsd.GENERIC | fgrep -w FUNC | sort -k2,2 | tail -n1
 37171: ffffffff80fe3ce0  2303 FUNC    GLOBAL DEFAULT    1 main
$

Adding 2304 (size of last func. rounded-up to 8 bytes) we get:

$ echo $(( (16#ffffffff80fe3ce0 + 2304) - 16#ffffffff80200000 ))
14566880
$

which is only 110 KB short of 14 MB (0xe00000). Now add the `.text' in the 3
modules which will get added in your custom GENERIC kernel:

$ readelf -We compat_linux.kmod compat_linux32.kmod compat_ossaudio.kmod | fgrep -w '.text '
  [ 1] .text             PROGBITS        0000000000000000 000040 00d9eb 00  AX  0   0 16
  [ 1] .text             PROGBITS        0000000000000000 000040 00a108 00  AX  0   0 16
  [ 1] .text             PROGBITS        0000000000000000 000040 002077 00  AX  0   0 16
$ echo $((16#00d9eb + 16#00a108 + 16#002077))
105322
$

That's ~105 KB.

Now add ~70 KB for your custom font (minus ~20 KB to account for the removal
of the standard ones) to the whole shebang:

$ echo $((14566880 + 105322 + 70000 - 20000))
14722202
$

while is:

$ echo $((14722202 - 16#e00000))
42138
$

~41 KB more than 0xe00000. And, a 41 KB rise between 10.99.4 and 10.99.5 is
not an unreasonable addition. (Moral: It's not only the last straw which
breaks the camel's back, but also all the others which were piled on the
poor beast before.)

HTH.

-RVP


Home | Main Index | Thread Index | Old Index