home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!torvalds
- From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
- Newsgroups: comp.os.linux
- Subject: Re: root disk vs. mj disk, also hd.c patch
- Message-ID: <1992Aug12.225636.5039@klaava.Helsinki.FI>
- Date: 12 Aug 92 22:56:36 GMT
- References: <1992Aug12.011334.17155@ultb.isc.rit.edu>
- Organization: University of Helsinki
- Lines: 37
-
- In article <1992Aug12.011334.17155@ultb.isc.rit.edu> axi0349@ultb.isc.rit.edu (A.X. Ivasyuk ) writes:
- >
- >
- >First of all, how do you get the executables to be so tiny on the root disk
- >and the mj distribution? I can't get mine under 9K, even a 'hello, world'
- >program. I'd like to be able to squeeze my 80MB drive to the max.
- >It can't be just the -O flag on gcc.
-
- By using shared libraries, and the "-N" flag, and stripping the result
- you can often make trivial binaries that are much less than 9kB. BUT
- they won't demand-load nor share pages, so it's worth it only if the
- binary is truly small. Using "-N" on bigger binaries will result in bad
- performance and memory waste when running it.
-
- > [ Q two deleted ]
- >Third, where is the one-line patch to hd.c (0.97) that everyone has been talking
- >about? I think I missed it on the net. Could someone send it to me, please?
- >(I already applied patch1 and the buffer patch, and it did improve performance
- >noticeably, esp. patch1 - Thanks Linus!!!)
-
- It's not to hd.c but to linux/fs/buffer.c - in the function
- grow_buffers(). 0.97.pl1 has code that looks something like this:
-
- for (i = 0 ; i+size <= 4096 ; i += size) {
- bh = get_unused_buffer_head();
- ....
- - i += size;
- }
-
- As you can see, 'i' is updated twice ('i += size' both inside the
- for-loop and as the terminating expression), resulting in using only
- half the available space in a page for buffers. The fix is to remove
- the line I have marked with a "-". The above simple fix results in much
- better free memory utilization, and a marked improvement in performance
- under some circumstances.
-
- Linus
-