Re: Free vs Unused pages?

Linus Torvalds (torvalds@transmeta.com)
Tue, 26 Aug 1997 09:53:23 -0700 (PDT)


On Tue, 26 Aug 1997, Mark Hemment wrote:
>
> Perhaps, when you are looking at this code, you could confirm that the
> memory allocated to the bitmaps (free_area_init()) is twice the memory
> required....

Be careful, though - I used to calculate it exactly correctly, and I had
an off-by-one error somewhere, which resulted in some _extremely_ nasty
behaviour with non-power-of-two memory sizes (and it took months to find).

I know we are allocating too much, but you'd better make _sure_ that it
works even for odd memory sizes before you send me patches. As it
currently uses one _bit_ too much per physical page, I'm not really all
that worried about wasting it. It's actually fractionally less than one
bit per page: it's half a bit per page for the first-level bitmap (one bit
per two pages), and then 1/4, 1/8.. 1/32 bits..

Saving one bit per page of physical memory is not worth the headache for
me to go through patches and prove that it is correct. So any patch had
better be so obviously correct that I don't have to worry about it.

[ Mark, I hope that explains why I ignored your patch - I seem to remember
you sending a patch for this maybe a year ago or so.. ]

Linus