public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] mem02: calculate the order of pagesize instead to hardcode
Date: Tue, 16 Apr 2019 10:59:01 +0200	[thread overview]
Message-ID: <20190416085901.GA28671@rei.lan> (raw)
In-Reply-To: <20190416081655.23749-1-bala24@linux.vnet.ibm.com>

Hi!
Applied with minor style changes, thanks.

> +static int get_pagesize_order()
                                 ^
				 added void
> +{
> +	int i, pagesize, size = 0;
> +	pagesize = sysconf(_SC_PAGESIZE);
> +	for (i = 0; size != pagesize; i++)
> +		size = 1 << i;
> +	return (i - 1);
> +}
> +
>  int main(int argc, char **argv)
>  {
>  	int i;
>  	char *pm1, *pm2, *pm3, *pm4;
> -	long pm6;
>  	void *memptr;
>  	long laddr;
>  	int iteration_count;
>  	int size;		/* Size to memory to be valloced */
> -	int pagesize = 12;	/* 2^12 = 4096, PAGESIZE      */
> +	/* calculate the order of pagesize */
             ^
	     Removed this redundant comment as it was commenting the
	     obvious.

> +	int pagesize_order = get_pagesize_order();
>  	int memsize = MEMSIZE;	/* Size of memory to allocate */
>  	extern char *optarg;	/* getopt() function global variables */
>  	extern int optopt;	/* stores bad option passed to the program */

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2019-04-16  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  8:16 [LTP] [PATCH] mem02: calculate the order of pagesize instead to hardcode Balamuruhan S
2019-04-16  8:59 ` 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=20190416085901.GA28671@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