All of lore.kernel.org
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] syscalls/migrate_pages: fix nodemask memory allocation
Date: Wed, 21 Aug 2013 11:17:13 +0200	[thread overview]
Message-ID: <20130821091712.GA3558@rei> (raw)
In-Reply-To: <1376908164-10045-1-git-send-email-stanislav.kholmanskikh@oracle.com>

Hi!
> ---
>  .../syscalls/migrate_pages/migrate_pages01.c       |    5 ++++-
>  .../syscalls/migrate_pages/migrate_pages02.c       |    5 ++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c b/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
> index c23e8b0..9981c0c 100644
> --- a/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
> +++ b/testcases/kernel/syscalls/migrate_pages/migrate_pages01.c
> @@ -248,7 +248,10 @@ static void setup(void)
>  			 ret);
>  
>  	sane_max_node = get_max_node();
> -	sane_nodemask_size = sane_max_node / 8 + 1;
> +	sane_nodemask_size = sane_max_node / (sizeof(unsigned long)*8);
> +	sane_nodemask_size += sane_max_node % (sizeof(unsigned long)*8) == 0 ?
> +				0 : 1;
> +	sane_nodemask_size *= sizeof(unsigned long);

Do we really need to round it sizeof(unsigned long) or is creating large
enough array sufficient?

What about:

sane_max_node / 8 + sizeof(unsinged long);

Which should yield size that is at least as large as the size we need.

Also I would create a macro to do that NODEMASK_SIZE() and put it into
migrate_pages_common.h header.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2013-08-21  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 10:29 [LTP] [PATCH] syscalls/migrate_pages: fix nodemask memory allocation Stanislav Kholmanskikh
2013-08-21  9:17 ` chrubis [this message]
     [not found]   ` <52148D58.9060509@oracle.com>
2013-08-21 10:09     ` chrubis

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=20130821091712.GA3558@rei \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=stanislav.kholmanskikh@oracle.com \
    --cc=vasily.isaenko@oracle.com \
    /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.