Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp94638ybd; Tue, 25 Jun 2019 17:17:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvxnjl3nNl9dGSgHtO/LU7JEp5OIBloAys8AAPPt8fg+yH6YR03YggLPXSQG7a2+xdg1G2 X-Received: by 2002:a17:90a:c481:: with SMTP id j1mr731244pjt.96.1561508278190; Tue, 25 Jun 2019 17:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561508278; cv=none; d=google.com; s=arc-20160816; b=sX9S8USSBvcImJQuJxFMOOjdMfXTkD+EUBPh/c+1GFtbtgrA7yxFNv3WmIYUc5QxqN b1shplwe8LMQdUDKfHgqnqlN8vJ1LcUjqNYZ6I7T1v4xt+4EKuCnPlAOKNM/0dsocdyh BzFuM0xNflOcA17+wQVo/OH1mizui/APhcusWEeGU/1OO8vLIJioB4nNjiobssfe59nO uLTfvTlRMBM/JUiW87ZhI9QK8Aa/rLVZsvoPwFhCluBAvzixUKbjwrKAPYcIpqiAvbwL pQEQA2yr0tXwr21tj5GoTH9mlTO7p0QFeGqYXZepJnbgZBC9SiPxllBme9xpDSg13TV9 zxzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9hBC31XsM1drX/BZAp0N2OzT0r+e6co+lkmZ6G0GOVU=; b=MatHb6JNgJa3o3KLxou/SY4qJDVqtoWLcBzKImiSp8DCb+Rbg+UasaX4l8N9dTxVpj FOY3l8Vsev7d88i5YRz2m0ITtr2UlcXU9d837Y/UudKym6O2gYfxftAhxic45YoO076d tiyxp6vek11YD3DzDLVadc355c7w0uEN1lhl5AMM5wB0yjooxnX6fOgT2QRVoT7WORWT s2/0G6Q68cCNkJp2BK/jTpQWABkcaUPTFotGh7OtIYIW+7CkNaZeHC7afEEAkaiGPcPP KUV1OiO2G2NIVgwqbXr4M6BygEJnkU9Uc+Fs0To9iJdsk1XjzRxQbqODVe8f+UNf3N4o 779w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=pVlUNDcM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m185si10394296pgm.421.2019.06.25.17.17.42; Tue, 25 Jun 2019 17:17:58 -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=@google.com header.s=20161025 header.b=pVlUNDcM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726407AbfFZAQA (ORCPT + 99 others); Tue, 25 Jun 2019 20:16:00 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:40146 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfFZAQA (ORCPT ); Tue, 25 Jun 2019 20:16:00 -0400 Received: by mail-yb1-f196.google.com with SMTP id i14so273711ybp.7 for ; Tue, 25 Jun 2019 17:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9hBC31XsM1drX/BZAp0N2OzT0r+e6co+lkmZ6G0GOVU=; b=pVlUNDcM4cTi+agb1ezQeSRdpds872gA7cb6ZJ+baveCQCZw167X+Pb0NoSrYCPnIZ sf2SLj7IntgrbvnK4d70pRjkOHGKLkGjpCUUeY1KiNj4MKlhKC7A60xtgR4RarZVhHa8 wUZY/HAv8uD8BwX9pcaLVVV9tVpVaTKtHLevMa/qA4Y4yPsSIy/xJzezpaGNRWYRP9dL rUx+O8OaqM4GcgiHUT/QEEjFbkksKz10UfVJ98MwhivQPhcj7ocX9O1xHW8OSBY7TaUw YHKHz2eNMBMhLFeUUtjp5QOHRhrZ9fxu2wmFJEC2OJjqXK3sJenC0N1OVW3pJNyS1pxO BwdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9hBC31XsM1drX/BZAp0N2OzT0r+e6co+lkmZ6G0GOVU=; b=aoeuuNCYiqixpwhLq0zKz5QtPQajsyXT54QMYsV+SbHN1pM5cEPzqhpFSsrhgSm2sw FLfwAF1pnhBm1o/3QsieDXYnq0olmdEWHzkXVfLQiVyVMxYuPMYzdSM9rhHDKGoZp7KU EVXsosLz1Q8DNuCxUqsbsnKYQENxtnO+vcM+PJ73a6I9BnGJ1BjOoJPVThAiojMwK75T Lp+EjIUCVR4KGnWl33gP2vwIVZ0M3SelzI1poVXFn208C1WjLo3FVyIZ0gLcKTRpHX1D MOdZJsEVVQjB7Vqj2ZdgQjVPJj4JZD2JvQ1NUkjXujkjJQ61vJDPy/aGJqilhk7pNGxc mS3Q== X-Gm-Message-State: APjAAAXuJy1XtW+rC/QE2koOJ25FXm0tEqE4sb9T17zbq7BtKtlskj4X 5WWP12E3qndUpVX6QMGNxMybiuLTXCrxZbvl3lT2gw== X-Received: by 2002:a25:a107:: with SMTP id z7mr790646ybh.165.1561508159394; Tue, 25 Jun 2019 17:15:59 -0700 (PDT) MIME-Version: 1.0 References: <20190611231813.3148843-1-guro@fb.com> <20190611231813.3148843-10-guro@fb.com> In-Reply-To: <20190611231813.3148843-10-guro@fb.com> From: Shakeel Butt Date: Tue, 25 Jun 2019 17:15:48 -0700 Message-ID: Subject: Re: [PATCH v7 09/10] mm: stop setting page->mem_cgroup pointer for slab pages To: Roman Gushchin Cc: Andrew Morton , Vladimir Davydov , Linux MM , LKML , Kernel Team , Johannes Weiner , Waiman Long Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 11, 2019 at 4:18 PM 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 Reviewed-by: Shakeel Butt