Re: Why does kernel malloc not use kseg0 addresses (i.e. physical pages)?
Glenn Serre <[email protected]> Tue, 9 Apr 2002 08:21:19 -0700 (Pacific Daylight Time)
| Newsgroups | gmane.os.netbsd.ports.mips |
|---|---|
| Message-ID | <Pine.WNT.4.43.0204090809050.1300-100000@murgen> |
Good morning, On 8 Apr 2002 [email protected] wrote: > At Mon, 8 Apr 2002 22:41:42 +0000 (UTC), "Glenn Serre" wrote: > > From a quick look at the kernel malloc code, it appears to me that on mips > > systems, malloc could return addresses in kseg0, rather than virtual > > addresses. Why does malloc use virtual addresses? > > The short answer is 'because it does'. > > > The longer answer includes the points: > [...] > However, it would be no small amount of careful work to undertake... > Since malloc seems to get memory from UVM in chumks that are multiples of page size, a first attempt might se uvm_pagealloc() for page-sized chunks and uvm_pglistalloc() to allocate multiple pages, perhaps falling back to uvm_km_kmemalloc() if uvm_pglistalloc() fails. The fallback might be problematic when it comes time to free the memory, though. If I get something working, I will send a patch for consideration. Thanks! --Glenn S.