Message ID | 20230911094444.68966-9-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 21D3CEE7FF4 for <linux-mm@archiver.kernel.org>; Mon, 11 Sep 2023 09:46:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5C486B01A6; Mon, 11 Sep 2023 05:46:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0A5F6B01A7; Mon, 11 Sep 2023 05:46:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 984C16B01A8; Mon, 11 Sep 2023 05:46:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 85B1D6B01A6 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 05:46:23 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 606E94082E for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:46:23 +0000 (UTC) X-FDA: 81223836246.06.2659C4E Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf22.hostedemail.com (Postfix) with ESMTP id 97ECDC0009 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:46:21 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=SodeY39R; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf22.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.170 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=1694425581; 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=7LECipjpjMsTeT5UMm7L2TEbO8WqkVi8hOfJfny30YM=; b=vTuvIKQcXhHc+YEvmbpZHXqNybGUt9VgHMwzdRj+Cj/JzE0Lo1Kfj++lZOohMvqIODoW+p Ps4gTD92Vnp/Dzg3uT2JS67lLVY2zZPfvRFpPLAUsGOE/6EVWt6Zaow2oWIqh1TBnmocVY AOeLcW4psfcgueJ902zs/tuv6F86qdo= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=SodeY39R; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf22.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694425581; a=rsa-sha256; cv=none; b=h9GS5ofyLG+IzeJpg7qvr3UYoVKtmn+odrpZ1RkwoRx0O/QuUJeOMCps09lU5oOHuONX2b mIl5WBjljZW35B58B8AspDX4eO8ML6PKq1CVbR5W4Pn+O5UaHEW8LgmwB82pXqNcy+Zno5 nf7inxx+Ote5Nw6Mmyqn6Ab36Vua0hY= Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-68fc94307bfso148133b3a.0 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 02:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694425580; x=1695030380; darn=kvack.org; 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=7LECipjpjMsTeT5UMm7L2TEbO8WqkVi8hOfJfny30YM=; b=SodeY39RdgbZ+114xEtwF/Roue3nP/9wFq2z9CDs9t9diBpluzntqp0m1funNw6e5g ssN062Mz4u2m1Q+ul50LVQ2NL5T6/Qx6gea+10fc99+IEZqomM78VWFCShJ0W4PUGjXi r0Dsx7e2w6qfiHrQrbuHeuj+CMpg8I27MvCXQCmv9yrubJbBzXpvlPcTF6dl8NnvYtiF HhusnHmG/QYeYV8tIZ9Xd+Nk34v2pJvozdkgPlIlr972f4RdDEsnZHOA1bjF9T/F+jrD 3t+BtqrPS7tDievAsMvXlgOMGKkaG/Qb0hkVN1Nz9EVayD0TFly+fLMhCig9l9/L3Icb 8iKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694425580; x=1695030380; 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=7LECipjpjMsTeT5UMm7L2TEbO8WqkVi8hOfJfny30YM=; b=SqjfRlAqcDkR3fMz0Vz8Lu0c5qtFeFY5SwF584/K7ZdVVLjXHrOByEgxcRrGrQIc1P flqjdegOTMFMuyTRJOX2CYBfQ6pqbIRILICPY3SZJJaZbeCYZ/UHlTS3LDvWiw5vjMUq EuRcOh2wm/lY/5R0AbkaSJwcIi36qlRbEPjUqUWnN6SnSKW2Oq23aQBEXJHZ3b/NSYlG mqk5QiwmockKtQqK9a1hmqg+u58KKKEO7cKJ6b8yG8o3FWdqS2bIfHY3M1TIYxEaubpm zw2rKcgIiPzsf41SunBNVneppRzpQzRC6Twi0MkOx/Tau8P5MYx44FAjJ+N/xjzimf4F eP9g== X-Gm-Message-State: AOJu0Yw4OLyhIyHJc4UlkvUPrvT+MNrm2yFyIgd/MS2n9+mpipMMT4SA rdTUsKSdzakCmO63mvQPZds5zQ== X-Google-Smtp-Source: AGHT+IEIDNe7dp+17p/1jwosBLUpyZnN7S3R/YUG8mMRO57r91hEdK6UAfUP/CCgqA5OUGqlmZWKGg== X-Received: by 2002:a05:6a20:a10c:b0:13f:9233:58d with SMTP id q12-20020a056a20a10c00b0013f9233058dmr11702677pzk.2.1694425580529; Mon, 11 Sep 2023 02:46:20 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id az7-20020a170902a58700b001bdc2fdcf7esm5988188plb.129.2023.09.11.02.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:46:20 -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, linux-fsdevel@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com>, Muchun Song <songmuchun@bytedance.com>, Bob Peterson <rpeterso@redhat.com>, Andreas Gruenbacher <agruenba@redhat.com>, cluster-devel@redhat.com Subject: [PATCH v6 08/45] gfs2: dynamically allocate the gfs2-glock shrinker Date: Mon, 11 Sep 2023 17:44:07 +0800 Message-Id: <20230911094444.68966-9-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230911094444.68966-1-zhengqi.arch@bytedance.com> References: <20230911094444.68966-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 97ECDC0009 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: tjh51cc391b36iaibwg7yrdy9d1kjwzr X-HE-Tag: 1694425581-325126 X-HE-Meta: U2FsdGVkX183hNSA1bOlLCz3cAvY4eqDBM2hSAJrdoo2yw2UupgIg9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gbKTfNwhSxi4EPx7YB5gGtmcsv8b33v8e753y0r5XDui1H4EUoKQqKFN53mPFwCj9pwWrr70BfmcbsMnTQIgP22y6gXD4ln6ujjeos9yjX3XBAqV1NodWpcnjfVPh9poKbCk/gQ+Qbq2L+3Ul04J7p+93bnWUdcZBOA0bGGLoI1FLOR/dFwOZCNEmgVe3ZEDvx75VJd8AD5+vIEBSVlef6Z5kqPCpZO7WZXFNAt2qN25q33cEXmiKVa8zxgHgpqaxCsbBhMQawv0X9ysT+Q== 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 9cbf8d98489a..35967f8e3038 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -2039,11 +2039,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 @@ -2463,13 +2459,18 @@ 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; + + shrinker_register(glock_shrinker); + for (i = 0; i < GLOCK_WAIT_TABLE_SIZE; i++) init_waitqueue_head(glock_wait_table + i); @@ -2478,7 +2479,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); }