All of lore.kernel.org
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>, Tejun Heo <tj@kernel.org>,
	Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/7] res_counter: add a function res_counter_move_parent().
Date: Fri, 13 Apr 2012 09:57:03 +0900	[thread overview]
Message-ID: <4F8779DF.3080307@jp.fujitsu.com> (raw)
In-Reply-To: <CAFTL4hyKOkoTv=717MkYx4QB0j3B6xA0ZPp1jg6HkrtTkAu7nQ@mail.gmail.com>

(2012/04/12 23:30), Frederic Weisbecker wrote:

> 2012/4/12 Glauber Costa <glommer@parallels.com>:
>> On 04/12/2012 08:20 AM, KAMEZAWA Hiroyuki wrote:
>>>
>>> This function is used for moving accounting information to its
>>> parent in the hierarchy of res_counter.
>>>
>>> Signed-off-by: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
>>
>> Frederic has a patch in his fork cgroup series, that allows you to
>> uncharge a counter until you reach a specific ancestor.
>> You pass the parent as a parameter, and then only you gets uncharged.
> 
> I'm missing the referring patchset from Kamezawa. Ok I'm going to
> subscribe to the
> cgroup mailing list. Meanwhile perhaps would it be nice to keep Cc
> LKML for cgroup patches?
> 

Ah, sorry. I will do next time.

> Some comments below:
> 
>>
>> I think that is a much better interface than this you are proposing.
>> We should probably merge that patch and use it.
>>
>>> ---
>>>   include/linux/res_counter.h |    3 +++
>>>   kernel/res_counter.c        |   13 +++++++++++++
>>>   2 files changed, 16 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
>>> index da81af0..8919d3c 100644
>>> --- a/include/linux/res_counter.h
>>> +++ b/include/linux/res_counter.h
>>> @@ -135,6 +135,9 @@ int __must_check res_counter_charge_nofail(struct res_counter *counter,
>>>   void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
>>>   void res_counter_uncharge(struct res_counter *counter, unsigned long val);
>>>
>>> +/* move resource to parent counter...i.e. just forget accounting in a child */
>>> +void res_counter_move_parent(struct res_counter *counter, unsigned long val);
>>> +
>>>   /**
>>>    * res_counter_margin - calculate chargeable space of a counter
>>>    * @cnt: the counter
>>> diff --git a/kernel/res_counter.c b/kernel/res_counter.c
>>> index d508363..fafebf0 100644
>>> --- a/kernel/res_counter.c
>>> +++ b/kernel/res_counter.c
>>> @@ -113,6 +113,19 @@ void res_counter_uncharge(struct res_counter *counter, unsigned long val)
>>>       local_irq_restore(flags);
>>>   }
>>>
>>> +/*
>>> + * In hierarchical accounting, child's usage is accounted into ancestors.
>>> + * To move local usage to its parent, just forget current level usage.
> 
> The way I understand this comment and the changelog matches the opposite
> of what the below function is doing.
> 
> The function charges a child and ignore all its parents. The comments says it
> charges the parents but not the child.
> 


Sure, I'll fix...and look into your code first.
"uncharge a counter until you reach a specific ancestor"...
Is it in linux-next ?

Thanks,
-Kame


>>> + */
>>> +void res_counter_move_parent(struct res_counter *counter, unsigned long val)
>>> +{
>>> +     unsigned long flags;
>>> +
>>> +     BUG_ON(!counter->parent);
>>> +     spin_lock_irqsave(&counter->lock, flags);
>>> +     res_counter_uncharge_locked(counter, val);
>>> +     spin_unlock_irqrestore(&counter->lock, flags);
>>> +}
>>>
>>>   static inline unsigned long long *
>>>   res_counter_member(struct res_counter *counter, int member)
>>
> 
> 



--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
To: Frederic Weisbecker <fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH 1/7] res_counter: add a function res_counter_move_parent().
Date: Fri, 13 Apr 2012 09:57:03 +0900	[thread overview]
Message-ID: <4F8779DF.3080307@jp.fujitsu.com> (raw)
In-Reply-To: <CAFTL4hyKOkoTv=717MkYx4QB0j3B6xA0ZPp1jg6HkrtTkAu7nQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

(2012/04/12 23:30), Frederic Weisbecker wrote:

> 2012/4/12 Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>:
>> On 04/12/2012 08:20 AM, KAMEZAWA Hiroyuki wrote:
>>>
>>> This function is used for moving accounting information to its
>>> parent in the hierarchy of res_counter.
>>>
>>> Signed-off-by: KAMEZAWA Hiroyuki<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
>>
>> Frederic has a patch in his fork cgroup series, that allows you to
>> uncharge a counter until you reach a specific ancestor.
>> You pass the parent as a parameter, and then only you gets uncharged.
> 
> I'm missing the referring patchset from Kamezawa. Ok I'm going to
> subscribe to the
> cgroup mailing list. Meanwhile perhaps would it be nice to keep Cc
> LKML for cgroup patches?
> 

Ah, sorry. I will do next time.

> Some comments below:
> 
>>
>> I think that is a much better interface than this you are proposing.
>> We should probably merge that patch and use it.
>>
>>> ---
>>>   include/linux/res_counter.h |    3 +++
>>>   kernel/res_counter.c        |   13 +++++++++++++
>>>   2 files changed, 16 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
>>> index da81af0..8919d3c 100644
>>> --- a/include/linux/res_counter.h
>>> +++ b/include/linux/res_counter.h
>>> @@ -135,6 +135,9 @@ int __must_check res_counter_charge_nofail(struct res_counter *counter,
>>>   void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
>>>   void res_counter_uncharge(struct res_counter *counter, unsigned long val);
>>>
>>> +/* move resource to parent counter...i.e. just forget accounting in a child */
>>> +void res_counter_move_parent(struct res_counter *counter, unsigned long val);
>>> +
>>>   /**
>>>    * res_counter_margin - calculate chargeable space of a counter
>>>    * @cnt: the counter
>>> diff --git a/kernel/res_counter.c b/kernel/res_counter.c
>>> index d508363..fafebf0 100644
>>> --- a/kernel/res_counter.c
>>> +++ b/kernel/res_counter.c
>>> @@ -113,6 +113,19 @@ void res_counter_uncharge(struct res_counter *counter, unsigned long val)
>>>       local_irq_restore(flags);
>>>   }
>>>
>>> +/*
>>> + * In hierarchical accounting, child's usage is accounted into ancestors.
>>> + * To move local usage to its parent, just forget current level usage.
> 
> The way I understand this comment and the changelog matches the opposite
> of what the below function is doing.
> 
> The function charges a child and ignore all its parents. The comments says it
> charges the parents but not the child.
> 


Sure, I'll fix...and look into your code first.
"uncharge a counter until you reach a specific ancestor"...
Is it in linux-next ?

Thanks,
-Kame


>>> + */
>>> +void res_counter_move_parent(struct res_counter *counter, unsigned long val)
>>> +{
>>> +     unsigned long flags;
>>> +
>>> +     BUG_ON(!counter->parent);
>>> +     spin_lock_irqsave(&counter->lock, flags);
>>> +     res_counter_uncharge_locked(counter, val);
>>> +     spin_unlock_irqrestore(&counter->lock, flags);
>>> +}
>>>
>>>   static inline unsigned long long *
>>>   res_counter_member(struct res_counter *counter, int member)
>>
> 
> 



  reply	other threads:[~2012-04-13  0:58 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 11:17 [PATCH v1 0/7] memcg remove pre_destroy KAMEZAWA Hiroyuki
2012-04-12 11:20 ` [PATCH 1/7] res_counter: add a function res_counter_move_parent() KAMEZAWA Hiroyuki
2012-04-12 11:20   ` KAMEZAWA Hiroyuki
2012-04-12 13:22   ` Glauber Costa
2012-04-12 14:30     ` Frederic Weisbecker
2012-04-13  0:57       ` KAMEZAWA Hiroyuki [this message]
2012-04-13  0:57         ` KAMEZAWA Hiroyuki
2012-04-13  1:04         ` Frederic Weisbecker
2012-04-13  1:04           ` Frederic Weisbecker
2012-04-13  1:05           ` KAMEZAWA Hiroyuki
2012-04-16 22:19   ` Tejun Heo
2012-04-16 22:19     ` Tejun Heo
2012-04-18  6:59     ` KAMEZAWA Hiroyuki
2012-04-18  6:59       ` KAMEZAWA Hiroyuki
2012-04-16 22:31   ` Tejun Heo
2012-04-18  7:04     ` KAMEZAWA Hiroyuki
2012-04-18  7:04       ` KAMEZAWA Hiroyuki
2012-04-18 17:03       ` Tejun Heo
2012-04-18 17:03         ` Tejun Heo
2012-04-12 11:21 ` [PATCH 2/7] memcg: move charge to parent only when necessary KAMEZAWA Hiroyuki
2012-04-12 11:21   ` KAMEZAWA Hiroyuki
2012-04-16 22:21   ` Tejun Heo
2012-04-16 22:21     ` Tejun Heo
2012-04-18  7:01     ` KAMEZAWA Hiroyuki
2012-04-18  7:01       ` KAMEZAWA Hiroyuki
2012-04-12 11:22 ` [PATCH 3/7] memcg: move charges to root at rmdir() KAMEZAWA Hiroyuki
2012-04-12 11:22   ` KAMEZAWA Hiroyuki
2012-04-16 22:30   ` Tejun Heo
2012-04-16 22:30     ` Tejun Heo
2012-04-18  7:02     ` KAMEZAWA Hiroyuki
2012-04-12 11:24 ` [PATCH 4/7] memcg: remove 'uncharge' argument from mem_cgroup_move_account() KAMEZAWA Hiroyuki
2012-04-12 11:24   ` KAMEZAWA Hiroyuki
2012-04-12 13:27   ` Glauber Costa
2012-04-13  1:01     ` KAMEZAWA Hiroyuki
2012-04-12 11:28 ` [PATCH 5/7] memcg: divide force_empty into 2 functions, avoid memory reclaim at rmdir KAMEZAWA Hiroyuki
2012-04-12 11:28   ` KAMEZAWA Hiroyuki
2012-04-12 13:33   ` Glauber Costa
2012-04-17 17:29   ` Ying Han
2012-04-18  7:14     ` KAMEZAWA Hiroyuki
2012-04-18  7:14       ` KAMEZAWA Hiroyuki
2012-04-12 11:30 ` [PATCH 6/7] memcg: remove pre_destroy() KAMEZAWA Hiroyuki
2012-04-12 11:30   ` KAMEZAWA Hiroyuki
2012-04-16 22:38   ` Tejun Heo
2012-04-18  7:12     ` KAMEZAWA Hiroyuki
2012-04-18  7:12       ` KAMEZAWA Hiroyuki
2012-04-17 17:47   ` Ying Han
2012-04-17 17:47     ` Ying Han
2012-04-12 11:31 ` [PATCH 7/7] memcg: remove drain_all_stock_sync KAMEZAWA Hiroyuki
2012-04-12 11:31   ` KAMEZAWA Hiroyuki
2012-04-12 13:35   ` Glauber Costa
2012-04-12 13:35     ` Glauber Costa
2012-04-12 13:20 ` [PATCH v1 0/7] memcg remove pre_destroy Glauber Costa
2012-04-12 13:20   ` Glauber Costa
2012-04-12 16:06 ` Tejun Heo
2012-04-12 16:06   ` Tejun Heo
2012-04-12 18:57   ` Aneesh Kumar K.V
2012-04-12 18:57     ` Aneesh Kumar K.V
2012-04-12 23:59     ` KAMEZAWA Hiroyuki
2012-04-13  8:50       ` Michal Hocko
2012-04-13  8:50         ` Michal Hocko
2012-04-13 22:19         ` Aneesh Kumar K.V
2012-04-13 22:19           ` Aneesh Kumar K.V
2012-04-16 22:41 ` Tejun Heo
2012-04-16 22:41   ` Tejun Heo
2012-04-17 17:35 ` Ying Han
2012-04-18  7:15   ` KAMEZAWA Hiroyuki
2012-04-18  7:15     ` KAMEZAWA Hiroyuki

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=4F8779DF.3080307@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=glommer@parallels.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=tj@kernel.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 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.