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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9DA0E7C4FB for ; Wed, 4 Oct 2023 20:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244656AbjJDUU4 (ORCPT ); Wed, 4 Oct 2023 16:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244526AbjJDUUa (ORCPT ); Wed, 4 Oct 2023 16:20:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4907793 for ; Wed, 4 Oct 2023 13:20:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71D6AC433C8; Wed, 4 Oct 2023 20:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1696450823; bh=+X5PK1yX5nbB+yLHhm5ojcfVQ8bhDFFm4B6BsqMljg4=; h=Date:To:From:Subject:From; b=uRk/X4EhU5QU01xOA2dGD9SaQwP+G3c5M0JEqsP8cpwkwpLCQDMrZmB+AO3ehEblv PM2uaS4+7RObuhFTol5YM9tkPXjY1p83yTTE7h7WRgJLJpntuQqwixUhWJ/Y2Si636 9ZsxqICT+S3rUHxiuIPl30rAYFKVipnjhXRC0iw8= Date: Wed, 04 Oct 2023 13:20:22 -0700 To: mm-commits@vger.kernel.org, xuanzhuo@linux.alibaba.com, viro@zeniv.linux.org.uk, vbabka@suse.cz, tytso@mit.edu, tvrtko.ursulin@linux.intel.com, trond.myklebust@hammerspace.com, tom@talpey.com, tomeu.vizoso@collabora.com, tkhai@ya.ru, tglx@linutronix.de, steven.price@arm.com, sstabellini@kernel.org, songmuchun@bytedance.com, song@kernel.org, snitzer@kernel.org, senozhatsky@chromium.org, sean@poorly.run, rpeterso@redhat.com, roman.gushchin@linux.dev, rodrigo.vivi@intel.com, robh@kernel.org, robdclark@gmail.com, richard@nod.at, ray.huang@amd.com, quic_abhinavk@quicinc.com, paulmck@kernel.org, oleksandr_tyshchenko@epam.com, neilb@suse.de, namit@vmware.com, muchun.song@linux.dev, mst@redhat.com, mingo@redhat.com, minchan@kernel.org, marijn.suijten@somainline.org, kolga@netapp.com, kent.overstreet@gmail.com, josef@toxicpanda.com, joonas.lahtinen@linux.intel.com, joel@joelfernandes.org, jlayton@kernel.org, jgross@suse.com, jefflexu@linux.alibaba.com, jasowang@redhat.com, jani.nikula@linux.intel.com, jaegeuk@kernel.org, jack@suse.cz, huyue2@coolpad.com, hsiangkao@linux.alibaba.com, gregkh@linuxfoundation.org, dsterba@suse.com, dmitry.baryshkov@linaro.org, djwong@kernel.org, david@redhat.com, david@fromorbit.com, dave.hansen@linux.intel.com, daniel.vetter@ffwll.ch, daniel@ffwll.ch, Dai.Ngo@oracle.com, colyli@suse.de, cmllamas@google.com, clm@fb.com, christian.koenig@amd.com, chao@kernel.org, chandan.babu@oracle.com, cel@kernel.org, brauner@kernel.org, bp@alien8.de, arnd@arndb.de, anna@kernel.org, alyssa.rosenzweig@collabora.com, airlied@gmail.com, agruenba@redhat.com, agk@redhat.com, adilger.kernel@dilger.ca, zhengqi.arch@bytedance.com, akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] xfs-dynamically-allocate-the-xfs-inodegc-shrinker.patch removed from -mm tree Message-Id: <20231004202023.71D6AC433C8@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: xfs: dynamically allocate the xfs-inodegc shrinker has been removed from the -mm tree. Its filename was xfs-dynamically-allocate-the-xfs-inodegc-shrinker.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Qi Zheng Subject: xfs: dynamically allocate the xfs-inodegc shrinker Date: Mon, 11 Sep 2023 17:44:34 +0800 In preparation for implementing lockless slab shrink, use new APIs to dynamically allocate the xfs-inodegc shrinker, so that it can be freed asynchronously via RCU. Then it doesn't need to wait for RCU read-side critical section when releasing the struct xfs_mount. Link: https://lkml.kernel.org/r/20230911094444.68966-36-zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng Reviewed-by: Muchun Song Cc: Chandan Babu R Cc: "Darrick J. Wong" Cc: Abhinav Kumar Cc: Alasdair Kergon Cc: Alexander Viro Cc: Alyssa Rosenzweig Cc: Andreas Dilger Cc: Andreas Gruenbacher Cc: Anna Schumaker Cc: Arnd Bergmann Cc: Bob Peterson Cc: Borislav Petkov Cc: Carlos Llamas Cc: Chao Yu Cc: Chris Mason Cc: Christian Brauner Cc: Christian Koenig Cc: Chuck Lever Cc: Coly Li Cc: Dai Ngo Cc: Daniel Vetter Cc: Daniel Vetter Cc: Dave Chinner Cc: Dave Hansen Cc: David Airlie Cc: David Hildenbrand Cc: David Sterba Cc: Dmitry Baryshkov Cc: Gao Xiang Cc: Greg Kroah-Hartman Cc: Huang Rui Cc: Ingo Molnar Cc: Jaegeuk Kim Cc: Jani Nikula Cc: Jan Kara Cc: Jason Wang Cc: Jeff Layton Cc: Jeffle Xu Cc: Joel Fernandes (Google) Cc: Joonas Lahtinen Cc: Josef Bacik Cc: Juergen Gross Cc: Kent Overstreet Cc: Kirill Tkhai Cc: Marijn Suijten Cc: "Michael S. Tsirkin" Cc: Mike Snitzer Cc: Minchan Kim Cc: Muchun Song Cc: Nadav Amit Cc: Neil Brown Cc: Oleksandr Tyshchenko Cc: Olga Kornievskaia Cc: Paul E. McKenney Cc: Richard Weinberger Cc: Rob Clark Cc: Rob Herring Cc: Rodrigo Vivi Cc: Roman Gushchin Cc: Sean Paul Cc: Sergey Senozhatsky Cc: Song Liu Cc: Stefano Stabellini Cc: Steven Price Cc: "Theodore Ts'o" Cc: Thomas Gleixner Cc: Tomeu Vizoso Cc: Tom Talpey Cc: Trond Myklebust Cc: Tvrtko Ursulin Cc: Vlastimil Babka Cc: Xuan Zhuo Cc: Yue Hu Signed-off-by: Andrew Morton --- fs/xfs/xfs_icache.c | 26 +++++++++++++++----------- fs/xfs/xfs_mount.c | 4 ++-- fs/xfs/xfs_mount.h | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) --- a/fs/xfs/xfs_icache.c~xfs-dynamically-allocate-the-xfs-inodegc-shrinker +++ a/fs/xfs/xfs_icache.c @@ -2165,8 +2165,7 @@ xfs_inodegc_shrinker_count( struct shrinker *shrink, struct shrink_control *sc) { - struct xfs_mount *mp = container_of(shrink, struct xfs_mount, - m_inodegc_shrinker); + struct xfs_mount *mp = shrink->private_data; struct xfs_inodegc *gc; int cpu; @@ -2187,8 +2186,7 @@ xfs_inodegc_shrinker_scan( struct shrinker *shrink, struct shrink_control *sc) { - struct xfs_mount *mp = container_of(shrink, struct xfs_mount, - m_inodegc_shrinker); + struct xfs_mount *mp = shrink->private_data; struct xfs_inodegc *gc; int cpu; bool no_items = true; @@ -2224,13 +2222,19 @@ int xfs_inodegc_register_shrinker( struct xfs_mount *mp) { - struct shrinker *shrink = &mp->m_inodegc_shrinker; + mp->m_inodegc_shrinker = shrinker_alloc(SHRINKER_NONSLAB, + "xfs-inodegc:%s", + mp->m_super->s_id); + if (!mp->m_inodegc_shrinker) + return -ENOMEM; + + mp->m_inodegc_shrinker->count_objects = xfs_inodegc_shrinker_count; + mp->m_inodegc_shrinker->scan_objects = xfs_inodegc_shrinker_scan; + mp->m_inodegc_shrinker->seeks = 0; + mp->m_inodegc_shrinker->batch = XFS_INODEGC_SHRINKER_BATCH; + mp->m_inodegc_shrinker->private_data = mp; - shrink->count_objects = xfs_inodegc_shrinker_count; - shrink->scan_objects = xfs_inodegc_shrinker_scan; - shrink->seeks = 0; - shrink->flags = SHRINKER_NONSLAB; - shrink->batch = XFS_INODEGC_SHRINKER_BATCH; + shrinker_register(mp->m_inodegc_shrinker); - return register_shrinker(shrink, "xfs-inodegc:%s", mp->m_super->s_id); + return 0; } --- a/fs/xfs/xfs_mount.c~xfs-dynamically-allocate-the-xfs-inodegc-shrinker +++ a/fs/xfs/xfs_mount.c @@ -1021,7 +1021,7 @@ xfs_mountfs( out_log_dealloc: xfs_log_mount_cancel(mp); out_inodegc_shrinker: - unregister_shrinker(&mp->m_inodegc_shrinker); + shrinker_free(mp->m_inodegc_shrinker); out_fail_wait: if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) xfs_buftarg_drain(mp->m_logdev_targp); @@ -1104,7 +1104,7 @@ xfs_unmountfs( #if defined(DEBUG) xfs_errortag_clearall(mp); #endif - unregister_shrinker(&mp->m_inodegc_shrinker); + shrinker_free(mp->m_inodegc_shrinker); xfs_free_perag(mp); xfs_errortag_del(mp); --- a/fs/xfs/xfs_mount.h~xfs-dynamically-allocate-the-xfs-inodegc-shrinker +++ a/fs/xfs/xfs_mount.h @@ -219,7 +219,7 @@ typedef struct xfs_mount { atomic_t m_agirotor; /* last ag dir inode alloced */ /* Memory shrinker to throttle and reprioritize inodegc */ - struct shrinker m_inodegc_shrinker; + struct shrinker *m_inodegc_shrinker; /* * Workqueue item so that we can coalesce multiple inode flush attempts * into a single flush. _ Patches currently in -mm which might be from zhengqi.arch@bytedance.com are