cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: KAMEZAWA Hiroyuki
	<kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: "linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
	Hugh Dickins <hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Han Ying <yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
	"Aneesh Kumar K.V"
	<aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	"suleiman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org"
	<suleiman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ@public.gmane.org"
	<n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC][PATCH 0/3] page cgroup diet
Date: Wed, 21 Mar 2012 10:13:34 +0400	[thread overview]
Message-ID: <4F69718E.8010603@openvz.org> (raw)
In-Reply-To: <4F692895.8020908-+CUm20s59erQFUHtdCDX3A@public.gmane.org>

KAMEZAWA Hiroyuki wrote:
> (2012/03/20 4:59), Konstantin Khlebnikov wrote:
> 
>> KAMEZAWA Hiroyuki wrote:
>>> This is just an RFC...test is not enough yet.
>>>
>>> I know it's merge window..this post is just for sharing idea.
>>>
>>> This patch merges pc->flags and pc->mem_cgroup into a word. Then,
>>> memcg's overhead will be 8bytes per page(4096bytes?).
>>>
>>> Because this patch will affect all memory cgroup developers, I'd like to
>>> show patches before MM Summit. I think we can agree the direction to
>>> reduce size of page_cgroup..and finally integrate into 'struct page'
>>> (and remove cgroup_disable= boot option...)
>>>
>>> Patch 1/3 - introduce pc_to_mem_cgroup and hide pc->mem_cgroup
>>> Patch 2/3 - remove pc->mem_cgroup
>>> Patch 3/3 - remove memory barriers.
>>>
>>> I'm now wondering when this change should be merged....
>>>
>>
>> This is cool, but maybe we should skip this temporary step and merge all this stuff into page->flags.
> 
> 
> Why we should skip and delay reduction of size of page_cgroup
> which is considered as very big problem ?

I think it would be better to solve problem completely and kill page_cgroup in one step.

> 
>> I think we can replace zone-id and node-id in page->flags with cumulative dynamically allocated lruvec-id,
>> so there will be enough space for hundred cgroups even on 32-bit systems.
> 
> 
> Where section-id  is ?
> IIUC, now, page->section->zone/node is calculated if CONFIG_SPARSEMEM.

Yeah, sections are biggest problem there. I hope we can unravel this knot.
In the worst case we can extend page->flags upto 64-bits.

> 
> BTW, I doubt that we can modify page->flags dynamically with multi-bit operations...using
> cmpxchg per each page when it's charged/uncharged/other ?

we can do atomic_xor(&page->flags, new-lruvec-id ^ old-lruvec-id) or
atomic_add(&page->flags, new-lruvec-id - old-lruvec-id) they should work faster than cmpxchg

> 
>>
>> After lru_lock splitting page to lruvec translation will be much frequently used than page to zone,
>> so page->zone and page->node translations can be implemented as page->lruvec->zone and page->lruvec->node.
>>
> 
> And need to take rcu_read_lock() around page_zone() ?

Hmm, it depends. For kernel-pages there will be pointer to root-lruvec, so no protection required.
If we hold lru_lock we also don't need this rcu_read_lock.

> 
> Thanks,
> -Kame
> 
> 
> 

  parent reply	other threads:[~2012-03-21  6:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19  7:56 [RFC][PATCH 0/3] page cgroup diet KAMEZAWA Hiroyuki
2012-03-19  7:59 ` [RFC][PATCH 1/3] memcg: add methods to access pc->mem_cgroup KAMEZAWA Hiroyuki
2012-03-19 10:58   ` Glauber Costa
     [not found]     ` <4F671138.3000508-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-03-19 12:11       ` KAMEZAWA Hiroyuki
2012-03-19 12:29         ` Glauber Costa
2012-03-19 15:33       ` Michal Hocko
2012-03-19 15:34         ` Glauber Costa
     [not found]         ` <20120319153334.GC31213-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2012-03-21  1:06           ` KAMEZAWA Hiroyuki
     [not found]   ` <4F66E773.4000807-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-22 13:11     ` Michal Hocko
2012-03-19  8:01 ` [RFC][PATCH 2/3] memcg: reduce size of struct page_cgroup KAMEZAWA Hiroyuki
2012-03-19 22:20   ` Suleiman Souhlal
     [not found]     ` <CABCjUKAr+F=Pz-JCWfjGfyL4AcHt6m97p13=0VdwjeVm5SKW7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-21  0:47       ` KAMEZAWA Hiroyuki
     [not found]   ` <4F66E7D7.4040406-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-22 13:11     ` Michal Hocko
     [not found] ` <4F66E6A5.10804-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-19  8:03   ` [RFC][PATCH 3/3] memcg: atomic update of memcg pointer and other bits KAMEZAWA Hiroyuki
2012-03-22 13:38     ` Michal Hocko
2012-03-23  1:03       ` KAMEZAWA Hiroyuki
2012-03-23  8:54         ` Michal Hocko
2012-03-19 19:59   ` [RFC][PATCH 0/3] page cgroup diet Konstantin Khlebnikov
     [not found]     ` <4F679039.6070609-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2012-03-21  1:02       ` KAMEZAWA Hiroyuki
     [not found]         ` <4F692895.8020908-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-03-21  6:13           ` Konstantin Khlebnikov [this message]
     [not found]             ` <4F69718E.8010603-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2012-03-21  6:30               ` 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=4F69718E.8010603@openvz.org \
    --to=khlebnikov-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=hughd-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=mhocko-AlSwsSmVLrQ@public.gmane.org \
    --cc=n-horiguchi-PaJj6Psr51x8UrSeD/g0lQ@public.gmane.org \
    --cc=suleiman-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=yinghan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).