Function vm_page_acquire_unlocked both looks up pages and validates them. Much of it serves the needs of only one caller, vm_page_grab_pages_unlocked. Extract from that function the parts that serve vm_page_grab_pages_unlocked, and move them into that function.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/vm/vm_page.c | ||
---|---|---|
4834 | I think it is more natural to put spinwait() into the loop body, i.e. in the 'case VMPV_RETRY' switch label. It is strange to see this in the code that does not loop. | |
5013 | All three loops are only different by the return statement, am I right? Then might be, introduce a helper function that returns bool to indicate success/failure, and takes vm_page_t *mp, to return m? The function would handle the looping: static bool vm_page_lookup_validate(vm_page_t *mp, pindex, flags) { while ((m = vm_page_lookup_unlocked(object, pindex)) != NULL) { switch (vm_page_validate(object, pindex, m, flags)) { case VMPV_SUCCESS: *mp = m; return (true); case VMPV_RETRY: continue; case VMPV_FAILURE: return (false); } *mp = NULL; return (true); } |
Comment Actions
Restore the name vm_page_acquire_unlocked and have it do the looping. Drop the enums.