That was what my patch did, plus an attempt to avoid the wbinvd if all accumulated
pages that have pending modifications are contiguous.
The counter gets adjusted regardless of the current attribute in effect, e.g. if you
change a page to PAGE_KERNEL that already happens to be PAGE_KERNEL, the
counter still gets decremented, which in turn may result in reverting the containing
2M/4M page prematurely. Likewise if a not-PAGE_KERNEL gets changed to another
non-PAGE_KERNEL attribute, the counter would get incremented, likely preventing
reverting the large page forever.
Jan
-