ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Martin Doucha <mdoucha@suse.cz>
To: Li Wang <liwang@redhat.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] hugemmap32: guarantee enough memory for gigantic hugepage
Date: Thu, 11 May 2023 13:04:16 +0200	[thread overview]
Message-ID: <cdd66dfb-b9a1-2a58-abe0-895def28d2ed@suse.cz> (raw)
In-Reply-To: <20230508134903.83591-1-liwang@redhat.com>

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.

-- 
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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2023-05-11 11:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 13:49 [LTP] [PATCH] hugemmap32: guarantee enough memory for gigantic hugepage Li Wang
2023-05-10 13:18 ` Cyril Hrubis
2023-05-11 11:04 ` Martin Doucha [this message]
2023-05-11 12:19   ` Li Wang

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=cdd66dfb-b9a1-2a58-abe0-895def28d2ed@suse.cz \
    --to=mdoucha@suse.cz \
    --cc=liwang@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).