Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp533791pxb; Wed, 14 Apr 2021 23:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhPBt/x2PNKsK+dHgAyGr82M68seBh5op/4RQUdrHK5cSFeBCrZTHnJXJvBnEoFls8XDQ9 X-Received: by 2002:a17:906:314f:: with SMTP id e15mr1911936eje.30.1618469891976; Wed, 14 Apr 2021 23:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618469891; cv=none; d=google.com; s=arc-20160816; b=xXYInofKNJRqvfB99j+0z77YT3v4yCq9XXogWMS/5k+WjRXWPogZMnSDuphQed8nNP cQe/Uos3Eh+2H6qR0BrEA7J/anoSeudmb5cnbY99nT/dc2+CGAZ9PvH8HZg6t3IOyAQd eDs9PEhQ/4kRk/sMiHwEGi1BMiNuNnDq+b1VLqu86H5MtxLydMYO5sScfhzMcHGNTbjM usV9UhkUzqPGaPe3nbhZ2s8eaE4CCuDMMiWpiO/TXb5bOXIfN/IGB2lKyPqIdnuOPvUU FCDrMkYFhMrA5cDMBP5Ibg59JFxnK0N1cUZg3LXxO53vda/6dpEzkK6jCQHhBMmYl2GB 9n6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=j/VjSYO1zorqpOQ4YycM3fmnEbt1KvREwl3ylHFycHU=; b=hzA9ge6lYM2+PLxhQ5IszGaCkP46uQLrkec/o38Y0bi/2QcG5RPHVOWuwgCBBrw/TP N8bs6fr4cJALcVBG/6UkCD20auYYOcrxDwjagM7YSIcsJYjNFBurd3fmT7xYkcpWzK7Y VQrZvJkKEu7P16JwnfCaM7ogTn9zUhbjGftvMjJkZF/Z2EgucL2Q8pnvCE1LZSeBlPVg oed9lcCtWtLWbE/eBl9YiFBV99u+jt4yqREt7kuvegr7ModD9b1lcl4ERXOc1vjH93IE 2bVCWjyu+yj/7duTVXq9OHVVMxxcsrlK1rRASN3KXIe4cppPA/chk8EVHoDGNSKS+1h0 h2rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="g7/4fTEI"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si1681683edd.73.2021.04.14.23.57.48; Wed, 14 Apr 2021 23:58:11 -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=@suse.com header.s=susede1 header.b="g7/4fTEI"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230499AbhDOGzI (ORCPT + 99 others); Thu, 15 Apr 2021 02:55:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:33942 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbhDOGzI (ORCPT ); Thu, 15 Apr 2021 02:55:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618469684; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j/VjSYO1zorqpOQ4YycM3fmnEbt1KvREwl3ylHFycHU=; b=g7/4fTEIxZhyajLVOgkJMP3lwGZMq9VRALcEHWWBXpLVvpeJUslhn+FtURU6S8+fjWcyp1 w7Gkq5F2/9qtbghqXrsvKOxyn7JVDtY6nbMlr+Er+Kdq/HATCSRZOCzLtjLpcYLK9kB8Ok 6r7bW/HMVTbK7lgjbIx2TmANl/W4L7E= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D09BCAFF8; Thu, 15 Apr 2021 06:54:43 +0000 (UTC) Date: Thu, 15 Apr 2021 08:54:43 +0200 From: Michal Hocko To: Bharata B Rao Cc: Dave Chinner , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, aneesh.kumar@linux.ibm.com Subject: Re: High kmalloc-32 slab cache consumption with 10k containers Message-ID: References: <20210405054848.GA1077931@in.ibm.com> <20210406222807.GD1990290@dread.disaster.area> <20210415052300.GA1662898@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210415052300.GA1662898@in.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 15-04-21 10:53:00, Bharata B Rao wrote: > On Wed, Apr 07, 2021 at 08:28:07AM +1000, Dave Chinner wrote: > > > > Another approach may be to identify filesystem types that do not > > need memcg awareness and feed that into alloc_super() to set/clear > > the SHRINKER_MEMCG_AWARE flag. This could be based on fstype - most > > virtual filesystems that expose system information do not really > > need full memcg awareness because they are generally only visible to > > a single memcg instance... > > Would something like below be appropriate? No. First of all you are defining yet another way to say SHRINKER_MEMCG_AWARE which is messy. And secondly why would shmem, proc and ramfs be any special and they would be ok to opt out? There is no single word about that reasoning in your changelog. > >From f314083ad69fde2a420a1b74febd6d3f7a25085f Mon Sep 17 00:00:00 2001 > From: Bharata B Rao > Date: Wed, 14 Apr 2021 11:21:24 +0530 > Subject: [PATCH 1/1] fs: Let filesystems opt out of memcg awareness > > All filesystem mounts by default are memcg aware and end hence > end up creating shrinker list_lrus for all the memcgs. Due to > the way the memcg_nr_cache_ids grow and the list_lru heads are > allocated for all memcgs, huge amount of memory gets consumed > by kmalloc-32 slab cache when running thousands of containers. > > Improve this situation by allowing filesystems to opt out > of memcg awareness. In this patch, tmpfs, proc and ramfs > opt out of memcg awareness. This leads to considerable memory > savings when running 10k containers. > > Signed-off-by: Bharata B Rao > --- > fs/proc/root.c | 1 + > fs/ramfs/inode.c | 1 + > fs/super.c | 27 +++++++++++++++++++-------- > include/linux/fs_context.h | 2 ++ > mm/shmem.c | 1 + > 5 files changed, 24 insertions(+), 8 deletions(-) [...] -- Michal Hocko SUSE Labs