This change adds an interface for allocating multiple pages
from a reservation. It is meant to be used instead of invoking
vm_reserv_alloc_page in a loop.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 59894 Build 56779: arc lint + arc unit
Event Timeline
sys/vm/vm_reserv.c | ||
---|---|---|
812 | How is it possible for the pages to not be physically contiguous? Don't they always come from a single reservation? |
sys/vm/vm_reserv.c | ||
---|---|---|
812 | You are right, after taking a closer look at the reservation lifecycle I see that this cannot happen. I've corrected the comment. |
sys/vm/vm_reserv.c | ||
---|---|---|
922 | Can this condition actually arise? That would mean that the page is already allocated, which is presumably due to a bug in the caller. | |
924 | If you assume that the returned run of pages is always contiguous, then you don't need to return a pointer to each page. You can simply return a point to the first page in the run, and a count. Then, it's probably profitable to have a variant of vm_reserv_populate() which adjusts the reservation for count pages starting at index, e.g., using bit_nset() rather than a loop. |
sys/vm/vm_reserv.c | ||
---|---|---|
922 | Other than a caller bug or a vm_reserv bug I don't think so. | |
924 | Right, I'll work that assumption into the code. Callers can "unpack" the returned run into individual 0-order pages if need be. |
sys/vm/vm_reserv.c | ||
---|---|---|
922 | It happens due to vm_page_rename()s by, for example, vm_fault(). (I'm incredibly busy this week, when my workload lightens next week, I will elaborate.) |
sys/vm/vm_reserv.c | ||
---|---|---|
922 | Ahh, right, I forgot that it's possible for a page to be allocated from a reservation without belonging to the object that "owns" the reservation. But, in this case I believe we have to terminate the loop, not continue. |
Update diff according to @markj 's suggestion - pages are now allocated using a combination of bit_nset and bit_ffs_at.