From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761014Ab2D0SNg (ORCPT ); Fri, 27 Apr 2012 14:13:36 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:50697 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760968Ab2D0SNe (ORCPT ); Fri, 27 Apr 2012 14:13:34 -0400 Date: Fri, 27 Apr 2012 11:13:31 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Frederic Weisbecker cc: Glauber Costa , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, devel@openvz.org, KAMEZAWA Hiroyuki , Michal Hocko , Johannes Weiner , Greg Thelen , Suleiman Souhlal , Christoph Lameter , Pekka Enberg Subject: Re: [PATCH 17/23] kmem controller charge/uncharge infrastructure In-Reply-To: <20120427113841.GB3514@somewhere.redhat.com> Message-ID: References: <1334959051-18203-1-git-send-email-glommer@parallels.com> <1335138820-26590-6-git-send-email-glommer@parallels.com> <20120424142232.GC8626@somewhere> <20120427113841.GB3514@somewhere.redhat.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) 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 On Fri, 27 Apr 2012, Frederic Weisbecker wrote: > > No, because memory is represented by mm_struct, not task_struct, so you > > must charge to p->mm->owner to allow for moving threads amongst memcgs > > later for memory.move_charge_at_immigrate. You shouldn't be able to > > charge two different memcgs for memory represented by a single mm. > > The idea I had was more that only the memcg of the thread that does the allocation > is charged. But the problem is that this allocation can be later deallocated > from another thread. So probably charging the owner is indeed the only sane > way to go with user memory. > It's all really the same concept: if we want to move memory of a process, willingly free memory in the process itself, or free memory of a process by way of the oom killer, we need a way to do that for the entire process so the accounting makes sense afterwards. And since we have that requirement for user memory, it makes sense that its consistent with slab as well. I don't think a thread of a process should be able to charge slab to one memcg while its user memory is charged to another memcg.