All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] move_pages12: Make sure hugepages are available
Date: Tue, 16 May 2017 08:28:04 -0400 (EDT)	[thread overview]
Message-ID: <1420231349.12458178.1494937684196.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20170516100759.10355-1-chrubis@suse.cz>



----- Original Message -----
> +
>  static void setup(void)
>  {
>  	int memfree, ret;
> @@ -137,6 +181,10 @@ static void setup(void)
>  	if (access(PATH_HUGEPAGES, F_OK))
>  		tst_brk(TCONF, "Huge page not supported");
>  
> +	ret = get_allowed_nodes(NH_MEMS, TEST_NODES, &node1, &node2);
> +	if (ret < 0)
> +		tst_brk(TBROK | TERRNO, "get_allowed_nodes: %d", ret);
> +
>  	pgsz = (int)get_page_size();
>  	SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "Hugepagesize: %d", &hpsz);
>  
> @@ -148,18 +196,56 @@ static void setup(void)
>  
>  	hpsz *= 1024;
>  
> -	SAFE_FILE_SCANF(PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
> -	SAFE_FILE_PRINTF(PATH_NR_HUGEPAGES, "%ld", orig_hugepages + 4);
> +	snprintf(path_hugepages_node1, sizeof(path_hugepages_node1),
> +
> 		 "/sys/devices/system/node/node%u/hugepages/hugepages-2048kB/nr_hugepages",
> +		 node1);
> +
> +	snprintf(path_hugepages_node2, sizeof(path_hugepages_node2),
> +
> 		 "/sys/devices/system/node/node%u/hugepages/hugepages-2048kB/nr_hugepages",
> +		 node2);

Hi,

"hugepages-2048kB" in path above will work only on systems with 2M huge pages.

> +
> +	if (!access(path_hugepages_node1, F_OK)) {
> +		SAFE_FILE_SCANF(path_hugepages_node1,
> +				"%ld", &orig_hugepages_node1);
> +		tst_res(TINFO, "Increasing hugepages pool on node %u to %ld",
> +			node1, orig_hugepages_node1 + 4);
> +		SAFE_FILE_PRINTF(path_hugepages_node1,
> +				 "%ld", orig_hugepages_node1 + 4);

There doesn't seem to be any error if you ask for more:

# echo 20000 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
# cat /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
11650

So, maybe we can just read it back and if it doesn't match what we requested,
we can TCONF.

Rest looks good to me.
I've tested so far only on x86, no issues there.

Regards,
Jan

  reply	other threads:[~2017-05-16 12:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 10:07 [LTP] [PATCH v2] move_pages12: Make sure hugepages are available Cyril Hrubis
2017-05-16 12:28 ` Jan Stancek [this message]
2017-05-16 13:32   ` Cyril Hrubis
2017-05-16 14:05     ` Jan Stancek
2017-05-16 14:15       ` Cyril Hrubis
2017-05-16 14:15       ` Jan Stancek
2017-05-16 14:29         ` Cyril Hrubis
2017-05-17  8:21           ` Jan Stancek
2017-05-29 13:12           ` Jan Stancek
2017-05-29 13:45             ` Jan Stancek
2017-05-30 11:50             ` Cyril Hrubis
2017-05-30 13:11               ` Jan Stancek
2017-05-30 13:48                 ` Cyril Hrubis
2017-05-31  7:46                   ` Jan Stancek

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=1420231349.12458178.1494937684196.JavaMail.zimbra@redhat.com \
    --to=jstancek@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.