+190
−29
+1
−2
Loading
The previous code assumed that if a region's first page was huge, the entire region consisted of huge pages and stored this in a large_pages flag. This premise is incorrect not only for movable regions (where pages can be split and merged on invalidate callbacks or page faults), but even for pinned regions: THPs can be split and merged during allocation, so a large, pinned region may contain a mix of huge and regular pages. This change removes the large_pages flag and replaces region-wide assumptions with per-chunk inspection of the actual page size when mapping, unmapping, sharing, and unsharing. This makes huge page handling correct for mixed-page regions and avoids relying on stale metadata that can easily become invalid as memory is remapped. Signed-off-by:Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> Reviewed-by:
Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> Reviewed-by:
Nuno Das Neves <nunodasneves@linux.microsoft.com> Signed-off-by:
Wei Liu <wei.liu@kernel.org>