lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110414065146.GA19685@tiehlicka.suse.cz>
Date:	Thu, 14 Apr 2011 08:51:46 +0200
From:	Michal Hocko <mhocko@...e.cz>
To:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Jack Steiner <steiner@....com>,
	Lee Schermerhorn <lee.schermerhorn@...com>,
	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...helsinki.fi>,
	Paul Menage <menage@...gle.com>, Robin Holt <holt@....com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: cpusets: randomize node rotor used in cpuset_mem_spread_node()

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@...fujitsu.com>

Thanks!
-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ