cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-mm@kvack.org, cgroups@vger.kernel.org,
	Johannes Weiner <hannes@cmpxchg.org>,
	Hugh Dickins <hughd@google.com>, Han Ying <yinghan@google.com>,
	Glauber Costa <glommer@parallels.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	suleiman@google.com, n-horiguchi@ah.jp.nec.com,
	khlebnikov@openvz.org, Tejun Heo <tj@kernel.org>
Subject: Re: [RFC][PATCH 3/3] memcg: atomic update of memcg pointer and other bits.
Date: Fri, 23 Mar 2012 10:03:13 +0900	[thread overview]
Message-ID: <4F6BCBD1.1030602@jp.fujitsu.com> (raw)
In-Reply-To: <20120322133820.GE18665@tiehlicka.suse.cz>

(2012/03/22 22:38), Michal Hocko wrote:

> On Mon 19-03-12 17:03:42, KAMEZAWA Hiroyuki wrote:
> [...]
>> @@ -1237,8 +1237,6 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
>>  	pc = lookup_page_cgroup(page);
>>  	if (!PageCgroupUsed(pc))
>>  		return NULL;
>> -	/* Ensure pc's mem_cgroup is visible after reading PCG_USED. */
>> -	smp_rmb();
>>  	mz = page_cgroup_zoneinfo(pc_to_mem_cgroup(pc), page);
>>  	return &mz->reclaim_stat;
>>  }
>> @@ -2491,16 +2489,7 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *memcg,
>>  		}
>>  	}
>>  
>> -	pc_set_mem_cgroup(pc, memcg);
>> -	/*
>> -	 * We access a page_cgroup asynchronously without lock_page_cgroup().
>> -	 * Especially when a page_cgroup is taken from a page, pc's mem_cgroup
>> -	 * is accessed after testing USED bit. To make pc's mem_cgroup visible
>> -	 * before USED bit, we need memory barrier here.
>> -	 * See mem_cgroup_add_lru_list(), etc.
>> - 	 */
>> -	smp_wmb();
>> -	SetPageCgroupUsed(pc);
>> +	pc_set_mem_cgroup(pc, memcg, BIT(PCG_USED) | BIT(PCG_LOCK));
> 
> This is not nice. Maybe we need two variants (pc_set_mem_cgroup[_flags])?
> 


Sure. I'll add that.


>>  	if (lrucare) {
>>  		if (was_on_lru) {
>> @@ -2529,7 +2518,6 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *memcg,
>>  
>>  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>>  
>> -#define PCGF_NOCOPY_AT_SPLIT ((1 << PCG_LOCK) | (1 << PCG_MIGRATION))
>>  /*
>>   * Because tail pages are not marked as "used", set it. We're under
>>   * zone->lru_lock, 'splitting on pmd' and compound_lock.
>> @@ -2547,9 +2535,7 @@ void mem_cgroup_split_huge_fixup(struct page *head)
>>  		return;
>>  	for (i = 1; i < HPAGE_PMD_NR; i++) {
>>  		pc = head_pc + i;
>> -		pc_set_mem_cgroup(pc, memcg);
>> -		smp_wmb();/* see __commit_charge() */
>> -		pc->flags = head_pc->flags & ~PCGF_NOCOPY_AT_SPLIT;
>> +		pc_set_mem_cgroup(pc, memcg, BIT(PCG_USED));
> 
> Maybe it would be cleaner to remove PCGF_NOCOPY_AT_SPLIT in a separate patch with 
> VM_BUG_ON(!head_pc->flags & BIT(PCG_USED))?
> 


Hm, ok. I'll divide this patch.

>>  	}
>>  }
>>  #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
>> @@ -2616,7 +2602,7 @@ static int mem_cgroup_move_account(struct page *page,
>>  		__mem_cgroup_cancel_charge(from, nr_pages);
>>  
>>  	/* caller should have done css_get */
>> -	pc_set_mem_cgroup(pc, to);
>> +	pc_set_mem_cgroup(pc, to, BIT(PCG_USED) | BIT(PCG_LOCK));
> 
> Same here.
> 


pc_set_mem_cgroup_flags() ?

Thanks,
-Kame

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

  reply	other threads:[~2012-03-23  1:03 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 [this message]
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
     [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=4F6BCBD1.1030602@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cgroups@vger.kernel.org \
    --cc=glommer@parallels.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=khlebnikov@openvz.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=suleiman@google.com \
    --cc=tj@kernel.org \
    --cc=yinghan@google.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;
as well as URLs for NNTP newsgroup(s).