Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2909313ybt; Mon, 22 Jun 2020 09:59:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxWJHT0XywwIdiFNcpLptWyRWy4p6tpwK79h+ewUPOAHGNRJndMoGDT1OabVqi3PP02tJW X-Received: by 2002:a17:906:93f7:: with SMTP id yl23mr16449801ejb.366.1592845147340; Mon, 22 Jun 2020 09:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592845147; cv=none; d=google.com; s=arc-20160816; b=lG87tqS5PCDo8wMxZDwYNOAVWkYWVTfOWr/JM4d6fThQej7PuIbsCriVD75I3lXv2Y EkL9vw3qphB8GDk0hJwhMv58MRFyKFxkoqzBwTKQek/Y5vpQ/tVXlWcHziuDwqfnlhkY 5vldQgEoCZ8hbtEbXaw/54+cxoSNyS5QYVz5BTVjJ0plDixVWT7qP5fpO9DYGh1rTQtu n2Ay1r4GGKZUfhoftwjm5v/TdJ1s61RTzvl2beyg0KQT86TCuODciGR0chDfQ6DM/Uah kAHfdTS7tvSPkKNSl2Z49MW/b5/qWZLQIDQ6DgJ+Ur42iN9vhnBqdG6QHLDs+4DEf06L v7PA== 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=G56zBNbNj4Y3AhZRviN3/Dliwnmszp2+kuGZcYcuXG4=; b=KvYQKULOyQiZoOTic75KC4xDpKcYZvyyAkjFYR95gylQU9fYBAszX+cMS4Uak7wkHt az0HZrVxnLu63KybjqH28aLRL4CndxFJKH5qDcb96RUiweTYMs2BAoSxv6xdfiyCFJuS kSakSB84z+QYRo0i2sUsDNjkKczAFDzvx3kOwpg49wbXVVQyT+4bbj9HbMB0RbDXz8Ht BZhqSJBuS56Aof5a7/WJRWlFRihkQ9/9K8I0aZ5wV2NwkWkBn4lhxVTtqb3mlmAhgqlx QQLajMvuJ4xARs+Ns2f3H21qrx2hP1aCprptb8ZP9z5Nc/woLveEJdm0j+pYwmUqM7t7 qABw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UARv+KNJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id v7si4970117edd.252.2020.06.22.09.58.45; Mon, 22 Jun 2020 09:59:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UARv+KNJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729822AbgFVQ44 (ORCPT + 99 others); Mon, 22 Jun 2020 12:56:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729519AbgFVQ4z (ORCPT ); Mon, 22 Jun 2020 12:56:55 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C070C061573 for ; Mon, 22 Jun 2020 09:56:54 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id o4so10048599lfi.7 for ; Mon, 22 Jun 2020 09:56:54 -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=G56zBNbNj4Y3AhZRviN3/Dliwnmszp2+kuGZcYcuXG4=; b=UARv+KNJ4IB6uvPhHnkaASaBO2vDIEAMREBIbByZVBFC0SPsL8qncmblpxRoI4JhYN ILm+FhPJQkpJwbeD0auf/LVMUJ3xxZ8g0aHv4vAlokd+dgstpyte3AuJDIZoFnK+DMRO Tb03VRZG77XLcq1guQ+3SH1IgIfRyqMHwejTPNXu9o+nDnqpLZqfJmXI/fki9tbO5xqA QeodAxelUumcXGY6AVNRpVSNNsN8GrcWs/SZjX+Zs58UN7nty71TfQMCBEDWyLM378YW 37HUgm+71D1TUTxh4Ek8uRoPMHYAD3VINYLco9JXvyMnrpyVcjo90UXk8IR6+Eky1Gv1 BlIQ== 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=G56zBNbNj4Y3AhZRviN3/Dliwnmszp2+kuGZcYcuXG4=; b=IpIK1iu8FYCZgwKT0lpJ0CecHZJlfjAz3f2+P4Jznkf+JnUW3YWS7wGCPVkQc73Kat pwYs3eL2x8kj/tl87IPCVqX1JJ4kDut7T8a7ddgsRl7W7Km/NttPcJd1WKcdrXSab+cT mxuIdY4VCK8PyIPCEErcB8+1Lr99GegeUJHTVEG2ArqTHwPZYe5gHeg6dHt0hTt9mfI4 51QdlJKYmIWzEbpcni4mMg+6il747V0ZZIzzXV5WzFZwmgF3B9SO0l4AsxpNP4McW2qp IZVbcQvodpiVEn8eXLyBBa5dD+dCkSfDeOXXroEpfLuHelqDz+0Bjuu4s1mHVhhZbHAu zgwg== X-Gm-Message-State: AOAM530ufBAe0RBkwRxflBI0PFiso+m+n4xuwm37cHBTIvCbkDu8hV91 WUksQofU7NXnpUlcpgKjlFjHXrFIFUSaqZH9Uxt6tg== X-Received: by 2002:a05:6512:10c3:: with SMTP id k3mr10462732lfg.33.1592845012258; Mon, 22 Jun 2020 09:56:52 -0700 (PDT) MIME-Version: 1.0 References: <20200608230654.828134-1-guro@fb.com> <20200608230654.828134-13-guro@fb.com> In-Reply-To: <20200608230654.828134-13-guro@fb.com> From: Shakeel Butt Date: Mon, 22 Jun 2020 09:56:41 -0700 Message-ID: Subject: Re: [PATCH v6 12/19] mm: memcg/slab: use a single set of kmem_caches for all accounted allocations To: Roman Gushchin Cc: Andrew Morton , Christoph Lameter , Johannes Weiner , Michal Hocko , Linux MM , Vlastimil Babka , Kernel Team , LKML 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 Mon, Jun 8, 2020 at 4:07 PM Roman Gushchin wrote: > > This is fairly big but mostly red patch, which makes all accounted > slab allocations use a single set of kmem_caches instead of > creating a separate set for each memory cgroup. > > Because the number of non-root kmem_caches is now capped by the number > of root kmem_caches, there is no need to shrink or destroy them > prematurely. They can be perfectly destroyed together with their > root counterparts. This allows to dramatically simplify the > management of non-root kmem_caches and delete a ton of code. > > This patch performs the following changes: > 1) introduces memcg_params.memcg_cache pointer to represent the > kmem_cache which will be used for all non-root allocations > 2) reuses the existing memcg kmem_cache creation mechanism > to create memcg kmem_cache on the first allocation attempt > 3) memcg kmem_caches are named -memcg, > e.g. dentry-memcg > 4) simplifies memcg_kmem_get_cache() to just return memcg kmem_cache > or schedule it's creation and return the root cache > 5) removes almost all non-root kmem_cache management code > (separate refcounter, reparenting, shrinking, etc) > 6) makes slab debugfs to display root_mem_cgroup css id and never > show :dead and :deact flags in the memcg_slabinfo attribute. > > Following patches in the series will simplify the kmem_cache creation. > > Signed-off-by: Roman Gushchin > Reviewed-by: Vlastimil Babka This is a very satisfying patch. Reviewed-by: Shakeel Butt