Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759356AbYFDJNS (ORCPT ); Wed, 4 Jun 2008 05:13:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753310AbYFDJNF (ORCPT ); Wed, 4 Jun 2008 05:13:05 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:57572 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752701AbYFDJNE (ORCPT ); Wed, 4 Jun 2008 05:13:04 -0400 Date: Wed, 4 Jun 2008 18:18:08 +0900 From: KAMEZAWA Hiroyuki To: "Paul Menage" Cc: "linux-mm@kvack.org" , LKML , "balbir@linux.vnet.ibm.com" , "xemul@openvz.org" , "yamamoto@valinux.co.jp" Subject: Re: [RFC][PATCH 1/2] memcg: res_counter hierarchy Message-Id: <20080604181808.70c86e05.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <6599ad830806040159i4dfd8350w54e41c5ba4e0c8c4@mail.gmail.com> References: <20080604135815.498eaf82.kamezawa.hiroyu@jp.fujitsu.com> <20080604140153.fec6cc99.kamezawa.hiroyu@jp.fujitsu.com> <6599ad830806040159i4dfd8350w54e41c5ba4e0c8c4@mail.gmail.com> Organization: Fujitsu X-Mailer: Sylpheed 2.4.2 (GTK+ 2.10.11; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1654 Lines: 43 On Wed, 4 Jun 2008 01:59:31 -0700 "Paul Menage" wrote: > On Tue, Jun 3, 2008 at 10:01 PM, KAMEZAWA Hiroyuki > wrote: > > int ret; > > char *buf, *end; > > @@ -133,13 +145,101 @@ ssize_t res_counter_write(struct res_cou > > if (*end != '\0') > > goto out_free; > > } > > - spin_lock_irqsave(&counter->lock, flags); > > - val = res_counter_member(counter, member); > > - *val = tmp; > > - spin_unlock_irqrestore(&counter->lock, flags); > > - ret = nbytes; > > + if (set_strategy) { > > + ret = set_strategy(res, tmp, member); > > + if (!ret) > > + ret = nbytes; > > + } else { > > + spin_lock_irqsave(&counter->lock, flags); > > + val = res_counter_member(counter, member); > > + *val = tmp; > > + spin_unlock_irqrestore(&counter->lock, flags); > > + ret = nbytes; > > + } > > I think that the hierarchy/reclaim handling that you currently have in > the memory controller should be here; the memory controller should > just be able to pass a reference to try_to_free_mem_cgroup_pages() and > have everything else handled by res_counter. > Sounds reasonable. I'll re-design the whole AMAP. I think I can do more. Thanks, -Kame -- 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/