From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A36E2C433EF for ; Tue, 14 Dec 2021 13:39:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF0F56B0071; Tue, 14 Dec 2021 08:38:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B79C36B0072; Tue, 14 Dec 2021 08:38:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F33F6B0074; Tue, 14 Dec 2021 08:38:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id 8B33F6B0071 for ; Tue, 14 Dec 2021 08:38:56 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4B40289064 for ; Tue, 14 Dec 2021 13:38:46 +0000 (UTC) X-FDA: 78916505052.25.920DCF3 Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) by imf18.hostedemail.com (Postfix) with ESMTP id CD1881C0005 for ; Tue, 14 Dec 2021 13:38:42 +0000 (UTC) Received: by mail-qt1-f174.google.com with SMTP id m25so18284046qtq.13 for ; Tue, 14 Dec 2021 05:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PYw3dTNxx1w6/rYOsPCI3bE5Vdi4GI8AS7An95Gx17o=; b=tUe3gF9yl7uvFOGJXnZDGunLrwNeHUsuozlge/NZ0esl2wmx+9OuT9twoBCrogJXHR U+wazLt8k85qXcdVdlEr2QiWsHWjffFixl9JczbvlcYNtmeYAEmWFswwvrf2w87ZZrvq WrBqfJpvjakwAHIhRNOhg18W8LuPvroIdKQoOQRnU++rANlMZ6I+El/IZfP6vNfWdiK8 G8BcYPbMdTezYk0AYApyD6ptaX+f18/ftVFujPLH6n561NNxDfTrp22U3edtVm0zJLLY M4kfHx2yE/xcYoqfmDuL+bzlIOAfap6ttSGzkp6IZ6XE2t7BnJ//QLefREQAx5CEcwRp 97+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PYw3dTNxx1w6/rYOsPCI3bE5Vdi4GI8AS7An95Gx17o=; b=HUVefiAKPihpUyQK6tQNdaM5A44GjQemGncnMxi2UlCRlQXMzOO1b96zLeeCgv1m6J 5Hzf0G/7d/tXPHbbwyw18RSXovKfyhXWMyTaxy98vXUywpRfDaKKLttHd4UCva1tOAJh /GFXPRNM7ujSW11HORWl4a91FYOXQZAZw1CLEERilgs7annECXqCbhH723IvcQcPcgq2 pAaVK2+IA6eyvCrQnkzKwzOgXm+5He89VB3bDttreD4NCdtMYPae5EqyDKRutMdUWHhK WqFtJB5FHpzf7NhJlnxnacd5wXcsJboXG2mXQTBUfjXfuJZlXx92HdL5DQ9Of4N4uO+e kfLg== X-Gm-Message-State: AOAM531iBnxJn/x/2pyfMLU+EckJS7t+70QPcDROtUZd7cC4hjzfIh/y qqqJVTUBXSsu91JH3J6K4g8GPw== X-Google-Smtp-Source: ABdhPJwe1RWdhQKAzec7IHklUmwTSxvNcuVGOWbGkmTG1+fmiDw0JM0mWzPgit/4twx8SXN+ZSxh3Q== X-Received: by 2002:ac8:5ccd:: with SMTP id s13mr5995548qta.510.1639489125026; Tue, 14 Dec 2021 05:38:45 -0800 (PST) Received: from localhost ([2620:10d:c091:480::1:e1e4]) by smtp.gmail.com with ESMTPSA id ay42sm7612729qkb.40.2021.12.14.05.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Dec 2021 05:38:44 -0800 (PST) Date: Tue, 14 Dec 2021 14:38:39 +0100 From: Johannes Weiner To: Muchun Song Cc: willy@infradead.org, akpm@linux-foundation.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, guro@fb.com, shy828301@gmail.com, alexs@kernel.org, richard.weiyang@gmail.com, david@fromorbit.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, jaegeuk@kernel.org, chao@kernel.org, kari.argillander@gmail.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, zhengqi.arch@bytedance.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com Subject: Re: [PATCH v4 01/17] mm: list_lru: optimize memory consumption of arrays of per cgroup lists Message-ID: References: <20211213165342.74704-1-songmuchun@bytedance.com> <20211213165342.74704-2-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211213165342.74704-2-songmuchun@bytedance.com> X-Rspamd-Queue-Id: CD1881C0005 X-Stat-Signature: ia8k3cyyxpunpszz8f5wai4hqq96fjc5 Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=tUe3gF9y; spf=pass (imf18.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.174 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Rspamd-Server: rspam10 X-HE-Tag: 1639489122-788304 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 14, 2021 at 12:53:26AM +0800, Muchun Song wrote: > The list_lru uses an array (list_lru_memcg->lru) to store pointers > which point to the list_lru_one. And the array is per memcg per node. > Therefore, the size of the arrays will be 10K * number_of_node * 8 ( > a pointer size on 64 bits system) when we run 10k containers in the > system. The memory consumption of the arrays becomes significant. The > more numa node, the more memory it consumes. The complexity for the lists themselves is still nrmemcgs * nrnodes right? But the rcu_head goes from that to nrmemcgs. > I have done a simple test, which creates 10K memcg and mount point > each in a two-node system. The memory consumption of the list_lru > will be 24464MB. After converting the array from per memcg per node > to per memcg, the memory consumption is going to be 21957MB. It is > reduces by 2.5GB. In our AMD servers, there are 8 numa nodes in > those system, the memory consumption could be more significant. The code looks good to me, but it would be useful to include a high-level overview of the new scheme, explain that the savings come from the rcu heads, that it simplifies the alloc/dealloc path etc. With that, > Signed-off-by: Muchun Song Acked-by: Johannes Weiner