mm: thp: Fix condition check for THP creation 71/270671/3
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 7 Feb 2022 07:32:16 +0000 (08:32 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 8 Feb 2022 07:22:29 +0000 (07:22 +0000)
The 'hend' is already THP-aligned, so the proper check should be
exclusive. This fixes forcing 64kB THP pages for the last 2MB of each
process memory area.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I0b2187f1e045bc61207122f0162fdb145214ddad

mm/khugepaged.c

index 297cee0..e76b568 100644 (file)
@@ -2729,7 +2729,7 @@ static unsigned int khugepaged_scan_vma(struct mm_struct *mm,
                BUG();
 
        while (khugepaged_scan.address < hend) {
-               if (khugepaged_scan.address + hpage_size >= hend) {
+               if (khugepaged_scan.address + hpage_size > hend) {
                        if (khugepaged_scan.address + HPAGE_CONT_PTE_SIZE < hend) {
                                hpage_size = HPAGE_CONT_PTE_SIZE;
                                hpage_nr = HPAGE_CONT_PTE_NR;