Message ID | 20230807110936.21819-17-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 8708AC001DB for <linux-mm@archiver.kernel.org>; Mon, 7 Aug 2023 11:13:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D5546B007B; Mon, 7 Aug 2023 07:13:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 084216B007D; Mon, 7 Aug 2023 07:13:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8E4D8D0002; Mon, 7 Aug 2023 07:13:26 -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 D9F916B007B for <linux-mm@kvack.org>; Mon, 7 Aug 2023 07:13:26 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B2E1DB213F for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:13:26 +0000 (UTC) X-FDA: 81097047612.04.DD6CFD6 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf02.hostedemail.com (Postfix) with ESMTP id C6C858001D for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:13:24 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=i2oZ2Se5; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.166.46 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=1691406804; 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=4VJlLpDqVGiuvI83ez+3bl7yR5bVuWalBgtTU2vfBLE=; b=BjvUye5NcH7HHBZHAZU9nL88v4kYI0yc9yGAm9njdurGB3AlDeZvxgA7WmbMW0b9n3yEij 80KONYFWKDIpDt7XvgxHq1GQezv6yM8bfyB2IqpbgjOnLGdkYVjCagOIuWhwMoxDxMaYhh /SwqGbxeQD6zU8OQmx+1W1EsKIT37Ds= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=i2oZ2Se5; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691406804; a=rsa-sha256; cv=none; b=dZNSRKBA0LLhZDaAjY27stixsi1WEDkKYJgc0R9y8E71esJtjNqeb3PHIRfxedHoy58Nfz 2oyiB1CTxfCOPxq2MBY4p4aF4BiK4WPu+3UzWZbAB0cwg6nohiMJ1mJqpOrlW5ZhhSNgBj uXFbPDjCxSwHMpWZnFjTY3WOhbrCIQQ= Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-790b9d7d643so44487839f.1 for <linux-mm@kvack.org>; Mon, 07 Aug 2023 04:13:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691406804; x=1692011604; 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=4VJlLpDqVGiuvI83ez+3bl7yR5bVuWalBgtTU2vfBLE=; b=i2oZ2Se5RaRdFd0q9t3NqBTv/dUkxD/p2SyHpAjMjg/XHGqyx1ejwAfepurqt3olXd 4JrDoh1Y9dLDoFntnleeQjfq8XZjg4nTjOSD4Duga+gvfwhzkhg3QVfdrOJlicPQaYUD v5DwTanMH6RhkvK4rWOetuDFETnSCGxcV41PCfrrWGGU2b+vPg8IYLTIauqtUI6qQnyf JDKJFxqA5C/eh/Oo8gwkHqwPIIO1pJg4e68ItW2uJIdbbavFER6b/PwVILGTxzeWrF6b lEtQmpfrwSnO090W7cEUPihusqog8pTCjc32QMYuqZWzqkk8YiBOx308Pfsd+2Yt04OK T2NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691406804; x=1692011604; 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=4VJlLpDqVGiuvI83ez+3bl7yR5bVuWalBgtTU2vfBLE=; b=c89cX5vEcsR3ubJZRfJHoW1r2tu6dePuUydqIiDqTC7AwrXwesti8SCgbPbLO/hiJe uORf4KORDXltOXA9o61WEzPihiVbgbP/gVB2jdiF8mIVQCVj8CVv4Oap3dURInqkDe39 ejkxXJYtSEQ8sqkT43iH4JKRQbhHYyzOqpDeHvag7EUXztZm1EG8OvpwHg3nIWW+jDt0 D8lMb92/b6wU8sXQjsfacj8xk+Stu/ggnkVKFtAVVHnRWMJ1YAq3KfdtVewud2CPGA4f oKFK3/b8DK3kOvZOBezMCDGr/z117Ecuo4w27rycpTp1s7SijBaROW3L288+SyWnPBbZ 4/4g== X-Gm-Message-State: ABy/qLZnp6PNgreq8lcrAPJi+WPnPul5qOOEWwf67uJM6pS/GLON/9MK acxWpSIzG9JO4RckE3+ryUs+rw== X-Google-Smtp-Source: APBJJlG6KxjpSP18cuDMGPLwCal+2Q6XOYkRmOlR+93TSEU+QOz0TNU1VRvfHZPrdEq648UTFq+gsw== X-Received: by 2002:a92:d944:0:b0:349:3c78:fd14 with SMTP id l4-20020a92d944000000b003493c78fd14mr13499018ilq.1.1691406803912; Mon, 07 Aug 2023 04:13:23 -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.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:13:23 -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 16/48] quota: dynamically allocate the dquota-cache shrinker Date: Mon, 7 Aug 2023 19:09:04 +0800 Message-Id: <20230807110936.21819-17-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: C6C858001D X-Stat-Signature: 83rcqqh8xm9mcqckcskxoj7rcc1bnyyr X-Rspam-User: X-HE-Tag: 1691406804-6537 X-HE-Meta: U2FsdGVkX1/CjtcuQGY6DnFfrlG1ZFcunRMcIuUXKj20TtB1JVbPpv6N+6Myvli4G8ZyzpsSB8uBiG9HxPGvVnM/l1NX7oNWU3cd9qO70QL5Nc9VE4Z3AN0jG3bJoblKlbSbD3+jpMoPTgcxUlSlOphdx1nZbucC2uYEpJG8sMn5l550zcILxHEfYfoLwcqgS6rFkNg+yqL0piGcs78ijhxslbGUrafyQVrAhVede44wffpFZdhRYxn49D0bAXC2Wt6l2mWw47pZi/LDyVncZ6HtjjIdWP7vcNBFXO0zrJhmzzko2k8ayeEDPX5JcT4uuDu4jpYwbv6C60DOS4M99LRYzWZXre+8ZAk3G8mcd1D0x9Q7PEbRQTztVz4DhRjKhYiJdC8sgp2fzuhsnteFhuJ/Am22xFr+aMmOnPKWN2BbaRmMBtodlruwMLKblGPnrKBpJnb22Mug5crTuyBFu3hDkuZ/MupnE3bg6Yfj1XiWuPWrUlZ0m0UGReVgLxk6y3qt9eaCvaoxDvqOFrM8Qdnv+XeqVVmWdm2y/ttO3gg5hsErrQzSck2hcHWL+FqDYuMLLkoGA73+yZ0Q81+dPNDpYNosAKNNGUj79Bhy+Hfd/ZiExeXl14A+dnP9lhTUGZd6LP/8243TpDlcCVW4E8eBZ9+VvAq5TAQQrsDWYu5Ntv0PjI6/4AIC/15eW38z6bwW8gKD/IkyxUEJpnU3QJLoadr23mPTbtae+w0wM9A18Pm/hJFYEFsLCSVgvGoL2Y8rjRbTg1NUkI1hZDE+0tOn1/LWnUAnzRTx0buHnwTvO8BbwaDVfcVhYxer7ZyXyPfKjIGxmtBzpD32jYrXx+bNJ2QaDXr6sHiIhUsXWRfXwff4ypRjWTlhRjnwz9vKCk9YX6wIV48R8BS8XVEjztu2ydZdT/mYstmrW1tVyWN2dZsjJm2IXJ5vI5vTcPM6IDZPoieEC8ewdFucl1b 6jhmr29Z dM6eM/d6scM3tybnDUXst25zm7Sb+iOgISGGgcJ3cAOSYBZHonmiPuHb/FsLaOtWL6iip8VgfBxZBk+26rjVRZLB8FUB2dhk7lbrSiwb/e4Ih5EGCmdP909+jI3QefZ6Vog2lPSI//RfqHRj6t1hiopWYqgYi7WWVxenearRW/fxRu9VeA0fHyBXojY/nBsJIWGlJkr3M4k/ZUpP30YlawAHm1JyWownuQ/NFnwo/jJEb1GJOmJj1/33RpJW/YM4aebC2eHaNfaKogguSutWEPmnFJBlHkrKGns6x1EFVgaCTBtcvOOaSXTCu1jzEUL2vUwY/GMvK86tYAUmKp1DPUiIWny3vBYolr/R6gnAMoeBVwZgXGO0MuW2HO2x4a5hCH6oombeubtJY9wZjwOXZ6i+Jly4AIFXyfHpS 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 9e72bfe8bbad..c303cffdf433 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. */ @@ -2956,6 +2950,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__); @@ -2990,8 +2985,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; }