Message ID | 20230807110936.21819-12-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 6C263EB64DD for <linux-mm@archiver.kernel.org>; Mon, 7 Aug 2023 11:12:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AC736B0074; Mon, 7 Aug 2023 07:12:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05C386B0075; Mon, 7 Aug 2023 07:12:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E664B8D0002; Mon, 7 Aug 2023 07:12:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D7F526B0074 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 07:12:20 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B1561C0A07 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:12:20 +0000 (UTC) X-FDA: 81097044840.26.5F140AA Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf17.hostedemail.com (Postfix) with ESMTP id C66D640011 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:12:18 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Owhbp+vj; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf17.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.47 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=1691406738; 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=7mO4oBUMxX13vd/Khdkcrs6zR/VwhgVePYLyhFQqj8c1qF/QcVMHoLh6sJ9segKoSVQWRQ VvEkPvuoiP0lhw8i157TjSuqRlYC8icoSZw44LcGiNnEJZ4Ycg9REs3E8u7Uow0Vxy5pYB wyYjDJ8aIo2L1ldXDBUMG87OkGeysik= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Owhbp+vj; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf17.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691406738; a=rsa-sha256; cv=none; b=N8jh/kQdlcOUoXB24Siz1eh0dBlsgH/g/DSmrnWxL9jdPjhh9+rdE3IcloNOLLNelWzOeC VPhAmDY4Q7E5bF/i6aIMeucsmzteEVMpyAzrEjQE57cIojt6XObEvFx3Rb1IeA3DuiQU+a 2JT8eQ/aiJyuBvZnRs9eopiH0Lyc9nY= Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-267f32e89a5so665847a91.0 for <linux-mm@kvack.org>; Mon, 07 Aug 2023 04:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691406737; x=1692011537; 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=Owhbp+vjTX9LgSb8kQ7MIhVXGKwDLhR+Ce+1Ax0621Bs9MrN8XWMe5+Ejw9lnwM3Ap IYUW911/vhmnbFJp/stmhIc489u8MPAzdlnhNeoJi8rBqpYOKUrjixaEdD0XprSya4Vj PDunDNjaDu16T3tMnzjFT3t7h/oKuuaUvjmMy7sBXTr5KsxElViOqZ7/5M9dmikw8+EO wMQGbexE8DINXXSrzaCt4DliIlnjdofAsiKIz1t/gb0CaZI+4t4MLa+CBQGQ2Bhdx8d2 /xQiP0jkFYD6YIUPc+4v26SX8VshwmbMbumt9peptq8jkLOVQze1kYBLFAMAnfkePzJe dicw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691406737; x=1692011537; 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=NFRPFZHi2akHmEvqMc7VrLT2vSEh041Qw2c/KpFe8UX+Hxu65L+VpLCcHKbihhgN2L 1mrQcbRCIf82NDKbdTnV4eqXnzEy8teECQKVqWYPdy7eX+P/40+z4YeUcvCRBeQ6lh8I aPjjo6w/EfxXU29m8GTxTF7vfosFaLgnYUE6E5FjvqqejNIrGi/n2FaGpdz55ZhdmU1Q wZqboL/v0PbtkpAtMHz9qYeWBTgh4w5qXOTVFSCLtJkVj0K6RaawJdGzE1psu+Dff3Fe A+3RrkyKlGgDgDH6WgBoS0X0/a241YnY7c/oLx0vxtUUGm+tV+af5uVt675TyCGGPpVa EASA== X-Gm-Message-State: ABy/qLak42XKSUjiWTUeIicFDrTxIhLWHNci4muuaNHFeMgnbZOGmePB yxtVc3xSNvWHzphJa4it8aua+w== X-Google-Smtp-Source: APBJJlGzkEm3Uqt9ffvJXbz1uvSm9jYeOQTwgnDKGaV/IZVLtdfAA6YtivYmWFIriEmVEE/lzsK+Ow== X-Received: by 2002:a17:90a:faf:b0:268:abc:83d5 with SMTP id 44-20020a17090a0faf00b002680abc83d5mr23476433pjz.4.1691406737630; Mon, 07 Aug 2023 04:12:17 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id y13-20020a17090aca8d00b0025be7b69d73sm5861191pjt.12.2023.08.07.04.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:12:17 -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, simon.horman@corigine.com, dlemoal@kernel.org 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 v4 11/48] gfs2: dynamically allocate the gfs2-glock shrinker Date: Mon, 7 Aug 2023 19:08:59 +0800 Message-Id: <20230807110936.21819-12-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230807110936.21819-1-zhengqi.arch@bytedance.com> References: <20230807110936.21819-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: C66D640011 X-Stat-Signature: g4t6btuxo5pkeiwwou5d3somschfe5h4 X-Rspam-User: X-HE-Tag: 1691406738-955616 X-HE-Meta: U2FsdGVkX1/rVlRPGJ/0EWRlJSeQlkcJTylAnz7nJw59U2nsZN2cqnWzlwKz4iMM7Qvv9BEU/zii8H19VSjEl35DfwCUJKNleuyHtGwWQpK5Ucr0ZhOuM8CF+jEzoKZPMcxA2vwbPzTrW9TEly5ZM6w+S50DQ7kjgrixIhHX67XK/KC6EQtQW5zgePlfg5usEax47Nk21Bbb1IYe1DTVCYKTrHIndaFhQsLldtXM9+kd1o2hF3gGh17Rk7beVjCofusF4w9IKpDHLv4Pk+XrjLOGXTK1iMCQoh7wtPnn7nvrCLyzz4vknS3A0EWaprlwdt52n09Nkzt5iAYzmV2T/PBlC7FEH4Krn1rJ+VyEiBfF8WQnnpfRaJSkiKBb/Ou2BbRnvD9gF5ewUy1reZPQ0L/+GlEbLtAPcGToM0k/6y8Cq5uw83iqn7+wgn6wbdEHAywQ7oQgNgI2Je7uEmoQNEL3wt9G7vWm99FHqT49yKN83c7xZ0Qsw4CUMPikyWiftS+JiSy46NsNRZnqNGwut5ADdVI9yrR8g44d9yPr1z72k4tmVvbI1uS00x7UHBtsyNLWyQhshN4v+8AY5jlmIBXUNGkuU4K78kEiyRMzOMtzVYa5IIIvCNHvZvHnqGUQ3YEYCgB6c4xjaET/Dae0r7/PJHNq1pJy6vg8jpCUfZGjBhyOBZJ5soUDv7LS9fb2rCTEMlFW9Wa1CztctJQjgiYzgaDmTe20aNs5fQvU0K54eLDdGpi9O+4cM28i+GH33iKcOAMti3nCih6b6qdwGKJjLHMaa+FxN8XVve7KGff94tZ9/GkODM05VrrJiS79d+a6oP2a/U/FNO9aAaKSU+hswAgHCkaZ6NAeOl025fZRKC/aGB3IcE93pFTPVoKbxS4pco75MBKeuArna3Zk28HFbHJXvFByPE/SJungYlqcyDtqppaW8/UTkXDWAXCOE2JYNONrkd/6+uDYFI3 enbZqge/ 41iODcod9uNFFw3SQJAytPbZDzDyKDFktB7acnVfg/b4829ITGbtVR8pQlZj7NF8xWkB9m1q0fnWnkWvTQ9BA6qfgfhCVs0IRCXwFWta0AEBMWQLVoIuWe0S2US7TarJh9h7tFIUE40xf4r0qwN4nv+ZeJDq4lIEp91msjMbNL4+Kp2zKvAquK3OxJdxq/pcPZZdLCwrODXPcrr13l9b8sf8H64FVXrAykMs7y+9o6Tp2IBqInciU9evbG/AikmPXwDCD4+1w3/aQbJAUGE5+/S/QQ2D31AcXYu7w3UHDdGCHE6xHNKpzpcJCLljiuEjps/Y6E6PcVAdGvT5TqzprVW0/YIXFrB/GaLJlOdWAqnXKKqpdSWz+WkMuqEhgW8m2MTbj8xHm9X3DxH8ZDjj3DZsmt2I7f220JoZ1 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); }