Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753628Ab0G1GRV (ORCPT ); Wed, 28 Jul 2010 02:17:21 -0400 Received: from smtp-out.google.com ([74.125.121.35]:43748 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752012Ab0G1GRU (ORCPT ); Wed, 28 Jul 2010 02:17:20 -0400 DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:references:date:in-reply-to:message-id: user-agent:mime-version:content-type; b=itPBae0YGees4WIODXvwTlbOcqHokCpwTwve9pwgEr3K4mbyPwAce9ezvNFdjpvo2 J7E/JoP0Sj1QD9w2BD0Bw== From: Greg Thelen To: KAMEZAWA Hiroyuki Cc: "linux-mm\@kvack.org" , "nishimura\@mxp.nes.nec.co.jp" , "balbir\@linux.vnet.ibm.com" , m-ikeda@ds.jp.nec.com, "akpm\@linux-foundation.org" , "linux-kernel\@vger.kernel.org" Subject: Re: [RFC][PATCH 7/7][memcg] use spin lock instead of bit_spin_lock in page_cgroup References: <20100727165155.8b458b7f.kamezawa.hiroyu@jp.fujitsu.com> <20100727170225.64f78b15.kamezawa.hiroyu@jp.fujitsu.com> Date: Tue, 27 Jul 2010 23:16:54 -0700 In-Reply-To: <20100727170225.64f78b15.kamezawa.hiroyu@jp.fujitsu.com> (KAMEZAWA Hiroyuki's message of "Tue, 27 Jul 2010 17:02:25 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2791 Lines: 84 KAMEZAWA Hiroyuki writes: > From: KAMEZAWA Hiroyuki > > This patch replaces page_cgroup's bit_spinlock with spinlock. In general, > spinlock has good implementation than bit_spin_lock and we should use > it if we have a room for it. In 64bit arch, we have extra 4bytes. > Let's use it. > > Signed-off-by: KAMEZAWA Hiroyuki > -- > Index: mmotm-0719/include/linux/page_cgroup.h > =================================================================== > --- mmotm-0719.orig/include/linux/page_cgroup.h > +++ mmotm-0719/include/linux/page_cgroup.h > @@ -10,8 +10,14 @@ > * All page cgroups are allocated at boot or memory hotplug event, > * then the page cgroup for pfn always exists. > */ > +#ifdef CONFIG_64BIT > +#define PCG_HAS_SPINLOCK > +#endif > struct page_cgroup { > unsigned long flags; > +#ifdef PCG_HAS_SPINLOCK > + spinlock_t lock; > +#endif > unsigned short mem_cgroup; /* ID of assigned memory cgroup */ > unsigned short blk_cgroup; /* Not Used..but will be. */ > struct page *page; > @@ -90,6 +96,16 @@ static inline enum zone_type page_cgroup > return page_zonenum(pc->page); > } > > +#ifdef PCG_HAS_SPINLOCK > +static inline void lock_page_cgroup(struct page_cgroup *pc) > +{ > + spin_lock(&pc->lock); > +} This is minor issue, but this patch breaks usage of PageCgroupLocked(). Example from __mem_cgroup_move_account() cases panic: VM_BUG_ON(!PageCgroupLocked(pc)); I assume that this patch should also delete the following: - PCG_LOCK definition from page_cgroup.h - TESTPCGFLAG(Locked, LOCK) from page_cgroup.h - PCGF_LOCK from memcontrol.c > +static inline void unlock_page_cgroup(struct page_cgroup *pc) > +{ > + spin_unlock(&pc->lock); > +} > +#else > static inline void lock_page_cgroup(struct page_cgroup *pc) > { > bit_spin_lock(PCG_LOCK, &pc->flags); > @@ -99,6 +115,7 @@ static inline void unlock_page_cgroup(st > { > bit_spin_unlock(PCG_LOCK, &pc->flags); > } > +#endif > > static inline void SetPCGFileFlag(struct page_cgroup *pc, int idx) > { > Index: mmotm-0719/mm/page_cgroup.c > =================================================================== > --- mmotm-0719.orig/mm/page_cgroup.c > +++ mmotm-0719/mm/page_cgroup.c > @@ -17,6 +17,9 @@ __init_page_cgroup(struct page_cgroup *p > pc->mem_cgroup = 0; > pc->page = pfn_to_page(pfn); > INIT_LIST_HEAD(&pc->lru); > +#ifdef PCG_HAS_SPINLOCK > + spin_lock_init(&pc->lock); > +#endif > } > static unsigned long total_usage; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/