All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] hugetlb: checking if hugepage is supported on target system
Date: Thu, 26 Nov 2015 11:47:40 +0300	[thread overview]
Message-ID: <5656C72C.4090203@oracle.com> (raw)
In-Reply-To: <1448506629-12150-1-git-send-email-liwang@redhat.com>

Hi,
On 11/26/2015 05:57 AM, Li Wang wrote:
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
...
> -	if (write(fd, nr_hugepages,
> +	if ((unsigned int)write(fd, nr_hugepages,
>   		  strlen(nr_hugepages)) != strlen(nr_hugepages))
>   		tst_resm(TWARN | TERRNO, "write");
>   	close(fd);
> @@ -271,7 +270,7 @@ static void cleanup(void)
>   		tst_resm(TWARN | TERRNO, "open");
>   	tst_resm(TINFO, "restore nr_overcommit_hugepages to %s.",
>   		 nr_overcommit_hugepages);
> -	if (write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))
> +	if ((unsigned int)write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))
>   	    != strlen(nr_overcommit_hugepages))

It would be better to use ssize_t, that way you won't exceed 80c per 
line as well.

if (write(fd, nr_overcommit_hugepages, strlen(nr_overcommit_hugepages))
  	    != (ssize_t)strlen(nr_overcommit_hugepages))


>   		tst_resm(TWARN | TERRNO, "write");
>   	close(fd);
> @@ -287,7 +286,7 @@ static void cleanup(void)
>   	tst_rmdir();
>   }
>   
> -static void setup(void)
> +void setup(void)

forgot "static"?

...
>   
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index 215c052..84af3ce 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -314,6 +314,12 @@ static void verify(char **memory, char value, int proc,
>   	free(s);
>   }
>   
...
> +	if (access(PATH_HUGEPAGES, F_OK) == -1)
Could be
if (access(PATH_HUGEPAGES, F_OK))
        tss_brkm(...);

> +		tst_brkm(TCONF, NULL, "Huge page is not supported.");
> +
>   	tst_tmpdir();
>   
>   	SAFE_FILE_SCANF(NULL, PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);

Thanks,
Alexey

  reply	other threads:[~2015-11-26  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26  2:57 [LTP] [PATCH v2] hugetlb: checking if hugepage is supported on target system Li Wang
2015-11-26  8:47 ` Alexey Kodanev [this message]
2015-11-26  9:00   ` Li Wang
2015-11-26 13:49     ` Cyril Hrubis
2015-11-27  5:32       ` 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=5656C72C.4090203@oracle.com \
    --to=alexey.kodanev@oracle.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.