The patch titled Subject: mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving has been added to the -mm tree. Its filename is mm-thp-dont-count-zone_movable-as-the-target-for-freepage-reserving.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-thp-dont-count-zone_movable-as-the-target-for-freepage-reserving.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-thp-dont-count-zone_movable-as-the-target-for-freepage-reserving.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Subject: mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving There was a regression report for "mm/cma: manage the memory of the CMA area by using the ZONE_MOVABLE" (lkml.kernel.org/r/20180102063528.GG30397%20()%20yexl-desktop) and I think that it is related to this problem. CMA patchset makes the system use one more zone (ZONE_MOVABLE) and then increases min_free_kbytes. It reduces usable memory and it could cause regression. ZONE_MOVABLE only has movable pages so we don't need to keep enough freepages to avoid or deal with fragmentation. So, don't count it. This changes min_free_kbytes and thus min_watermark greatly if ZONE_MOVABLE is used. It will make the user uses more memory. o System 22GB ram, fakenuma, 2 nodes. 5 zones are used. o Before min_free_kbytes: 112640 zone_info (min_watermark): Node 0, zone DMA min 19 Node 0, zone DMA32 min 3778 Node 0, zone Normal min 10191 Node 0, zone Movable min 0 Node 0, zone Device min 0 Node 1, zone DMA min 0 Node 1, zone DMA32 min 0 Node 1, zone Normal min 14043 Node 1, zone Movable min 127 Node 1, zone Device min 0 o After min_free_kbytes: 90112 zone_info (min_watermark): Node 0, zone DMA min 15 Node 0, zone DMA32 min 3022 Node 0, zone Normal min 8152 Node 0, zone Movable min 0 Node 0, zone Device min 0 Node 1, zone DMA min 0 Node 1, zone DMA32 min 0 Node 1, zone Normal min 11234 Node 1, zone Movable min 102 Node 1, zone Device min 0 Link: http://lkml.kernel.org/r/1522913236-15776-1-git-send-email-iamjoonsoo.kim@xxxxxxx Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: "Kirill A . Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff -puN mm/khugepaged.c~mm-thp-dont-count-zone_movable-as-the-target-for-freepage-reserving mm/khugepaged.c --- a/mm/khugepaged.c~mm-thp-dont-count-zone_movable-as-the-target-for-freepage-reserving +++ a/mm/khugepaged.c @@ -1879,8 +1879,16 @@ static void set_recommended_min_free_kby int nr_zones = 0; unsigned long recommended_min; - for_each_populated_zone(zone) + for_each_populated_zone(zone) { + /* + * We don't need to worry about fragmentation of + * ZONE_MOVABLE since it only has movable pages. + */ + if (zone_idx(zone) > gfp_zone(GFP_USER)) + continue; + nr_zones++; + } /* Ensure 2 pageblocks are free to assist fragmentation avoidance */ recommended_min = pageblock_nr_pages * nr_zones * 2; _ Patches currently in -mm which might be from iamjoonsoo.kim@xxxxxxx are mm-page_alloc-dont-reserve-zone_highmem-for-zone_movable-request.patch mm-cma-manage-the-memory-of-the-cma-area-by-using-the-zone_movable.patch mm-cma-remove-alloc_cma.patch arm-cma-avoid-double-mapping-to-the-cma-area-if-config_highmem-=-y.patch mm-thp-dont-count-zone_movable-as-the-target-for-freepage-reserving.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html