Simplify flow of pmap_demote_pde_locked() and add more comprehensive
- Move the code to handle failure to allocate page table page into a 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.
Reviewed by: alc, markj
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20266