Subject: meaning of avail_end in uvm_page_physload()
To: None <tech-kern@NetBSD.org>
From: Ben Harris <bjh21@NetBSD.org>
List: tech-kern
Date: 02/20/2006 14:03:05
I think there's a mistake either in the implementation of
uvm_page_physload() or in every caller of it in the tree. After creating
the vm_page object for a page, uvm_page_physload() does this:
if (atop(paddr) >= avail_start &&
atop(paddr) <= avail_end)
uvm_pagefree(&pgs[lcv]);
Similarly, uvm_page_init() does this:
if (atop(paddr) >= vm_physmem[lcv].avail_start &&
atop(paddr) <= vm_physmem[lcv].avail_end) {
uvmexp.npages++;
/* add page to free pool */
uvm_pagefree(&vm_physmem[lcv].pgs[i]);
}
Thus in both cases, "avail_end" is the page number of the last available
page rather than the first unavailable page (which would be more
conventional, and consistent with the "end" argument, which is the number
of the first page above the segment being loaded). Every caller of
uvm_page_physload, though, passes the same value for "end" and
"avail_end", so they clearly think they have the same semantics. Would
anyone object if I made uvm_page_physload behave accordingly (by changing
two <=s to <)?
While I'm there, I'm rather suspicious of only counting initially-free
pages in uvmexp.npages, but I probably ought to leave that for another
time.
--
Ben Harris <bjh21@NetBSD.org>
Portmaster, NetBSD/acorn26 <URL:http://www.NetBSD.org/Ports/acorn26/>