Message ID | 20230727080502.77895-18-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 A7EFCC001E0 for <linux-mm@archiver.kernel.org>; Thu, 27 Jul 2023 08:09:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 43BA46B0085; Thu, 27 Jul 2023 04:09:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3EAD96B0087; Thu, 27 Jul 2023 04:09:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28BC06B0088; Thu, 27 Jul 2023 04:09:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1CC0D6B0085 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 04:09:20 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C1EF3140829 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:09:19 +0000 (UTC) X-FDA: 81056666838.15.3AEDA89 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf24.hostedemail.com (Postfix) with ESMTP id D7C19180015 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:09:17 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=WprFfHhw; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf24.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.173 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=1690445357; 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=1//FAyntSoVVhHGcFkYF5rOUv8OYZDaOr/FI52lXs1g=; b=5wCFVeteb8nvky7Y62IQTbIbbbBz7ve2/fAH/QrRefTdI8Lqbhg7UPKCx4+VIJkIpZNB+N +42rLyQvxg2mqRhVNnrDIZW7svtFlniRtPVU80myqT+DlaNvuH7rLAkQIUUgm9LZPYF54n znDBiAswNIMfPH36ojb5R6dzTeA8LTw= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=WprFfHhw; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf24.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445357; a=rsa-sha256; cv=none; b=vIGFl5Kf+tgKyAQZiB6NsZHmwOq9bFmeTd7QwEK1jPIWZNwzNcRCI4xJUre7ECPPNGgyia 6zNgjtCvawYKqLLbgGaaOK8NCE61MBcbSFtFKS2Cudd9ueqF2TiE+KGSNWCdlsngiNZBTu GJYTn+RFH/1Ygfn7r5/ItInZgXjmdww= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-686f6231bdeso112891b3a.1 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 01:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445357; x=1691050157; 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=1//FAyntSoVVhHGcFkYF5rOUv8OYZDaOr/FI52lXs1g=; b=WprFfHhwxvgCbIOGEhvz/77THpnE+uaWMbMuLLIIDpVeL3Jz2616v8wLFkzo7HZvSd TNFFTtJffBxh3fLTgZ0hA52iTzwFJ1lb7YC8GT96AcRGLEmRK6UnsPg5TF0WeT/gBbXI n3D8mngVfbe3MYXC32UZAJFJiGuaHBVIWM9CunOWIYu990kGDPAj43N4rpm3m8rpgsHd 02xW2JacWcelFq3TAnDCLUfDJo66VYYZvDcSFvyxJpg5YwEtAXcJf/FphGWJu7IrCr2v NhF0NyS2ftTWJJ0Gd6+a6tHW0SZpG4hIgkFC42XLIYM9ZEOFnWGm8ZzCwBndTMQ8KaY8 M1zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445357; x=1691050157; 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=1//FAyntSoVVhHGcFkYF5rOUv8OYZDaOr/FI52lXs1g=; b=SvkvWdAmOU1AEDO5omEPBQO5J3wZln6L16xcmjOCYyVD4N6mWopq6tk57BmMG8MO+Y zKBYU41gzgcJf/OV9ElXnMcDUKXmxLCCrd83uMfF4dt4fFyCi+9hDp7bzWiI9eJ4nLKo cArTZn7zoq2g+4VkefbQlFF7+T1/yXZsywO7ISrUVh+z8h3v09QbFaCbJjWBM1Lt+XzX J2ogbg/XwvYbA2s00OqnEe+1Z6tB9XBsvWnDmlIIi+RWfzbaBcQnSC5MbhA7oGUvDwvs O1bmz9ppPele9j0B/P6FEx3vk8fx68da6vzZJaAQ8V+Gx11Ln4mzbbbiNwOzw0ns6DBC uuEA== X-Gm-Message-State: ABy/qLYpWWz/TOBKFSeUpaGR9+6GqscnfR0k/EzlPiCPAFFxhqdsQZPk a1bv/6qLu0BUQNoD9FqU5Xsveg== X-Google-Smtp-Source: APBJJlHvmYnqUEfQMupLlQUSLLnEPxVICkIYSDMBUwnFYoQAuRxCEO7ekKLA8kJr4NX0LnRrY6UJ3A== X-Received: by 2002:a05:6a00:13a3:b0:676:2a5c:7bc5 with SMTP id t35-20020a056a0013a300b006762a5c7bc5mr5229938pfg.1.1690445356761; Thu, 27 Jul 2023 01:09: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.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:09:16 -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 17/49] quota: dynamically allocate the dquota-cache shrinker Date: Thu, 27 Jul 2023 16:04:30 +0800 Message-Id: <20230727080502.77895-18-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-Queue-Id: D7C19180015 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 5npgyewmf8q1wbot3eqxi175k9sy7j5y X-HE-Tag: 1690445357-163306 X-HE-Meta: U2FsdGVkX19UXRpRIp4c2vSm8+Kdqz1dDS7g+g4lnj4Wy9Z3e95BZwi7277xI3FCFUWMZhhkhQzGgumbWt2kw6XWLGpGLZeweO3bnTvP9DY8Ouvl7iZN7HZGjJe6FdJs55KUvspVG5hDPX+mWO6lhnCWHOLcWPdlsahqdFrRxWXFvyrthc4sf8uj2+kch1vgNEYHF2UR/3iwlX+Qfz+PGqDbKQ2rz8vQr5Esa3GgMe0GyOeGoQ4q3bBfYY9uFd5Wzom1Qp5F3/lzuaT6yxgeBONFxnpWzmIDikBjpFTHghdrgbLUX94siaCK1uBwagjlhkdUmtxoBdlErzNPPa82Q45E0jKsud+IgjGji5qxclis4ccNJVp6P6ck0zKdbWmxJrhk+vhAnql4ZEuuiR33VWPq3Q6NRkuNp+TczwY1aD19DJ/rM0RbzwvwJa3TrNzoCR/Xvz4i4gu2Zd7m5Og2QGbsh8ZyppSlblys5NXsNIDcx3AeuyVbQongumC5QVkZ4i13azZf9OanMhz5bMp8mb0D+SRsMM53GOHQxJ4BJU4Bgil2eEfShYE1I5NhSI9mYEpJjMiwd0yPmWOSr7P+tvac0gq9E7/SCSogBJTFSLqaqiVTxICF8Q/6KuN8YCzJiB5suCBhZ8L2rRqBmhrl94Js+upYSBbJ1SONmsiUT/SN9j3iHiC/ysgXIcLj3zPYhFd6qO8ASzynt5Vx4EBoeOJRBfW9RDrw6WyvUistnwoE+LHuA2Yg18Mwk9O+o9fuAc2XkQQouRoAfdctkMWP9kH/Yw74fEG2QTIKxFQo+QqfjLwJFQ7ac/RW81Q3bfurt/S75n2TdR3IQ1eKCw6XspWxTUTeeP4Vi7QykSg1etA4jPykOsO4vPfbhYarWrIJLXFvfskAh+tK1SP9EFQlnqaOEDPynjdV3V4Burf5YqWyPxCv4v33fHJ79XkbAYLwBW1sBw7ZGXTw042AzlA +qqpS9Nq 3aQXkzobmeuVmmQ6zekAjM8GjOxjmd6hRmTOyD4cQv9dnTfalpYwzDlNmOOLn+Z7c3e5CpuxH/gacjwpExnj6loYJcclnG4RyFxGKrn/F/t/i6dBsEbIiGJOeVTito4mWHCFTjpKjiB4/BAlKFZXb9Ux6PUHBUNogfrxAWCG1LVLvGiIAOLC39V+V4NMPiqioWERHMi1/tAQdPBlt5lMXP+xoOAnXCk8FM63Xcl29ueyCfwuKK13SWb2JqGRp94YcJ1zz1Zv28bMRmRr+h9mgqFNVOQok+0sFhY35LUY6cnHW351gDi81p+Rf4htfA1c1jTP/JAXmYVMg+YdZ1JJ1+/csJkrWuCyVmMChZhss9+vGqDkG9TeKaCBYnTwnvh0BkBauqVrZZFTa/qgzN2VO9Hd4P26ku9LBelIh 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/quota/dquot.c b/fs/quota/dquot.c index e8232242dd34..8883e6992f7c 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -791,12 +791,6 @@ dqcache_shrink_count(struct shrinker *shrink, struct shrink_control *sc) percpu_counter_read_positive(&dqstats.counter[DQST_FREE_DQUOTS])); } -static struct shrinker dqcache_shrinker = { - .count_objects = dqcache_shrink_count, - .scan_objects = dqcache_shrink_scan, - .seeks = DEFAULT_SEEKS, -}; - /* * Safely release dquot and put reference to dquot. */ @@ -2957,6 +2951,7 @@ static int __init dquot_init(void) { int i, ret; unsigned long nr_hash, order; + struct shrinker *dqcache_shrinker; printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); @@ -2991,8 +2986,15 @@ static int __init dquot_init(void) pr_info("VFS: Dquot-cache hash table entries: %ld (order %ld," " %ld bytes)\n", nr_hash, order, (PAGE_SIZE << order)); - if (register_shrinker(&dqcache_shrinker, "dquota-cache")) - panic("Cannot register dquot shrinker"); + dqcache_shrinker = shrinker_alloc(0, "dquota-cache"); + if (!dqcache_shrinker) + panic("Cannot allocate dquot shrinker"); + + dqcache_shrinker->count_objects = dqcache_shrink_count; + dqcache_shrinker->scan_objects = dqcache_shrink_scan; + dqcache_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(dqcache_shrinker); return 0; }