Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2706818pxm; Mon, 28 Feb 2022 04:47:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxPLtT3epZ2I2/cyV+n6Imet5cTU0y4IoJgy5newloYzzubg5zyxYULiB8gMTEHjtWLvnS/ X-Received: by 2002:a17:906:848f:b0:6cf:7234:8ae with SMTP id m15-20020a170906848f00b006cf723408aemr15351284ejx.620.1646052427226; Mon, 28 Feb 2022 04:47:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646052427; cv=none; d=google.com; s=arc-20160816; b=KTgCdpo+iqIRsxkcb72haa4cGo+aOX3Z5Zn9PYlRGoMxn9FuDEjqsxTQjhq5wPabVf IPlWsTaSXUWsVUAHMLLHTmhnO8HQgDL6Q2AAUlRKRFQ3ikhgBXMiLOaNSkmfAJPj92d2 in4m1CFSjN8BEslWKu18C6HksjJTQmQ2bRUVUGQPvdQOlwMnVl/ADV/umINnq/ZVJmCn 7XjuAU5ZsOY1SCG3ogDkIh+lu72lywNxWoIAXbma8MEmB/ZCvzy5JkoHQt/05LhxOZ8L SnmWgXE/rfqwV7yVYagicU35KtnFbKQGjaWCFcMUv3+f/SBN2s/eeQKRwidKXv6tVdwP u4fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3CsekL525kd4wMUq3hGH48YYiOw10AxsnYHSRiavRRo=; b=QqDS/xPlIx3buJniXb7u0Ew7gezLR/AzU5KHGkflfAD5EClCmhI8Sa3oTYpYr16wkb vcRVOgbSFz9w9AxhjKnmd8vCfPVzhp6LlcHCl05f/gJ6tilAqbnPVxSTt2Lw/JmuCiqb bk3OP+aQhwnk+x7S6/C3tnQKexFza300eQBVywJ9rjjXxWqO5IaunLDKbPgbBurqZCye ktgEXYk3UMlJPv52aBET1lDzEWJzZ0rx5cLPaEfWZs3k9WirM+bDhspaWT63fMJKH0M5 +L3HzMQ3F9UvGl3XVq7Ll4OyFg/Hbh6HoeFcLS4Zz8wJiv6cYWYl7xFvWm5xJ5eAA+If q/Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=yWb0o30A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a170906144700b006d6daebb216si299685ejc.869.2022.02.28.04.46.44; Mon, 28 Feb 2022 04:47:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=yWb0o30A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236423AbiB1MYW (ORCPT + 99 others); Mon, 28 Feb 2022 07:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236363AbiB1MX5 (ORCPT ); Mon, 28 Feb 2022 07:23:57 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A20707520E for ; Mon, 28 Feb 2022 04:23:16 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id m22so11018642pja.0 for ; Mon, 28 Feb 2022 04:23:16 -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=3CsekL525kd4wMUq3hGH48YYiOw10AxsnYHSRiavRRo=; b=yWb0o30Ai7jt2ic9aWpnmT0w6NOd++UYjPe4/U84uEfZ4Yi+dBC0OL9YaYP0QDWrod 9S+z16kZh3BplAN3pFakq2BGTolIjPo9Lt/XyrYHdTnDcbNQnRQH9Yp/Q59ikL6eGeFK 1ToP4tWaSgcD2SSmZuXcyjqtjf6qI5+uGQo4TjkT2REeZ+EYjQdcH9YZcm9ZfdAML+A/ HihZUnPVgpAr0P5UzPoK8MZfq38wH/2HORkBwF92tUJcmlqe1tlMJYVnoHH1YJVNVIF8 r2sMqsZMli/jOXygwlCZVLWU3lXaZ8PVWgjqzW1rrLElxuBjdOHU/h7JDB570GKrNzwo ZTmw== 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=3CsekL525kd4wMUq3hGH48YYiOw10AxsnYHSRiavRRo=; b=SzjkW/6tbGzWFEdFAOtLx4kVI/m8hNCOCds10yGLP1FKZF8BJDDRbKqIBdZhhtDzVz MqqsgUxZ3YRQ4epeveD0gb+BOqaKgwJzavUkR/gN0R2QgaL6GYpSk8JJxn76CwjO7ctf jSK+ZM0UlhMR0RJOuXSkhpUY9NvtbEKJpdicGWr6i69H1WbY5H3UkjocmS8KK3w776f3 Szk8ovZ4SDbjSsPCN0IGNPc4QBOabn966UWDQ2F/PW7cs+XSPdxJOkxzv+Vmsvg6s2b7 TXPx1Bl631QWbJySidQIkw/33n2KLaPf05RWPPLlroSm7uPxS2DrP6HMTpeQAxLmbI3C d8Eg== X-Gm-Message-State: AOAM5338fwrAZIyWmavSrQbGFXTxZpf83enpXiIDfv4zWOoueVsi/uqK vafjjktqK8cFE/JxHXO9FuzAKg== X-Received: by 2002:a17:90a:bb0d:b0:1bd:3baf:c8b4 with SMTP id u13-20020a17090abb0d00b001bd3bafc8b4mr6631856pjr.15.1646050996207; Mon, 28 Feb 2022 04:23:16 -0800 (PST) Received: from FVFYT0MHHV2J.tiktokcdn.com ([139.177.225.227]) by smtp.gmail.com with ESMTPSA id ep22-20020a17090ae65600b001b92477db10sm10466753pjb.29.2022.02.28.04.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 04:23:15 -0800 (PST) From: Muchun Song To: willy@infradead.org, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, roman.gushchin@linux.dev, 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, vbabka@suse.cz 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 Subject: [PATCH v6 07/16] mm: dcache: use kmem_cache_alloc_lru() to allocate dentry Date: Mon, 28 Feb 2022 20:21:17 +0800 Message-Id: <20220228122126.37293-8-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228122126.37293-1-songmuchun@bytedance.com> References: <20220228122126.37293-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Roman Gushchin --- fs/dcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/dcache.c b/fs/dcache.c index c84269c6e8bf..93f4f5ee07bf 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1766,7 +1766,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; -- 2.11.0