<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 9:36 PM, Helge Deller <span dir="ltr"><<a href="mailto:deller@gmx.de" target="_blank">deller@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">...<br>
> +#define _GNU_SOURCE<br>
> +#include <errno.h><br>
> +#include <pthread.h><br>
> +#include <stdio.h><br>
> +#include <stdlib.h><br>
> +#include <sys/mman.h><br>
> +#include <sys/types.h><br>
> +#include <unistd.h><br>
> +<br>
> +#include "test.h"<br>
> +#include "mem.h"<br>
> +#include "hugetlb.h"<br>
> +<br>
> +char *TCID = "hugemmap06";<br>
> +int TST_TOTAL = 5;<br>
> +<br>
> +static long hpage_size;<br>
> +static long hugepages;<br>
> +<br>
> +struct mp {<br>
> +     char *addr;<br>
> +     int sz;<br>
> +};<br>
> +<br>
> +#define ARSZ 50<br>
> +<br>
> +void setup(void)<br>
> +{<br>
> +     tst_require_root();<br>
> +     check_hugepage();<br>
> +<br>
> +     hpage_size = read_meminfo("Hugepagesize:") * 1024;<br>
> +     orig_hugepages = get_sys_tune("nr_hugepages");<br>
> +<br>
> +     hugepages = (ARSZ + 1) * TST_TOTAL;<br>
> +<br>
> +     if (hugepages * read_meminfo("Hugepagesize:") > read_meminfo("MemTotal:"))<br>
> +             tst_brkm(TCONF, NULL, "System RAM is not enough to test.");<br>
<br>
<br>
</div></div>Just a general note:<br>
<br>
What happens on architectures where no hugepages are available?<br>
Maybe you should add a check and return TCONF() in those cases?<br></blockquote><div><br></div><div>thanks for you kind note, the function above  ‘check_hugepage()’ do that work.<br></div><div>you could find details in the include file: /hugetlb/lib/hugetlb.h<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I think this is missing for the other existing hugepage testcases as well...<br>
<span class=""><font color="#888888"><br>
Helge<br>
</font></span><div class=""><div class="h5"><br>
</div></div></blockquote></div><br><br>---<br>Li Wang<br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><br></div></div></div></div></div></div>
</div></div>