From patchwork Tue Mar 22 21:41:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789092 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 4F78AC433EF for ; Tue, 22 Mar 2022 21:41:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D07276B0085; Tue, 22 Mar 2022 17:41:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB5256B0088; Tue, 22 Mar 2022 17:41:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7C6E6B0089; Tue, 22 Mar 2022 17:41:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id A82836B0085 for ; Tue, 22 Mar 2022 17:41:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 626FFA4DB6 for ; Tue, 22 Mar 2022 21:41:13 +0000 (UTC) X-FDA: 79273343226.19.8CEE387 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf22.hostedemail.com (Postfix) with ESMTP id CFEDAC0032 for ; Tue, 22 Mar 2022 21:41:12 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3F97B81DB1; Tue, 22 Mar 2022 21:41:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B2A4C340F3; Tue, 22 Mar 2022 21:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985270; bh=smRsLR5KE1eDlWG0M4YVDorxzhzKWgs3LdA4p0yZgwU=; h=Date:To:From:In-Reply-To:Subject:From; b=hN0XTY1q9p8lnfHVUwqoyvjJe+iGAnx0czNZZugCFyrj4LMZP+5T7bGLwahIuOIaW C6kInRkyvmyPWExuEIoAVHZBRpEmHweGXYlM1oGDZ0osTFTlmXaJxF6Vj3c/MM7JtR nASThRJ0ccMW1sr5dIizc2wNQLv3hdhjQVmjUtKc= Date: Tue, 22 Mar 2022 14:41:09 -0700 To: zhengqi.arch@bytedance.com,willy@infradead.org,vdavydov.dev@gmail.com,vbabka@suse.cz,tytso@mit.edu,trond.myklebust@hammerspace.com,shy828301@gmail.com,shakeelb@google.com,roman.gushchin@linux.dev,richard.weiyang@gmail.com,mhocko@kernel.org,kari.argillander@gmail.com,jaegeuk@kernel.org,hannes@cmpxchg.org,fam.zheng@bytedance.com,duanxiongchun@bytedance.com,david@fromorbit.com,chao@kernel.org,Anna.Schumaker@Netapp.com,alexs@kernel.org,songmuchun@bytedance.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 052/227] mm: dcache: use kmem_cache_alloc_lru() to allocate dentry Message-Id: <20220322214110.3B2A4C340F3@smtp.kernel.org> X-Stat-Signature: txwogt8oy3jxmbs1n3yrn3oeqpq49ead Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=hN0XTY1q; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: CFEDAC0032 X-HE-Tag: 1647985272-518421 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: From: Muchun Song Subject: mm: dcache: use kmem_cache_alloc_lru() to allocate dentry 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. Link: https://lkml.kernel.org/r/20220228122126.37293-8-songmuchun@bytedance.com Signed-off-by: Muchun Song Acked-by: Roman Gushchin Cc: Alex Shi Cc: Anna Schumaker Cc: Chao Yu Cc: Dave Chinner Cc: Fam Zheng Cc: Jaegeuk Kim Cc: Johannes Weiner Cc: Kari Argillander Cc: Matthew Wilcox (Oracle) Cc: Michal Hocko Cc: Qi Zheng Cc: Shakeel Butt Cc: Theodore Ts'o Cc: Trond Myklebust Cc: Vladimir Davydov Cc: Vlastimil Babka Cc: Wei Yang Cc: Xiongchun Duan Cc: Yang Shi Signed-off-by: Andrew Morton --- fs/dcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/dcache.c~mm-dcache-use-kmem_cache_alloc_lru-to-allocate-dentry +++ a/fs/dcache.c @@ -1766,7 +1766,8 @@ static struct dentry *__d_alloc(struct s 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;