From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4] hugetlb: limit hugepages according to MemAvailable
Date: Tue, 30 Apr 2019 15:04:03 +0200 [thread overview]
Message-ID: <20190430130403.GC30997@rei.lan> (raw)
In-Reply-To: <20190430031859.28473-1-liwang@redhat.com>
Hi!
> +void limit_hugepages(long *hpages)
> +{
> + long mem_avail, max_hpages;
> +
> + if (FILE_LINES_SCANF("/proc/meminfo",
> + "MemAvailable: %ld", &mem_avail)) {
> + /*
> + * Dropping caches and using "MemFree:" on kernel
> + * that doesn't have "MemAvailable:" in Meminfo
> + */
I've added one TINFO message here.
> + SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "3");
> + mem_avail = SAFE_READ_MEMINFO("MemFree:");
> + }
> +
> + max_hpages = mem_avail / SAFE_READ_MEMINFO("Hugepagesize:");
> +
> + if (*hpages > max_hpages) {
> + tst_res(TINFO, "The hugepages beyond system available, here "
> + "reset to 80%% of the max page count %ld",
> + max_hpages);
Reworded this message a bit, to make it clearer.
And pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
prev parent reply other threads:[~2019-04-30 13:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 3:18 [LTP] [PATCH v4] hugetlb: limit hugepages according to MemAvailable Li Wang
2019-04-30 13:04 ` Cyril Hrubis [this message]
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=20190430130403.GC30997@rei.lan \
--to=chrubis@suse.cz \
--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