Message ID | 20230724094354.90817-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 39624C001DF for <linux-mm@archiver.kernel.org>; Mon, 24 Jul 2023 09:46:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B4355900005; Mon, 24 Jul 2023 05:46:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF32D900004; Mon, 24 Jul 2023 05:46:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 993EF900005; Mon, 24 Jul 2023 05:46:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8B7D8900004 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 05:46:45 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 68FAD1A0A13 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:46:45 +0000 (UTC) X-FDA: 81046025970.25.DB2C024 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf09.hostedemail.com (Postfix) with ESMTP id 8E0EE14000C for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:46:43 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=JQ+VYszN; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.174 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=1690192003; 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=4zTxasxXedNYwr5HiD+ktCpinG7wwpmHx5iR9IBn5EM=; b=svK72ik/26TMqWcqsUH8Aks0+EUAGYJgXVpO6CxGgiyvFwQpxplbH9F03mNbJczPHRPxS0 C21cVYxdbL1PhpDkGx7HkJZkRRM19CzW5Atk7HtYhqKV/HNECx3Tji4IdtBJAK9Jppzk87 VnqoOTZEi4Xtau0OhwDqVMGPBdCgPlg= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=JQ+VYszN; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690192003; a=rsa-sha256; cv=none; b=01b30FEQCEgyiWbkDQxjqr73gYg/GQofkGG2yu4waHgDJlRiiZ4PunF0y7G0zbqosFJKth GC3Vxm58gQNMfHr3nktFK8tGRKWLO9Y4UnGF+13yDnPuR6GrUV4g3f0QThyWVZ1SDlFO6l jmYUXbsMj9+efSUVJEH/VEgKzA1RIpQ= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1bba9539a23so640925ad.1 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 02:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690192002; x=1690796802; 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=4zTxasxXedNYwr5HiD+ktCpinG7wwpmHx5iR9IBn5EM=; b=JQ+VYszNneWq9LnVTeEUNZ2bA9JmZI8LOFjK9svc9H4hl8hRyG271LpHarvUCKIyZI 5Vn1CBHP/6AH5rHqtPGE6/hWSk0SIy6RYK161aZhDGhYtCkOSsB2o0ayijs8INBvePS+ ybYmPnwAbLpRLtFyM0o4EOx/Hrne48NbEWwKs3diUJ/coEGr8/xoETACnBW25DeyyWC2 ybnkMyVu7T3nx0cFgEz9x8FtixitWLVj99q7wd/aAYhgB/uAk5tIASLlagkcZ5eA/CFb vVvRndH0r/gASWIjyvLt8jh52cZF67TvvoceATQn3UiM+oNvT8rjkWmY1oM8XcntVr02 2LrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690192002; x=1690796802; 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=4zTxasxXedNYwr5HiD+ktCpinG7wwpmHx5iR9IBn5EM=; b=aZyZ+D+VhqVIqM69pFPhiqCOamllgS3fswYS4nEB8zRwpxOZndIIb2RhppM3V4KmX9 46L0bxPreGEvknGEaRzPCjYDaK4K7k/r5DdsfByDgsSOeioHxGpxB+iXxBvn7A33kLJN is87tgM2W1jiXQl3/F/9MqJZg3VTpPKmBZ78YKiB9Oqip60TfsnpmSZPeiwyirjq5S1Z /v0PhxzgmTTIA2OhjIK1Q/asIvBFb4FMiiHKXgT3Orqs/AqpmdhnddYv4rPCF9snDyAk zzwC3+k451TIPoAInwiozPlKn0dymlUjXfcNl8rNIMfrBbyBkDMiIDfeYdNMArnjBBTK O5Lw== X-Gm-Message-State: ABy/qLbbHJU+m/Jr7q2HrTV9+IPKfz4nLc5zPTmgBwKf/2iXsI0RTlWF nxhwzy7n4W1W0ihRT90HoyKR9w== X-Google-Smtp-Source: APBJJlEIhnQwoFDHuweIAHt2tJcWGI0d+r3I5wbhweuAT0TQly4d+VEILSYdnjVlMqhcbUSPWrZO+w== X-Received: by 2002:a17:903:41c9:b0:1b8:17e8:547e with SMTP id u9-20020a17090341c900b001b817e8547emr12196517ple.1.1690192002389; Mon, 24 Jul 2023 02:46:42 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id d5-20020a170902c18500b001bb20380bf2sm8467233pld.13.2023.07.24.02.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 02:46:42 -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> Subject: [PATCH v2 08/47] erofs: dynamically allocate the erofs-shrinker Date: Mon, 24 Jul 2023 17:43:15 +0800 Message-Id: <20230724094354.90817-9-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230724094354.90817-1-zhengqi.arch@bytedance.com> References: <20230724094354.90817-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8E0EE14000C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: rcag35y3xzpw8zyetdfdeyu3b4py346x X-HE-Tag: 1690192003-385328 X-HE-Meta: U2FsdGVkX18bVyHkeUnSSnzUmYWUzrE7fuhGW3015TUsaAudAnN35y4NF2l3ZcdmvLToY7+j8vquXkDUsumjGgxkuFql97xwrSn8YWCse0n+bq5lHsWWVVVd4esu+F7/K2AuD16faodDaXN9cCUttRiVYZS1koyQ+QVThoBF/vACxBEmjNWSV+afdjflUOfY8q/zKIJbE0fFbX3pAss+Ow2p588vKS0VxntUcr1m4yjxGhnADFkauDcEXkLm7/Ctk8+IcCDsTSPb8b0spiScnICQ6gKx9T35urzT3OSYLsGUO63rGBxe0dyRX8nUG9WG+ynU+ErgmFce44E/a4V//tyqgMB9SSsgES5+008vuNid3AxKCI+0VXZeInqIp2hpz2zN/7cRRLLrZC2tzk+p1Oha/bOmX2P8oTztNR+vLLsO7hRWI6q9cbNjSNeGQ6WG5VJ3/j39Dd5B9FM8DcMiUrsfpb2TljKrjz3C889I92NrwHcIsxPqI6WlN2TAM7aP671wgsO2sDpxcqJxmqVnFe47pLQt1K5nEGs4p9U2hO1J6Bx+X3YwLjmPM8LRkgiPWamQUrATd8RpIUO5aJfTelqlqXNt1R8BAD15wWgnzZMUrAKFrYnCQ3NlFh8yldzKsYLKdBVfaQ+FEh6V48a6174iqk/jklymQHMjIPdu9nRd4mBT2o1wpicz6KYmho+79qvSLZp+Uq+rm4UcF+zT4BXqcT19zpNlpJefdfAQQHjP9lYvZgREcBrZuhswTlLeKK7GuX/uNgw37cG3qJz+mlpwEOh2UriIdXHvyS9yFNc/gBN9xdLl+zOhjouKH5IzjGTaEXDswJcH47qdSNfIGTJqP32Rzv07JAjsIX6EGG8PmLZnG2J/X0V+ILBwcEM6AM+4qO2y8g0uXqqFuZKMGnX5Yp9qUvc1YGiP9O1Cx/NePzW6soVdQ5OYjj6rG/SFTC9ghy3stuDM1MnBB6C Vr1Urcek KN4P2zEi+G2aA1ksfDp7O7gS43ZsaCPWJkHC4719CkPtA0MfT/Je9pP2Z9NV5NuNWeZWiFKm8bh6uYaXohokV6UZqXLFZYEh1MtBJj11uBP5eMOaXoXe24x+Ltr9y9Cv8/RoOCZXlHxSZiFdn+Y7iqI5E2vS0sYZSD01jyVN/aKc1ji5UMEsV7F5JXocLwRGzPN7v4reow7Kk6Cx4qkQY9lDVZ7H8RPhguWXYBfwgIE2LtEUvbXJXYYDLossEhv9fTfFOZNNrjUmhAHI4KYlJp+DtW/qpv9w3BMkDmy17heGOvxTi4Ia3lkILQKS7QsjI3CxoO3VMQ5qs1fku97ob9qp/5o9O21NVYuveaQYZlztY0mcLVvviztS7JT3qikaMcy61w0cXwxwfTxce254VJGA4Ije5E3lkfQDS 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
|
> On Jul 24, 2023, at 17:43, Qi Zheng <zhengqi.arch@bytedance.com> wrote: > > Use new APIs to dynamically allocate the erofs-shrinker. > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks.
diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c index cc6fb9e98899..389de06e1065 100644 --- a/fs/erofs/utils.c +++ b/fs/erofs/utils.c @@ -270,19 +270,25 @@ static unsigned long erofs_shrink_scan(struct shrinker *shrink, return freed; } -static struct shrinker erofs_shrinker_info = { - .scan_objects = erofs_shrink_scan, - .count_objects = erofs_shrink_count, - .seeks = DEFAULT_SEEKS, -}; +static struct shrinker *erofs_shrinker_info; int __init erofs_init_shrinker(void) { - return register_shrinker(&erofs_shrinker_info, "erofs-shrinker"); + erofs_shrinker_info = shrinker_alloc(0, "erofs-shrinker"); + if (!erofs_shrinker_info) + return -ENOMEM; + + erofs_shrinker_info->count_objects = erofs_shrink_count; + erofs_shrinker_info->scan_objects = erofs_shrink_scan; + erofs_shrinker_info->seeks = DEFAULT_SEEKS; + + shrinker_register(erofs_shrinker_info); + + return 0; } void erofs_exit_shrinker(void) { - unregister_shrinker(&erofs_shrinker_info); + shrinker_unregister(erofs_shrinker_info); } #endif /* !CONFIG_EROFS_FS_ZIP */
Use new APIs to dynamically allocate the erofs-shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- fs/erofs/utils.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)