In case the hard limits are not page-aligned, there is a logical bug in the code that we use more memory than the hard limit specifies. And even when the memory can be committed, the bug prevents the system from moving forward and fail the startup with an error E_OUTOFMEMORY instead.
We should either
- Validate the input so that the hard limit is page aligned, or
- Round down the hard limit to the previous page instead of the next one to avoid using more than the hard limit
- Round up to the next page, but advance the hard limit so that the logic will not fail, or
- In the large page case, simply ignore the hard limit checks.
(4) is good for performance anyway since checking the limit requires taking a lock. (1) might break existing users.