[LTP] [PATCH] hugemmap32: guarantee enough memory for gigantic hugepage
Li Wang
liwang@redhat.com
Thu May 11 14:19:51 CEST 2023
On Thu, May 11, 2023 at 7:10 PM Martin Doucha <mdoucha@suse.cz> wrote:
> Hi,
>
> On 08. 05. 23 15:49, Li Wang wrote:
> > To get rid of warning on ppc64le:
> >
> > hugemmap32.c:34: TWARN: Failed to close FILE
> > '/sys/kernel/mm/hugepages/hugepages-16777216kB/nr_hugepages'
> > hugemmap32.c:35: TCONF: Can't update the gigantic hugepages.
> > hugemmap32.c:69: TWARN: Failed to close FILE
> > '/sys/kernel/mm/hugepages/hugepages-16777216kB/nr_hugepages':
> EINVAL (22)
> >
> > # ll /sys/kernel/mm/hugepages/
> > total 0
> > drwxr-xr-x. 2 root root 0 May 4 02:02 hugepages-16384kB
> > drwxr-xr-x. 2 root root 0 May 4 02:02 hugepages-16777216kB
> >
> > # cat /proc/meminfo | grep -i Hugepagesize
> > Hugepagesize: 16384 kB
> >
> > # free -h
> > total used free shared buff/cache
> available
> > Mem: 7.4Gi 1.1Gi 992Mi 13Mi 5.9Gi
> 6.3Gi
> > Swap: 4.0Gi 0B 4.0Gi
> >
> > Signed-off-by: Li Wang <liwang@redhat.com>
> > ---
> > testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> > index 34b322bfa..7ff23b236 100644
> > --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> > +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> > @@ -60,6 +60,12 @@ static void setup(void)
> > tst_brk(TCONF, "Gigantic hugepages not supported");
> >
> > SAFE_CLOSEDIR(dir);
> > +
> > + if (tst_available_mem() < (long long)hpage_size) {
> > + g_hpage_path[0] = '\0';
> > + tst_brk(TCONF, "No enough memory for gigantic hugepage
> reserving");
> > + }
> > +
> > SAFE_FILE_LINES_SCANF(g_hpage_path, "%d", &org_g_hpages);
> > }
>
> I also recommend calling
> SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
>
> It doesn't whether you do it before or after tst_available_mem() since
> caches count as available.
>
Good point, could you send a patch or delay this work after release as well?
>
> --
> Martin Doucha mdoucha@suse.cz
> QA Engineer for Software Maintenance
> SUSE LINUX, s.r.o.
> CORSO IIa
> Krizikova 148/34
> 186 00 Prague 8
> Czech Republic
>
>
--
Regards,
Li Wang
More information about the ltp
mailing list