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: <20110623081207.GC31593@tiehlicka.suse.cz>
Date:	Thu, 23 Jun 2011 10:12:07 +0200
From:	Michal Hocko <mhocko@...e.cz>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"bsingharora@...il.com" <bsingharora@...il.com>,
	Ying Han <yinghan@...gle.com>,
	"hannes@...xchg.org" <hannes@...xchg.org>
Subject: Re: [PATCH 4/7] memcg: update numa information based on event counter

On Thu 23-06-11 15:27:34, KAMEZAWA Hiroyuki wrote:
> On Wed, 22 Jun 2011 17:53:09 +0200
> Michal Hocko <mhocko@...e.cz> wrote:
> 
> > On Thu 16-06-11 12:54:00, KAMEZAWA Hiroyuki wrote:
[...]
> > > @@ -1616,17 +1629,32 @@ mem_cgroup_select_victim(struct mem_cgro
> > >  /*
> > >   * Always updating the nodemask is not very good - even if we have an empty
> > >   * list or the wrong list here, we can start from some node and traverse all
> > > - * nodes based on the zonelist. So update the list loosely once per 10 secs.
> > > + * nodes based on the zonelist.
> > >   *
> > > + * The counter of mem->numascan_update is updated once per
> > > + * NUMASCAN_EVENTS_TARGET. We update the numa information when we see
> > > + * the number of event is larger than 3% of limit or  64MB pagein/pageout.
> > >   */
> > > +#define NUMASCAN_UPDATE_RATIO	(3)
> > > +#define NUMASCAN_UPDATE_THRESH	(16384UL) /* 16k events of pagein/pageout */
> > >  static void mem_cgroup_may_update_nodemask(struct mem_cgroup *mem)
> > >  {
> > >  	int nid;
> > > -
> > > -	if (time_after(mem->next_scan_node_update, jiffies))
> > > +	unsigned long long limit;
> > > +	/* if no limit, we never reach here */
> > > +	limit = res_counter_read_u64(&mem->res, RES_LIMIT);
> > > +	limit /= PAGE_SIZE;
> > > +	/* 3% of limit */
> > > +	limit = (limit * NUMASCAN_UPDATE_RATIO/100UL);
> > > +	limit = min_t(unsigned long long, limit, NUMASCAN_UPDATE_THRESH);
> > > +	/*
> > > +	 * If the number of pagein/out event is larger than 3% of limit or
> > > +	 * 64MB pagein/out, refresh numa information.
> > > +	 */
> > > +	if (atomic_read(&mem->numascan_update) < limit ||
> > > +	    !mutex_trylock(&mem->numascan_mutex))
> > >  		return;
> > 
> > I am not sure whether a mutex is not overkill here. What about using an
> > atomic operation instead?
> > 
> 
> I think mutex is informative than atomic counter for code readers.
> If influence of overhead is not big, I'd like to use mutex.

I do not have a strong opinion on that. mem_cgroup is not that
widespread structure to think about every single byte. On the other hand
atomic test&set would do the same thing. We are already using atomic
operations to manipulate numascan_update so doing it whole atomic based
sounds natural.

-- 
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