public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwan@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] hugeshmat04: don't attach at specific address
Date: Wed, 22 Sep 2021 16:29:11 +0200	[thread overview]
Message-ID: <YUs9tz0wjk2LJiAL@yuki> (raw)
In-Reply-To: <CAEemH2dQ7NyWSoSwEcyeug6phJKja5=affWzWxt0fQLvHrtODw@mail.gmail.com>

Hi!
> > The test intermittently fails on ppc64le, when heap
> > happens to overlap with segment that the test is trying
> > to attach at 1GB boundary.
> >
> > Let the kernel find suitable address.
> >
> 
> I'm not sure why the original way uses fixed address, but
> it should be fine to cancel that limitation.

It seems to be regression test for:

commit c5c99429fa57dcf6e05203ebe3676db1ec646793
Author: Larry Woodman <lwoodman@redhat.com>
Date:   Thu Jan 24 05:49:25 2008 -0800

    fix hugepages leak due to pagetable page sharing

    The shared page table code for hugetlb memory on x86 and x86_64
    is causing a leak.  When a user of hugepages exits using this code
    the system leaks some of the hugepages.

    -------------------------------------------------------
    Part of /proc/meminfo just before database startup:
    HugePages_Total:  5500
    HugePages_Free:   5500
    HugePages_Rsvd:      0
    Hugepagesize:     2048 kB

    Just before shutdown:
    HugePages_Total:  5500
    HugePages_Free:   4475
    HugePages_Rsvd:      0
    Hugepagesize:     2048 kB

    After shutdown:
    HugePages_Total:  5500
    HugePages_Free:   4988
    HugePages_Rsvd:
    0 Hugepagesize:     2048 kB
    ----------------------------------------------------------

    The problem occurs durring a fork, in copy_hugetlb_page_range().  It
    locates the dst_pte using huge_pte_alloc().  Since huge_pte_alloc() calls
    huge_pmd_share() it will share the pmd page if can, yet the main loop in
    copy_hugetlb_page_range() does a get_page() on every hugepage.  This is a
    violation of the shared hugepmd pagetable protocol and creates additional
    referenced to the hugepages causing a leak when the unmap of the VMA
    occurs.  We can skip the entire replication of the ptes when the hugepage
    pagetables are shared.  The attached patch skips copying the ptes and the
    get_page() calls if the hugetlbpage pagetable is shared.


As far as I can tell there is no reason to allocate the memory on a
fixed address to trigger this bug but it should be easy enough to check
if the test fails on a kernel that has the two lines this patch adds
commented before and after the change it test.

Also can we pretty please add the commit hash to the test metadata?

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2021-09-22 14:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 16:45 [LTP] [PATCH] hugeshmat04: don't attach at specific address Jan Stancek
2021-09-22  6:34 ` Li Wang
2021-09-22 14:29   ` Cyril Hrubis [this message]
2021-09-23  6:49     ` Li Wang
2021-09-23  8:50 ` [LTP] [PATCH v2] hugeshmat04: try to find unmapped range for test Jan Stancek
2021-09-23  9:04   ` Li Wang
2021-09-23  9:07   ` Cyril Hrubis
2021-09-24  3:15     ` Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YUs9tz0wjk2LJiAL@yuki \
    --to=chrubis@suse.cz \
    --cc=liwan@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox