Subject: Re: duplicated code in machdep.c
To: Paul Kranenburg <>
From: Chris G. Demetriou <>
List: tech-kern
Date: 11/14/1997 15:55:18
> Except for the buffer cache allocation -- which varies a bit among ports --
> all the other seem very straightforward candidates for moving into
> initialization functions located within their respective "implementation"
> modules. Those initialization routines would just call malloc() to
> get the memory.
> Ok, so this might waste a small amount of memory -- because of
> fragmentation in the malloc pools -- compared to the machdep's
> `valloc()' method, but I don't think that's really worth much concern.
> Any ports with special needs here?

There's more waste than that.  vm page structures for those pages, any
other related VM overhead, etc.

It also is wasteful on any ports which use a direct-mapped segment or
superpage for mapping of kernel text & data.  On both the mips and the
alpha, these data structures are typically allocated and mapped in the
direct-mapped segment.  On the other hand, normal KVM is mapped
through TLB entries.  That means that you thrash your TLB entry cache
more if you put data structures in normal kernel virtual memory.

In general, the more data structures you can allocate in direct-mapped
segments, the better off you are.  Unless you provide ways for
machines to do this, I'd strongly object to changes like the ones you