public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] move_pages12: Make sure hugepages are available
Date: Tue, 30 May 2017 15:48:25 +0200	[thread overview]
Message-ID: <20170530134825.GB25921@rei.lan> (raw)
In-Reply-To: <555141962.23713496.1496149870415.JavaMail.zimbra@redhat.com>

Hi!
> > > I'm sporadically running into SIGBUS in this testcase, not sure if it's
> > > because of low memory or something else. Do you see it too?
> > 
> > None so far, but I haven't been running the test on anything else than
> > machines with just two numa nodes so far.
> > 
> > > I wonder if we should replace memset with MAP_POPULATE.
> > 
> > Isn't MAP_POPULATE best effort only?
> 
> It's a readahead for file mappings, not sure about anonymous.

See:

http://www.serverphorums.com/read.php?12,1204538,1204539#msg-1204539

As far as I remember the discussion MAP_POPULATE does not work in low
memory condition and mmap() returns without any error.

> As alternative commit [1] gave me idea to try mlock, and that seems
> to work too. If a node doesn't have enough memory I get ENOMEM.
> 
> diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
> index e1d956dba67e..4c7d5c2c01b0 100644
> --- a/testcases/kernel/syscalls/move_pages/move_pages12.c
> +++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
> @@ -165,9 +165,15 @@ static void alloc_free_huge_on_node(unsigned int node, size_t size)
>                 tst_brk(TBROK | TERRNO, "mbind() failed");
>         }
>  
> -       numa_bitmask_free(bm);
> +       TEST(mlock(mem, size));
> +       if (TEST_RETURN) {
> +               SAFE_MUNMAP(mem, size);
> +               if (TEST_ERRNO == ENOMEM || TEST_ERRNO == EAGAIN)
> +                       tst_brk(TCONF, "Cannot lock huge pages");
> +               tst_brk(TBROK | TTERRNO, "mlock failed");
> +       }
>  
> -       memset(mem, 0, size);
> +       numa_bitmask_free(bm);
>  
>         SAFE_MUNMAP(mem, size);
>  }

LGTM.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2017-05-30 13:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 10:07 [LTP] [PATCH v2] move_pages12: Make sure hugepages are available Cyril Hrubis
2017-05-16 12:28 ` Jan Stancek
2017-05-16 13:32   ` Cyril Hrubis
2017-05-16 14:05     ` Jan Stancek
2017-05-16 14:15       ` Cyril Hrubis
2017-05-16 14:15       ` Jan Stancek
2017-05-16 14:29         ` Cyril Hrubis
2017-05-17  8:21           ` Jan Stancek
2017-05-29 13:12           ` Jan Stancek
2017-05-29 13:45             ` Jan Stancek
2017-05-30 11:50             ` Cyril Hrubis
2017-05-30 13:11               ` Jan Stancek
2017-05-30 13:48                 ` Cyril Hrubis [this message]
2017-05-31  7:46                   ` Jan Stancek

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=20170530134825.GB25921@rei.lan \
    --to=chrubis@suse.cz \
    --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