<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 16, 2015 at 5:01 PM, Li Wang <span dir="ltr"><<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</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 dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Nov 16, 2015 at 3:37 PM, Wanlong Gao <span dir="ltr"><<a href="mailto:wanlong.gao@gmail.com" target="_blank">wanlong.gao@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><span>On Mon, Nov 16, 2015 at 02:00:52PM +0800, Li Wang wrote:<br>
><br></span><span>
> In my test system, there exist file "/proc/sys/vm/nr_hugepages" with normal<br>
> permission, but reject any R/W operation.<br>
><br>
> So, if I use if (access(PATH_NR_HUGEPAGES, F_OK) == -1), It doesn't work.<br>
><br>
> # ll /proc/sys/vm/nr_hugepages<br>
> -rw-r--r--. 1 root root 0 Nov 15 09:03 /proc/sys/vm/nr_hugepages<br>
><br>
> # cat /proc/sys/vm/nr_hugepages<br>
> cat: write error: Bad address<br>
<br>
</span></div></div><span>Would you show your kernel version or investigate why this happens?<br>
This should not exist if we disable the hugetlbfs in kernel config.<br></span></blockquote><div><br></div><div>I looked close to my test bed, it is a KVM Guest which enabled hugetlbfs on IBM POWER8E,<br><br></div><div>the config is:<br>CONFIG_CGROUP_HUGETLB=y<br>CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y<br>CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y<br>CONFIG_SYS_SUPPORTS_HUGETLBFS=y<br>CONFIG_TRANSPARENT_HUGEPAGE=y<br># CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS is not set<br>CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y<br>CONFIG_HUGETLBFS=y<br>CONFIG_HUGETLB_PAGE=y<br><br># uname -r<br>3.10.0-*.el7.ppc64le</div><span><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div><br>
> VmallocChunk: <a href="tel:8589850624" value="+18589850624" target="_blank">8589850624</a> kB<br>
> HardwareCorrupted: 0 kB<br>
<br>
> AnonHugePages: 0 kB<br>
<br>
</div></div>This tells that your kernel support THP.<br></blockquote><div> </div></span><div>yes, the reason is that my kvm guest XML was not added these below line:<br><br>guest XML:<br> <memoryBacking>
<br> <hugepages/>
<br> </memoryBacking>
<br></div><div><br></div><div>after adding them, the kvm guest can works well with hugepages.<br><br></div></div>it is a configuration issue of guest, not a kernel bug. so, I propose my patch as previously.<br clear="all"></div></div></blockquote><div><br></div><div>IMO, if we use the original "/proc/sys/vm/nr_hugepages" to check the hugetlb<br>
support, it does not work on the situation which I mentioned above.<br><br><div>So, I suggest to add new Marco <span class="im"></span><span class="im">'<span class="im">PATH_SYS_HUGEPAGES' </span> </span> to skip the testcase<span class="im">.</span><span class="im"><br></span></div><span class="im"></span></div><div><br></div></div>what do you think?<br><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Regards,<br></div>Li Wang<br></div><div>Email: <a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a><br></div></div></div></div></div></div>
</div></div>