Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2376915ybi; Sun, 9 Jun 2019 10:12:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW5aJCii5g3Gsi1HJ3RbZu9NQK3Af5v0I0g7oB0HA43FH1xh0LkEj3tFD0f3fYsHtb3ywN X-Received: by 2002:a17:902:760f:: with SMTP id k15mr41620531pll.125.1560100352587; Sun, 09 Jun 2019 10:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560100352; cv=none; d=google.com; s=arc-20160816; b=Hb3tNf08An5nGzFEqFcaRvgErtWIJoyIUTm+gauIXXcPLUZIQ7XS55bvYeisP+K6N8 p0kk5FGmZ3yDOwEhQ02jb/Dj15xYYJV7oXSi4sIoSsYz/LWkBL8miRdGVbk62o6rVbcg OUfTfv9FMYA7KInJdasEbpxUopSKCxC7ZgUnfTY8PV7EspdCOXkstVt5Zi048JEiQWe+ /xcJVMNFD42bZ+xEJ289hLhLjZyvYoUTPAExvtQW/zeDLi7xr3P6OYMPuzSLB1E1M6/j ytOaJcMwSRKVnJsTLvJpPGexlbCBF1VTq6N/OlLrF9DKEae6JCFB3kHsJf9QHsk253kn /vUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LznUc87kOzY43gG7GqM3uuB+dRBgbcnhswA/OnlhqSI=; b=Pu1HmW13k5o0dtr8EBikPkhVdJmo34zkd4iEk7Rw6FF8wFoHsVwN3PhtyOwaRRycgc otpC17Oevn8nOsG/BG4PelmmGte7q5ErBh4OK9C8YW+/mhQaQp3B4f315Upyqi1wOgqi X2QZPZ3gTjUT9GEVBTdWZaKU2lUqn0X2gmZlqXq01DrBSMCzBmraRU4iAJq9a+D103/5 f0Hw3Ql27Bl1oRKbdwO0ti63ok3blX5kL/XuH7KiNC5D97nl8xaeOQz1LM+rbjgN3NtU UgkmKaM7LZ08mnegO6X30ImnpE51QGNrfI0+UXjBDNpymOFYF7L/BhvCTCX5YJGOfsFF 2SFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iRanUUu1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si7514704pgh.21.2019.06.09.10.12.16; Sun, 09 Jun 2019 10:12:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iRanUUu1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388976AbfFIRJf (ORCPT + 99 others); Sun, 9 Jun 2019 13:09:35 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42273 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388549AbfFIRJd (ORCPT ); Sun, 9 Jun 2019 13:09:33 -0400 Received: by mail-lj1-f194.google.com with SMTP id t28so5793875lje.9 for ; Sun, 09 Jun 2019 10:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LznUc87kOzY43gG7GqM3uuB+dRBgbcnhswA/OnlhqSI=; b=iRanUUu1JtHll99gtTKBlOGAMCDt8WvFcIqAZrrJoVIxcg56HvmrRG2hEUVZqosEjY Oo/YhOn8KaZV9XTNdFolb091lW/+VrIJnibQnj14x2yT0UPHDUY9fUAS8dH0V29tW1xf 4O7Dxvd4my18SNZvsB/sjKMXcE6cuvl8yNyVGZ7mtOyIm49EjP9YQDirCIdYKf0Np0Pg MAaGRfC/jvONh+OhXxtd+P8/856HGdn3/Rdjn3LcGBLXLtwRnF2kScbn9d0+BeW8603f tWAzG7rkKyEwSwXhJTmaL6qfX27aB65/m9HS9p6eTNEmC4sY6bDEK9zVR+klP5E/Vaq4 jPfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LznUc87kOzY43gG7GqM3uuB+dRBgbcnhswA/OnlhqSI=; b=ExMdGjnloVakWolK4B0Redvj2UBzWlm13KuBOBJ0IXoUkt4CBt16rb5C5ViFWreq+d 58MFgTIwA7GigLUhd4fbyZGXOugOvCMHSJqiFdz1nrkxm0BjOe+KcIoYt69XHIcmqEmw uhwFZnpImi6ushc+ZuilRnGaYWHwkg8Lgc6UoO23LwPQeOKnSXTnLf40U9Fdzs+goFPQ O8OT5g09OJJ260yBlYN4ekCjPlqEiwrpyyd0OweUp/R26ZaCbYPV7EzMI3njp4wePFd8 8txhumayw8ehpidcqT1aqncT0WUpwswzgkEM2x9D+3TYlwa5hsxFD+T8lFBuBR6H41qs Lc4Q== X-Gm-Message-State: APjAAAWkoVljjDQObND9+uEbekeapPSJFea7WLSv6JjsPxJM4P3DTx8d zGYdWaVhTHkYnD8IRHojQ+U= X-Received: by 2002:a2e:8195:: with SMTP id e21mr12057526ljg.62.1560100171209; Sun, 09 Jun 2019 10:09:31 -0700 (PDT) Received: from esperanza ([176.120.239.149]) by smtp.gmail.com with ESMTPSA id u18sm396497ljj.32.2019.06.09.10.09.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 Jun 2019 10:09:30 -0700 (PDT) Date: Sun, 9 Jun 2019 20:09:28 +0300 From: Vladimir Davydov To: Roman Gushchin Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, Johannes Weiner , Shakeel Butt , Waiman Long Subject: Re: [PATCH v6 09/10] mm: stop setting page->mem_cgroup pointer for slab pages Message-ID: <20190609170928.wetyjpueslcj3qft@esperanza> References: <20190605024454.1393507-1-guro@fb.com> <20190605024454.1393507-10-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190605024454.1393507-10-guro@fb.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 04, 2019 at 07:44:53PM -0700, Roman Gushchin wrote: > Every slab page charged to a non-root memory cgroup has a pointer > to the memory cgroup and holds a reference to it, which protects > a non-empty memory cgroup from being released. At the same time > the page has a pointer to the corresponding kmem_cache, and also > hold a reference to the kmem_cache. And kmem_cache by itself > holds a reference to the cgroup. > > So there is clearly some redundancy, which allows to stop setting > the page->mem_cgroup pointer and rely on getting memcg pointer > indirectly via kmem_cache. Further it will allow to change this > pointer easier, without a need to go over all charged pages. > > So let's stop setting page->mem_cgroup pointer for slab pages, > and stop using the css refcounter directly for protecting > the memory cgroup from going away. Instead rely on kmem_cache > as an intermediate object. > > Make sure that vmstats and shrinker lists are working as previously, > as well as /proc/kpagecgroup interface. > > Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov