Message ID | 20230727080502.77895-11-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 BD9F4C00528 for <linux-mm@archiver.kernel.org>; Thu, 27 Jul 2023 08:07:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 599826B0082; Thu, 27 Jul 2023 04:07:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 549C66B0083; Thu, 27 Jul 2023 04:07:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E9D16B0085; Thu, 27 Jul 2023 04:07:55 -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 31F066B0082 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 04:07:55 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 090CE81029 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:07:55 +0000 (UTC) X-FDA: 81056663310.07.C7079BA Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf30.hostedemail.com (Postfix) with ESMTP id 2313B8000A for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:07:52 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=JnEFWCJ0; spf=pass (imf30.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690445273; 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=ubpyp4SIhGXjO6/VTKiZvWjlRzyN8ANvKHVN5xSGnIw=; b=xkG0jk7HqNAwDMMCo8vzjUDkfNxQboWXQ+AWe+tnoabiodm6LUf7eG3+kWG04scTbqmCCp Kz+9GzSE4d+CYiVwdA60tbHxIRYMTbKbHx5nOsRsmXy298hB7NEm/hkdPSpXIDLLd7uKsK DcsGqLui2fUPfF+H+bC2YS2ewIdYMsw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445273; a=rsa-sha256; cv=none; b=O32eyTPXpPDo2ze2eR04qoLp7Osc/iJNk2dhZ4zZnmsozZ65PRUh7yx+aNSbEUoiKXXGpH s1q1Vi5nFxt4RgLY1SKwt2bfBVHcueMGjucDRPpuBjzvgkVd1Urlvft3YS6VMWSZ+H0FoH Q0edsD2TwiRFHtJhAjbtJ0ugAV5Yams= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=JnEFWCJ0; spf=pass (imf30.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6748a616e17so182589b3a.1 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 01:07:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445272; x=1691050072; 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=ubpyp4SIhGXjO6/VTKiZvWjlRzyN8ANvKHVN5xSGnIw=; b=JnEFWCJ0lfqLQ09KAhpDiGnRAmdtfYhke3aIyqMGyaI1u+7/j8X1g+ymABPYujVt+w cz28zAP40524HNhXDL9Q5SofaC1n/CPA+MmByiqiYd170BhvKkwUMWNTWGQlZaYnqgaR FBpKNnlG1vtBshrp2zrDJ2SvCtcPtO2Uoxi7Td9WriKIRN+9BBM1kAj+4w0IHie3PsAJ NEqh91Op9gs693bzhjwiJV1tmOiwkF+OnmYUm9c5BSiHcRPJXsNw4NR6JZLqvW90Jp1l wYlHCbMfcgp//O2TdulFnaEsdlVg5OO3iU4DnTCf9/O5RCqrJgKtWA6LRsXmBpSaFsGJ 4ftA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445272; x=1691050072; 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=ubpyp4SIhGXjO6/VTKiZvWjlRzyN8ANvKHVN5xSGnIw=; b=gpAtrPk3RkFejdIzyRBgbZMbX6SFc8NDn26uYTSN138uLYN/XfKIGDizJi+VTBVgRA MUkGXnUaJW/wvAFGLfiBGWDrU7ER/1vVY85fJWqKU6ZwMPybijLzdG2c3b6Lo5kJAI2p MIBVkiJvXb7vOuBOAj6UZOkBeu3dDf6pbdDX/dqJzL2Md47q5iBhwle1rYGYg2kLNwBh e3OpvAUxGA/xkD53/WrXAtK7Wu9rUNjbsO12oGb7zdTq0XFhREIQ9F+L3g54kk3SIpNb RNuzlVrFqbGLlaRLAJMQgCLi6SI9QbaO9ldCh/9RTmhM+b5jOiNxtLdgX9tR88AJ0ggi xo7A== X-Gm-Message-State: ABy/qLbjO/tIDPjLKwXGa/s9QxWeyUnuWg+L0VeGxcnjzCwmPNeLGfNR hn2MLP+gWuOUGpCUM+7A/HaUDg== X-Google-Smtp-Source: APBJJlH8Hm//FCUnZvKJ1Fsda02AnYQWQqq2rUtStc8LnYU5/NdJ+w8F5lFLyohrr/NHLskzxbNOmQ== X-Received: by 2002:a05:6a00:2d09:b0:682:59aa:178d with SMTP id fa9-20020a056a002d0900b0068259aa178dmr4647270pfb.1.1690445272018; Thu, 27 Jul 2023 01:07:52 -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.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:07:51 -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 10/49] erofs: dynamically allocate the erofs-shrinker Date: Thu, 27 Jul 2023 16:04:23 +0800 Message-Id: <20230727080502.77895-11-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-Stat-Signature: d9tixcpu6ohpiqom3yiwyx5bcme1t344 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2313B8000A X-Rspam-User: X-HE-Tag: 1690445272-358446 X-HE-Meta: U2FsdGVkX1/Egx6AkOKJW0GfEJX6xhxCumreYVaS7/EocPDVHsxPYl7l3cyLPlot8bYd/Dz47wvDM9ybqF7ph16YX4jfeVwRd37sw46Rq9pffR5KrIGJKgTtncAc/kW3+TeUPAOwYCsILYKyDhYt2/OsbJmxgE0S5L3h1dqWVd4uGK107QmEpMsXnho0FVl/8lDxh79PQMQpnjFdUIomCc1ePyXH0br4VA1RNAbgin9+/UFo4ZaBvlhONjLnHT4EjeQ2wAFC1fHvQHJsUV8JY1+7FvmZdSjFDvQn9964N55VKuSYchlOfnniV6cVh3wKIXVud2RmFm2AZYMEJjaCSaXQxaB7UEBjV9stLZ8FXAZ6w12lxpye9x0koWSfMP+M4TOpenLLSyUncNejdWoyEeZL+3OiHtT1WjyIDjwOuTMGOqK5ooCqxXWizbGKosyjVH05eoxBfCQjGNYWrj/ZXusEV9oeGjQhyxYpX6F3DYBs1M27OeGpjMXTMR7ZeLRp4bRMpTGMkCS4sDdek9F2uwh0bY8ONuh4YfLcwPMpuS0Ltp2Huy+U33XjaLS7FV6QX1Z3as130ityxkMNGI9onqHk5m0zfW6vCmAT/LAvYO2+IxHpUvS8nwCBK4OB8ZTviQodw7IUAkHHY69fflWttqTKl5Voc1jy89sdv4ZRROpS6HVBF3Dby+vYobSWKRoAt6MeQtWxBdY++kXb4kovVC+YH2q+kOdvD6PpR75tegKD1D4kAJG4dFyN4cbdowTlTuKDbrfbCCPT/b0ydIjkEMFm1vDj0BJv0FngS2jkIRbvUglAkFrZeyrdf0IxSzFbR3CymbWlD8/ABtBvKrHyTkyeJeEbo8mzKfUMvI+irVZsT4WT9g7GvDayfqWbM62h+HKFy88RiHyGz4wkkTybsBGyhKYawhAFRVNqYX/IeF9d0BfxjqCpoCs2uMT4wOypRbXsTZ2onQdW7up3HHa STa881Nt DGGvdHRtSx64YrD0q/cszIpjuciAKyw8R3z9CZq/Z4f705XBmoqXkHvOSrQi9a6nWhzuA3Fobbp2f+qRzwMSYdasenPTJn8kcHRcKj8GeABs0Vj2Y2FsdppiWMQze3ZF7YkrBSAfQ+RrtN7p6nCcVVUcyURmd4BADkm2GKtb3Wy4gz5ioJVWma0ifApLtSz+rzL3IkK5Uvbg/pYufNit1tolz0ivkjKY1lM0eihMqIksZiOlrtGwauicTrHlo8f7StdJNJQAYBiVisv174Ew9rLZ0SMM2cDayZIt5deLx2M7r2W3zB/Q/Tdc3DodDZFK+N6LmLg2laL9/d44QmJLXVAF8GfgrOFqrKIxTomBTGgE0/bNb4Mn7HLcEeDOwBmysz6F+alYOCdea8cUphYPP1r/rA73Wm0thraBi X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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/erofs/utils.c b/fs/erofs/utils.c index cc6fb9e98899..6e1a828e6ca3 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_free(erofs_shrinker_info); } #endif /* !CONFIG_EROFS_FS_ZIP */