In particular,
- Move the code to handle failure to allocate page table page into helper
- After the previous item is done, it is possible to distinguish !PG_A case and case of missed page, in the control flow.
- Make the variable to indicate that in-kernel mapping is demoted.
- Assert that missed page table page can only happen for in-kernel mapping when demoting direct map.
- If DIAGNOSTIC is enabled, and the page table page should be already filled, check all ptes instead of only first one.