The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Jack Steiner <steiner@sgi.com>,
	Lee Schermerhorn <lee.schermerhorn@hp.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Paul Menage <menage@google.com>, Robin Holt <holt@sgi.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: cpusets: randomize node rotor used in cpuset_mem_spread_node()
Date: Thu, 14 Apr 2011 08:51:46 +0200	[thread overview]
Message-ID: <20110414065146.GA19685@tiehlicka.suse.cz> (raw)
In-Reply-To: <20110414111939.0812.A69D9226@jp.fujitsu.com>

On Thu 14-04-11 11:19:24, KOSAKI Motohiro wrote:
> > diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> > index 959a8b8..8e57a72 100644
> > --- a/mm/mempolicy.c
> > +++ b/mm/mempolicy.c
> > @@ -93,6 +93,7 @@
> >  
> >  #include <asm/tlbflush.h>
> >  #include <asm/uaccess.h>
> > +#include <linux/random.h>
> >  
> >  #include "internal.h"
> >  
> > @@ -1649,6 +1650,21 @@ static inline unsigned interleave_nid(struct mempolicy *pol,
> >  		return interleave_nodes(pol);
> >  }
> >  
> > +/*
> > + * Return the bit number of a random bit set in the nodemask.
> > + * (returns -1 if nodemask is empty)
> > + */
> > +int node_random(const nodemask_t *maskp)
> > +{
> > +	int w, bit = -1;
> > +
> > +	w = nodes_weight(*maskp);
> > +	if (w)
> > +		bit = bitmap_ord_to_pos(maskp->bits,
> > +			get_random_int() % w, MAX_NUMNODES);
> > +	return bit;
> > +}
> > +
> >  #ifdef CONFIG_HUGETLBFS
> >  /*
> >   * huge_zonelist(@vma, @addr, @gfp_flags, @mpol)
>
> mempolicy.c is no best place for putting generic nodemask utility function.
> but unforunately we have no alternative. Gack.

Agreed. I was thinking about adding a new mm/numa.c but then I concluded
that it would be overkill for the single function.

> 	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

Thanks!
-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

  reply	other threads:[~2011-04-14  6:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 14:35 cpusets: randomize node rotor used in cpuset_mem_spread_node() Michal Hocko
2011-04-14  2:19 ` KOSAKI Motohiro
2011-04-14  6:51   ` Michal Hocko [this message]
2011-04-14  7:01     ` KOSAKI Motohiro
2011-04-15  7:18       ` KOSAKI Motohiro
2011-04-15  8:20         ` [PATCH v2] " Michal Hocko
2011-04-15  8:29           ` KOSAKI Motohiro
2011-04-15  8:31             ` Michal Hocko
2011-04-15 23:42           ` David Rientjes
2011-04-18  8:42             ` [PATCH incremental] cpusets: initialize spread rotor lazily Michal Hocko
2011-04-18 20:19               ` David Rientjes
2011-04-18 21:29                 ` Michal Hocko
2011-04-19  1:15                   ` David Rientjes
2011-05-26 22:33           ` [PATCH v2] cpusets: randomize node rotor used in cpuset_mem_spread_node() Andrew Morton
2011-05-27 12:47             ` Michal Hocko
2011-05-27 19:07               ` David Rientjes
2011-05-27 23:17                 ` Michal Hocko
2011-05-27 23:27                   ` David Rientjes
2011-05-27 23:40                     ` Michal Hocko
2011-05-27 21:20               ` Andrew Morton
2011-05-27 23:17                 ` Michal Hocko
2011-05-27 23:30                   ` David Rientjes
2011-05-27 23:38                     ` Michal Hocko

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=20110414065146.GA19685@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=holt@sgi.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=lee.schermerhorn@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    --cc=penberg@cs.helsinki.fi \
    --cc=steiner@sgi.com \
    --cc=torvalds@linux-foundation.org \
    /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