If swap_reserve fails in vm_map_protect, don't return KERN_RESOURCE_SHORTAGE immediately. Instead, let the next loop simplify entries, but nothing else.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
vm_map.c | ||
---|---|---|
2576 ↗ | (On Diff #59008) | Can't we avoid the calls to vm_map_simplify_entry() when rv == KERN_SUCCESS? |
vm_map.c | ||
---|---|---|
2576 ↗ | (On Diff #59008) | I think you mean that you don't want to start simplifying current when If that's what you mean, then, yes, I can change that. |
vm_map.c | ||
---|---|---|
2576 ↗ | (On Diff #59008) | I'm sorry, I missed that we were previously calling vm_map_simplify_entry() at the end of the final loop, so I was confused. Now I think it makes more sense to leave the code as-is: the loop above clips map entries before checking for MAP_ENTRY_GUARD, so we should simplify before checking for MAP_ENTRY_GUARD. |
vm_map.c | ||
---|---|---|
2516 ↗ | (On Diff #59015) | some may BE mergeable. |
vm_map.c | ||
---|---|---|
2515 ↗ | (On Diff #59020) | This line reads as though pages are being copied here, which they are not. |
IMO removing the sentence at all is overreaction, you can say 'will be copied' or use any other syntax construct that indicates that copying could occur in future.
Agreed. You can say, "If too little swap space is available to back the copy-on-write pages that may now be written to, ...
Or, "If swap space can't be reserved to back the copy-on-write pages that may now be written, ..."
vm_map.c | ||
---|---|---|
2520–2524 ↗ | (On Diff #59035) | I've tried to eliminate the repeated content between the two sentences: "Before changing the protections, try to reserve swap space for any private (i.e., copy-on-write) mappings that are transitioning from read-only to read/write access. If a reservation fails, break out of this loop early and let the next loop simplify the entries, since some may now be mergeable. |
2543 ↗ | (On Diff #59035) | Add end = current->end; so that the next loop doesn't bother iterating over entries that this loop never touched. |
2567 ↗ | (On Diff #59035) | Ditto. |
2580 ↗ | (On Diff #59035) | I would move the parenthetical comment to the end. |
2584 ↗ | (On Diff #59035) | This line is indented by one space too many. |
In case of swap reservation failure, I suspect that only the first and last entries in the range will actually be mergeable.