public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4] hugetlb/hugemmap: add new testcase hugemmap06.c
Date: Tue, 22 Dec 2015 20:01:22 +0100	[thread overview]
Message-ID: <56799E02.20108@gmx.de> (raw)
In-Reply-To: <CAEemH2fHsmU5K3-3Jja112O_1X8MUKUfaNiYZ3j=Nh3XN8_P4A@mail.gmail.com>

On 22.12.2015 03:36, Li Wang wrote:
> Hi,
> 
> On Mon, Dec 21, 2015 at 9:36 PM, Helge Deller <deller@gmx.de <mailto:deller@gmx.de>> wrote:
> 
>     ...
>     > +#define _GNU_SOURCE
>     > +#include <errno.h>
>     > +#include <pthread.h>
>     > +#include <stdio.h>
>     > +#include <stdlib.h>
>     > +#include <sys/mman.h>
>     > +#include <sys/types.h>
>     > +#include <unistd.h>
>     > +
>     > +#include "test.h"
>     > +#include "mem.h"
>     > +#include "hugetlb.h"
>     > +
>     > +char *TCID = "hugemmap06";
>     > +int TST_TOTAL = 5;
>     > +
>     > +static long hpage_size;
>     > +static long hugepages;
>     > +
>     > +struct mp {
>     > +     char *addr;
>     > +     int sz;
>     > +};
>     > +
>     > +#define ARSZ 50
>     > +
>     > +void setup(void)
>     > +{
>     > +     tst_require_root();
>     > +     check_hugepage();
>     > +
>     > +     hpage_size = read_meminfo("Hugepagesize:") * 1024;
>     > +     orig_hugepages = get_sys_tune("nr_hugepages");
>     > +
>     > +     hugepages = (ARSZ + 1) * TST_TOTAL;
>     > +
>     > +     if (hugepages * read_meminfo("Hugepagesize:") > read_meminfo("MemTotal:"))
>     > +             tst_brkm(TCONF, NULL, "System RAM is not enough to test.");
> 
> 
>     Just a general note:
> 
>     What happens on architectures where no hugepages are available?
>     Maybe you should add a check and return TCONF() in those cases?
> 
> 
> thanks for you kind note, the function above  ?check_hugepage()? do that work.
> you could find details in the include file: /hugetlb/lib/hugetlb.h

Ah - great!
I didn't saw that.

Thanks,
Helge




  parent reply	other threads:[~2015-12-22 19:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 11:16 [LTP] [PATCH v4] hugetlb/hugemmap: add new testcase hugemmap06.c Li Wang
2015-12-21 13:36 ` Helge Deller
2015-12-22  2:36   ` Li Wang
2015-12-22  2:42     ` Li Wang
2015-12-22 19:01     ` Helge Deller [this message]
2015-12-22 14:24 ` 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=56799E02.20108@gmx.de \
    --to=deller@gmx.de \
    --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