lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 13 Oct 2021 14:44:25 -0700
From:   Yang Shi <shy828301@...il.com>
To:     Marek Szyprowski <m.szyprowski@...sung.com>
Cc:     Linux MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        김성훈 <sfoon.kim@...sung.com>,
        Song Liu <songliubraving@...com>,
        Rik van Riel <riel@...riel.com>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Hillf Danton <hdanton@...a.com>,
        Hugh Dickins <hughd@...gle.com>,
        William Kucharski <william.kucharski@...cle.com>,
        Oleg Nesterov <oleg@...hat.com>,
        Yang Shi <yang.shi@...ux.alibaba.com>
Subject: Re: [PATCH] mm/thp: decrease nr_thps in file's mapping on THP split

On Tue, Oct 12, 2021 at 5:03 AM Marek Szyprowski
<m.szyprowski@...sung.com> wrote:
>
> Decrease nr_thps counter in file's mapping to ensure that the page cache
> won't be dropped excessively on file write access if page has been
> already splitted.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
> Fixes: 09d91cda0e82 ("mm,thp: avoid writes to file with THP in pagecache")
> Fixes: 06d3eff62d9d ("mm/thp: fix node page state in split_huge_page_to_list()")

Reviewed-by: Yang Shi <shy828301@...il.com>

> ---
> I've analyzed the code a few times but either I missed something or the
> nr_thps counter is not decremented during the THP split on non-shmem file
> pages.
> ---
>  mm/huge_memory.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index ec2bb93f7431..a6c2ba59abcd 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2709,10 +2709,12 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
>                 }
>                 spin_unlock(&ds_queue->split_queue_lock);
>                 if (mapping) {
> -                       if (PageSwapBacked(head))
> +                       if (PageSwapBacked(head)) {
>                                 __dec_node_page_state(head, NR_SHMEM_THPS);
> -                       else
> +                       } else {
>                                 __dec_node_page_state(head, NR_FILE_THPS);
> +                               filemap_nr_thps_dec(mapping);
> +                       }
>                 }
>
>                 __split_huge_page(page, list, end, flags);
> --
> 2.17.1
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ