Message ID | 20230727080502.77895-13-zhengqi.arch@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 1D646C0015E for <linux-mm@archiver.kernel.org>; Thu, 27 Jul 2023 08:08:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3E2B6B0083; Thu, 27 Jul 2023 04:08:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AEF5A6B0085; Thu, 27 Jul 2023 04:08:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B6778D0001; Thu, 27 Jul 2023 04:08:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 888246B0083 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 04:08:19 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 550EE160503 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:08:19 +0000 (UTC) X-FDA: 81056664318.16.6F54FC1 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf09.hostedemail.com (Postfix) with ESMTP id 439CB14000B for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:08:17 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=LFYvlia4; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690445297; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XAY9+N2BbVQBjCT3MmFWkPxUR/2vf6o4m+CtMBoAzag=; b=8VoHTnfYgCnEJbk0tyI66JBsARMCh1kXgnpXq3s/fLEUBXi6zfCALh46HngPSYjQYyuawI BYfj+pNYIF7jh8BhyTl+dz3akmX9B+ixKuZmIHYgqBhAU16zmfXy9dpWy3UshT8ifG2/VC ME+BcWskl0ghTHuoatv61MIv8m+C9ns= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=LFYvlia4; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445297; a=rsa-sha256; cv=none; b=N+nUgQ2uRkjynGf1KFOUlwYFJDrFITQuXZEgmaGMffapTweASfHq7Qhgfq5NWH8O8h7370 ZGjQwxowr16eR3RrTrgFBqszO/NFdlDkdOk8aO/q97ThMirwtYQjooAME3BEYkbVZIpJU5 ofW1ubxAX10EmjGq4KOs6+7No8nZTkQ= Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-686f6231bdeso112650b3a.1 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 01:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445296; x=1691050096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XAY9+N2BbVQBjCT3MmFWkPxUR/2vf6o4m+CtMBoAzag=; b=LFYvlia4velFDizk2hHXlBW7f/l7rbfbGMuqLFZUpWLlBrVWlN4fEmfbvc4omxzXDA GS62NEHVqB0PFgv0flEq3EjMDASyoMQLwnHtJ15RD867cmoYFSzpLBJze2MH0FTuVYWD NsiHc1gWK/drytRuk+pd4JkJ3rj2hRu9B8SocS/OtbfY5xFfSOGukZMVRW73BQpYmdrG /5Ymr320vt1GGeIXCFFSw58+k2f5zcvch0LSG0bHy5CbC3AFLqLQjQMF/E7WQcKZk1m8 rvHs1btuYuzdVvuVmWOj+XioQ9BrFWnwjxo07/zHn9Dajw02v1LQ6Dr1U7VOL/6BCiXk S4AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445296; x=1691050096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XAY9+N2BbVQBjCT3MmFWkPxUR/2vf6o4m+CtMBoAzag=; b=WPtOt37NbhpZmtu/R+3FRTXobd/bbu2/ULfO+UAZ0TOXd/eIFuBTIxlK3FAoHYyr+h XodokLbzivPIcQSAv81/PKoatvVdpiO1HPiXPFTEhSkyEkQ3m+8QQ5d6oR2q/pd3it6g 7AtUvNq5kSGWA0QdH2pFoqjWpf1Qw/ZYfwu0JPLVnd/UcHo7y/JK1HEZXRJ7GSHW+Emv OGtslAKGXsEyKP+/nYhOq5sKkzTHeGKu5UIhLpH8jDD8bovlcLdZFfo4zgoxL84GSXNc kwGGAl7GBP2+gLjocR7NI/nFHYdFm4gfBCh8pM4GCQY7LcYvRzK0Cb1knHeLjPlnK6Sv y52A== X-Gm-Message-State: ABy/qLa3o5qt0XqbomYsm4wQwdLD5zbxNavmvf263aYMs9KZOnDyTlXq k5G59GiTWHy7oLsuik95IxhqCw== X-Google-Smtp-Source: APBJJlFXIDspBDKYt+edW+ekZSGIMkDEJizocNVTOvlzV7xMQBKW4TeDX8VYOaL7MgnXn0ggLAa8Tw== X-Received: by 2002:a05:6a00:1586:b0:67f:8ef5:2643 with SMTP id u6-20020a056a00158600b0067f8ef52643mr5200829pfk.2.1690445296182; Thu, 27 Jul 2023 01:08:16 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id j8-20020aa78d08000000b006828e49c04csm885872pfe.75.2023.07.27.01.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:08:15 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> To: akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, linux-mtd@lists.infradead.org, rcu@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com>, Muchun Song <songmuchun@bytedance.com> Subject: [PATCH v3 12/49] gfs2: dynamically allocate the gfs2-glock shrinker Date: Thu, 27 Jul 2023 16:04:25 +0800 Message-Id: <20230727080502.77895-13-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230727080502.77895-1-zhengqi.arch@bytedance.com> References: <20230727080502.77895-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 439CB14000B X-Stat-Signature: kp15e77o4yajgtbsxw4wfzipij5sk9oq X-Rspam-User: X-HE-Tag: 1690445297-387781 X-HE-Meta: U2FsdGVkX18RMzjloJN3/t9200wYEpePLQlFSSCeU7qwnVXNmFF9a0VOtL1ElT4YHD7WfQVQqh3DSetCNI1jjJrcoXUQ8vRh2QhGUS3KLn3k0pdTsKt8fE9mMx18bo6ww2ZZNdypAZF19QMvoH6WV4P9IGKrgBnAt+xZfbb95vaxhb6pS8ns7//amOsXc7CRZ06StjvorO8ox89645tYBQHQgS131qBoPDKE0MH08m3yGkbVV35pEz6PLW3hf3A1LtvGQBtkbkLTdnRX8GxgtDkwOZi/rPfJGoR1V6tbUjwg54skHKrDl50ZSDT2u3eUVRwGFN1o1yW+mZ6WLSpsDHuPKP/QevhhWDGejLHRdnW+HI6t54qFMrF0Wn+VRS1m9FQK6BgOReAPF9OgznLsVj+Pe5NPo4ZOWaneIEAMl2RpzNEIhz/kzL6rn+N1untB8B1gzcC/QXJlnh4ro4pj6rck3Qtko6wb9VCC5IFHSWixdg/d3Bw08CdHDLd+rl723BOedPtNupWRWOfDYi9ppaC0h/oFBxTfZgIhWCDga1QuWkImvXaBxnpPKKnb016ts/Eu9nU//WGTC+ST80zPXjaJYkvTL54q4xdm6ZmYiF3HIcroAGOwpGdfnLITd53vGpkrZfv6e8gNx5ZUAZamEHGr7OVl0iQ7tbcYLExwDITUJnDSlqA8UIwruDejm5n6pwNqli/2PYQp6+hmCjTcdJGdd7bMuYUtFDPdYlJR02VaWDhnA+DzqLiDCJbyvngMlyf3ZSl5IqIFNFI14qIsmxfLKSkQOLkC0s5tw9JAFneQYxfFzoBrLD1nW3Rg1+I4uAnXJtb45IKRYAXIUyS/5Op90Ok/BzMZ/Z+GcPTCd4mVaD7iXd1FkVVN4WgvDomhjbcjTOKsnOMbfDGYreo4tWhKOe0vq7GkQ4vuPADIHc676ZuGLo1oqBPRCjvhehMDampLROwU516zHVALoZZ 2hZb2Zuu akNHeZYlhznYquvDc2p5JI71QUY+oGXHBXc/2fbmoniwICeiqhtvtcej1x5qRe6UzZzgz2+dX+xLI4mKdTIN/vAZmUeO6rSAMehigTXrkVbAghHUFjrbK/oY33ENPXRbEk5jraMFMgmJsyLVASFUZxIuuqExPCL7tCulb5oU/AXvIhNPtRQxFd8dfieskuriUAk0tGktp+0TT8hD8UQHxNxgsl/MVYj2pUFKJoICLzpG7A7+JXUqyQri4xeeVvfoA7IUNyfgsfwyyCwXXnXcxgrVVybt9GXZUJ1LIgGqjN2Vvj23uj6AbatdgQzTiZTA0Z9iVM/aXsviEEZV4MQgxdApWAHhelnwmvgvahG995/3hyxADqagKSzTz0KObtTxmyTNsOzgdSojaSWpld14JTdKeCr5ArTAaTUdN 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 |
use refcount+RCU method to implement lockless slab shrink
|
expand
|
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 1438e7465e30..8d582ba7514f 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -2046,11 +2046,7 @@ static unsigned long gfs2_glock_shrink_count(struct shrinker *shrink, return vfs_pressure_ratio(atomic_read(&lru_count)); } -static struct shrinker glock_shrinker = { - .seeks = DEFAULT_SEEKS, - .count_objects = gfs2_glock_shrink_count, - .scan_objects = gfs2_glock_shrink_scan, -}; +static struct shrinker *glock_shrinker; /** * glock_hash_walk - Call a function for glock in a hash bucket @@ -2472,13 +2468,19 @@ int __init gfs2_glock_init(void) return -ENOMEM; } - ret = register_shrinker(&glock_shrinker, "gfs2-glock"); - if (ret) { + glock_shrinker = shrinker_alloc(0, "gfs2-glock"); + if (!glock_shrinker) { destroy_workqueue(glock_workqueue); rhashtable_destroy(&gl_hash_table); - return ret; + return -ENOMEM; } + glock_shrinker->count_objects = gfs2_glock_shrink_count; + glock_shrinker->scan_objects = gfs2_glock_shrink_scan; + glock_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(glock_shrinker); + for (i = 0; i < GLOCK_WAIT_TABLE_SIZE; i++) init_waitqueue_head(glock_wait_table + i); @@ -2487,7 +2489,7 @@ int __init gfs2_glock_init(void) void gfs2_glock_exit(void) { - unregister_shrinker(&glock_shrinker); + shrinker_free(glock_shrinker); rhashtable_destroy(&gl_hash_table); destroy_workqueue(glock_workqueue); }