Message ID | 20211220085649.8196-8-songmuchun@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 044B2C433F5 for <linux-mm@archiver.kernel.org>; Mon, 20 Dec 2021 08:58:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 964746B0081; Mon, 20 Dec 2021 03:58:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 914A06B0082; Mon, 20 Dec 2021 03:58:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DCD86B0083; Mon, 20 Dec 2021 03:58:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0234.hostedemail.com [216.40.44.234]) by kanga.kvack.org (Postfix) with ESMTP id 6DF9D6B0081 for <linux-mm@kvack.org>; Mon, 20 Dec 2021 03:58:31 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2D7D789084 for <linux-mm@kvack.org>; Mon, 20 Dec 2021 08:58:31 +0000 (UTC) X-FDA: 78937571622.04.262721E Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 07B36160039 for <linux-mm@kvack.org>; Mon, 20 Dec 2021 08:58:24 +0000 (UTC) Received: by mail-pg1-f172.google.com with SMTP id d11so8818952pgl.1 for <linux-mm@kvack.org>; Mon, 20 Dec 2021 00:58:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y++panFifneasGq960GJtHjLst8uLUglPFxOcyVBRks=; b=8TvIWV4OcYjjwOFikHz5icX5EPwoGVd0G0cgNnPZ3OwEVCd1pU0l0TJ8kMAJsPK9RM PRN4azkexQwIGxX7faj/qui7DqF2/6qbwIrig1emlHBmVHQtiuJgzZaDIoVdcE/hIYRa f/oN6byDYFY09mwkdmC+7+ld0PrHoNv7SsfBSloklfRKOZyVer4Py+Otclx/EreCtJG/ b3mcLGEd2YVWGbstIdlB20L0l9MilJgHwRkTvvvTYy6fKkULljGQNO7/4W7UzWrTBCu4 jGyczyontU6bv3EgHxp9f9K3KxkB978FR87aHBY1Hv3kkxaFJcrHa0C/5zZlyAU28jXI BB8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y++panFifneasGq960GJtHjLst8uLUglPFxOcyVBRks=; b=7bwpOQorsdN0oAT/MIiqcTYR59Ml73HzkHTEuN8uRCoyc8hD2e2CmUBBMWleHBtn/m Bt2inA0pY8i7c+0JnvPNa+pbz86bSXbrqJl4V7mgBwZ2Xrje4IQRmppEcqyl2E1n3sYE ke/+bUUE8vKh9JRaOLmk0Nvmc1meIOdt2DypzuZLnXhFG/TGq5snKVeaAriPdO532ve/ NhJeOLaOhLR1neC0W71roFD+SX4fRhyWbakBzTsRKHG2sk8mlg6Ne1TIBu1v5MIxlAe7 /iUnxN8gvitfhPSOkT3qc6wRx6JBheeFYy0Zylbkk6y9a6M35m+/sgvF6j2LzUiBZrOO /MpQ== X-Gm-Message-State: AOAM532etMjmH32+Jwjt3subUzvmDPwXJpUJWka4nf8ZTCt/1oNyxVvx rwj+DRpINzbeGRlBgLi1xuCwPw== X-Google-Smtp-Source: ABdhPJwgD7F+t3CwkzWdwKXbO2malMfQYkfyNPYoSA3kA4cX5MYf5gaBUpJ0WwXdbwxNoKoRJzJXUg== X-Received: by 2002:a63:951b:: with SMTP id p27mr14121588pgd.524.1639990709993; Mon, 20 Dec 2021 00:58:29 -0800 (PST) Received: from localhost.localdomain ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id m11sm18441647pfk.27.2021.12.20.00.58.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 00:58:29 -0800 (PST) From: Muchun Song <songmuchun@bytedance.com> To: willy@infradead.org, akpm@linux-foundation.org, hannes@cmpxchg.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 Cc: 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, Muchun Song <songmuchun@bytedance.com> Subject: [PATCH v5 07/16] mm: dcache: use kmem_cache_alloc_lru() to allocate dentry Date: Mon, 20 Dec 2021 16:56:40 +0800 Message-Id: <20211220085649.8196-8-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20211220085649.8196-1-songmuchun@bytedance.com> References: <20211220085649.8196-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 07B36160039 X-Stat-Signature: 68kpkd8hbmyd5crsdemk4o8fsahpmxxe Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=8TvIWV4O; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf08.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.172 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-HE-Tag: 1639990704-486225 Content-Transfer-Encoding: quoted-printable 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: <linux-mm.kvack.org> |
Series |
Optimize list lru memory consumption
|
expand
|
On Mon, Dec 20, 2021 at 04:56:40PM +0800, Muchun Song wrote: > Like inode cache, the dentry will also be added to its memcg list_lru. > So replace kmem_cache_alloc() with kmem_cache_alloc_lru() to allocate > dentry. > > Signed-off-by: Muchun Song <songmuchun@bytedance.com> Acked-by: Roman Gushchin <guro@fb.com>
diff --git a/fs/dcache.c b/fs/dcache.c index cf871a81f4fd..36d4806d7284 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1741,7 +1741,8 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) char *dname; int err; - dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL); + dentry = kmem_cache_alloc_lru(dentry_cache, &sb->s_dentry_lru, + GFP_KERNEL); if (!dentry) return NULL;
Like inode cache, the dentry will also be added to its memcg list_lru. So replace kmem_cache_alloc() with kmem_cache_alloc_lru() to allocate dentry. Signed-off-by: Muchun Song <songmuchun@bytedance.com> --- fs/dcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)