[LTP] [PATCH v4] hugetlb: limit hugepages according to MemAvailable
Cyril Hrubis
chrubis@suse.cz
Tue Apr 30 15:04:03 CEST 2019
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
More information about the ltp
mailing list