Re: [PATCH -mm 06/21] mm, THP, swap: Support PMD swap mapping when splitting huge PMD

From: Randy Dunlap
Date: Tue Apr 17 2018 - 17:12:47 EST


On 04/16/18 19:02, Huang, Ying wrote:
> From: Huang Ying <ying.huang@xxxxxxxxx>
>
> A huge PMD need to be split when zap a part of the PMD mapping etc.
> If the PMD mapping is a swap mapping, we need to split it too. This
> patch implemented the support for this. This is similar as splitting
> the PMD page mapping, except we need to decrease the PMD swap mapping
> count for the huge swap cluster too. If the PMD swap mapping count
> becomes 0, the huge swap cluster will be split.
>
> Notice: is_huge_zero_pmd() and pmd_page() doesn't work well with swap
> PMD, so pmd_present() check is called before them.

FWIW, I would prefer to see that comment in the source code, not just
in the commit description.

>
> Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Shaohua Li <shli@xxxxxxxxxx>
> Cc: Hugh Dickins <hughd@xxxxxxxxxx>
> Cc: Minchan Kim <minchan@xxxxxxxxxx>
> Cc: Rik van Riel <riel@xxxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
> Cc: Zi Yan <zi.yan@xxxxxxxxxxxxxx>
> ---
> include/linux/swap.h | 6 +++++
> mm/huge_memory.c | 54 ++++++++++++++++++++++++++++++++++++++++----
> mm/swapfile.c | 28 +++++++++++++++++++++++
> 3 files changed, 83 insertions(+), 5 deletions(-)


--
~Randy