linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-mm@kvack.org, Vladimir Davydov <vdavydov@parallels.com>,
	Greg Thelen <gthelen@google.com>, Dave Hansen <dave@sr71.net>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 2/3] mm: hugetlb_controller: convert to lockless page counters
Date: Wed, 8 Oct 2014 08:39:38 -0400	[thread overview]
Message-ID: <20141008123938.GB14361@cmpxchg.org> (raw)
In-Reply-To: <20141007152149.GF14243@dhcp22.suse.cz>

On Tue, Oct 07, 2014 at 05:21:49PM +0200, Michal Hocko wrote:
> On Wed 24-09-14 11:43:09, Johannes Weiner wrote:
> > Abandon the spinlock-protected byte counters in favor of the unlocked
> > page counters in the hugetlb controller as well.
> > 
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> 
> One minor thing below:
> Acked-by: Michal Hocko <mhocko@suse.cz>

Thank you!

> >  static ssize_t hugetlb_cgroup_write(struct kernfs_open_file *of,
> >  				    char *buf, size_t nbytes, loff_t off)
> >  {
> > -	int idx, name, ret;
> > -	unsigned long long val;
> > +	int ret, idx;
> > +	unsigned long nr_pages;
> >  	struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(of_css(of));
> >  
> > +	if (hugetlb_cgroup_is_root(h_cg)) /* Can't set limit on root */
> > +		return -EINVAL;
> > +
> >  	buf = strstrip(buf);
> > +	ret = page_counter_memparse(buf, &nr_pages);
> > +	if (ret)
> > +		return ret;
> > +
> >  	idx = MEMFILE_IDX(of_cft(of)->private);
> > -	name = MEMFILE_ATTR(of_cft(of)->private);
> >  
> > -	switch (name) {
> > +	switch (MEMFILE_ATTR(of_cft(of)->private)) {
> >  	case RES_LIMIT:
> > -		if (hugetlb_cgroup_is_root(h_cg)) {
> > -			/* Can't set limit on root */
> > -			ret = -EINVAL;
> > -			break;
> > -		}
> > -		/* This function does all necessary parse...reuse it */
> > -		ret = res_counter_memparse_write_strategy(buf, &val);
> > -		if (ret)
> > -			break;
> > -		val = ALIGN(val, 1ULL << huge_page_shift(&hstates[idx]));
> > -		ret = res_counter_set_limit(&h_cg->hugepage[idx], val);
> > +		nr_pages = ALIGN(nr_pages, 1UL<<huge_page_order(&hstates[idx]));
> 
> memcg doesn't round up to the next page so I guess we do not have to do
> it here as well.

That rounding was introduced very recently and for no good reason
except that "memcg rounds up too".  Meh.  I'll remove it.

Thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-10-08 12:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 15:43 [patch 0/3] mm: memcontrol: lockless page counters v2 Johannes Weiner
2014-09-24 15:43 ` [patch 1/3] mm: memcontrol: lockless page counters Johannes Weiner
2014-09-26 10:31   ` Vladimir Davydov
2014-10-02 12:07     ` Johannes Weiner
2014-10-03 15:36       ` Vladimir Davydov
2014-10-03 15:41         ` Michal Hocko
2014-10-06  6:38           ` Vladimir Davydov
2014-09-30 11:06   ` Michal Hocko
2014-10-02 15:01     ` Johannes Weiner
2014-10-02 19:52       ` Johannes Weiner
2014-10-03 15:44         ` Michal Hocko
2014-10-03 14:50       ` Michal Hocko
2014-10-07 15:15   ` Michal Hocko
2014-10-08 12:31     ` Johannes Weiner
2014-09-24 15:43 ` [patch 2/3] mm: hugetlb_controller: convert to " Johannes Weiner
2014-09-26 11:25   ` Vladimir Davydov
2014-10-07 15:21   ` Michal Hocko
2014-10-08 12:39     ` Johannes Weiner [this message]
2014-09-24 15:43 ` [patch 3/3] kernel: res_counter: remove the unused API Johannes Weiner
2014-09-26 11:27   ` Vladimir Davydov
2014-10-07 15:26   ` 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=20141008123938.GB14361@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=cgroups@vger.kernel.org \
    --cc=dave@sr71.net \
    --cc=gthelen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=vdavydov@parallels.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox