Message ID | 20230724094354.90817-16-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 46D79C04FE1 for <linux-mm@archiver.kernel.org>; Mon, 24 Jul 2023 09:48:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8E81900004; Mon, 24 Jul 2023 05:48:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D3E896B007B; Mon, 24 Jul 2023 05:48:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB82A900004; Mon, 24 Jul 2023 05:48:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A3BF96B0078 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 05:48:09 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 69931C09A2 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:48:09 +0000 (UTC) X-FDA: 81046029498.15.035E0CE Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by imf27.hostedemail.com (Postfix) with ESMTP id 9E4124001A for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:48:07 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Am7FnjS3; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf27.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.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=1690192087; 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=ztwb9n/1dXh113w/8xubUIoix8VXd/5rqVT4RvFn/tw=; b=i99kcYBQA/tKDeW6Yau+l+9YfdPGs7Vn1vt8bbL2YZXV8JhVeXTlf98YLJnKJWaGyxfo+Q KlN1Zy8SZ9BP5WXO5WMkV7bPUbTULAkKskOjti/5MNZeVdykSZNtjBSqUOtBFw/SAbzQph hcBnjDMuA2QST9YWnSskEYN4YIWR2lQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Am7FnjS3; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf27.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690192087; a=rsa-sha256; cv=none; b=KtgImek/jUZmDD8YNvjlFi7ZJo5b88OyAOR5VjOEv2JmhLIGl/RWJT/zkJ6gxRaa8MXzUo ggkiER2yd2N9odG/nFWGTnbBDmfHwOL5ZZz4o6J81fXejPeJKXifBivhVFr0D4OJmNADbX Am83hi5RcW/868sxYIgceHNy2mnWgi8= Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-55b5a37acb6so326599a12.0 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 02:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690192086; x=1690796886; 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=ztwb9n/1dXh113w/8xubUIoix8VXd/5rqVT4RvFn/tw=; b=Am7FnjS3Cpm4I6+unn47wV0WInP35j7cWyw7YSHmXYddBbEndaPLIOhBD501lhuXhz ziS0uq23cHOpl1MZygPYTe8AuNvoAdPlGK8k32I3Ef9lRu2tiO1YjBbYZCD1R2rMLxT1 sbS7mgch7/EfOaLRKT3V6tvhfJSY21ngFnqMEHN8grEnjoqg0M6Q11qf7CVQTrHQJzW3 E1Q+qRl3oeLAaumIkMGruzrANQhf6ocLGFa54JS2CwGaWbDUA2Re4gbZJ2jDKM9ntSrw dCSeZvHulgVnMl/ivIn59gXFxJS3Mnbl4ERIMhlA37amtawTgx9ciEfDapqLjZzr2ZBw AsLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690192086; x=1690796886; 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=ztwb9n/1dXh113w/8xubUIoix8VXd/5rqVT4RvFn/tw=; b=iSIDw6Uxpcbx2EbYfOQdT01d73iLMAI/P6AudT8WHB+zUVMH3RfF122m5bHWunfO7k E7XQjy7QECS6LX7QTzYXMZMTCl+AH4X9JTiMD/s/8bJw37PxgVeKu4yTOt87IVrSnCTL hAOcdoRpPDAHT9ufHkuSZpoUsWnAJwxKTUNuWwDhrxl+cAt2ybO0jyc0f3FYL69qMq8z BbXAoZBLTdVYK8ZVrOjIbISYHwJSrafGdKBsuHG1ZgDTO1VtW3UiK3BantTPTlcy1SlM ZW19BJJINdf2MJJWVNomBS2Xr1QMSZb6njOVZYGI06Ek0eTNTEVYbluzsObZXviFWA5Y pQ6w== X-Gm-Message-State: ABy/qLbeizo4qdoCJVTEPVIbuX5YT0VA4QBceH82kB3sgrESBcZMTouQ IDFMO2RDjmfbsrEY91cDj6ko1w== X-Google-Smtp-Source: APBJJlHRxCFTSeAmJPIiRwzXlrngv0y6n5gqphR6YCBFCcMRvGq0CtVM2WuFHUMj7p5y6QUWxkmpXA== X-Received: by 2002:a17:902:dad1:b0:1b8:aded:524c with SMTP id q17-20020a170902dad100b001b8aded524cmr12538511plx.1.1690192086608; Mon, 24 Jul 2023 02:48:06 -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.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 02:48:06 -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 15/47] quota: dynamically allocate the dquota-cache shrinker Date: Mon, 24 Jul 2023 17:43:22 +0800 Message-Id: <20230724094354.90817-16-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: 9E4124001A X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: p6ch68z5faabhzh4jsq1xsinb9nxwpg9 X-HE-Tag: 1690192087-146333 X-HE-Meta: U2FsdGVkX1/qbydOvJy5N3MBdQb9jakRHqb4UO42ePJXaGkERTl/db7PjvSzYen2oJyj3vSRJyCjiiTJRthxkorFOYQQAcvnFq3JSOtdTl/cDsLJh9u4TsDmYOCuTQk4Zh8HzGmZSVkvokPHwrW3bCZVXWTELFtBkqluIEZL+wQOD0rPNy1abQ1nzXm7zgjeKue/3IXm/P1q9DQk7F4lxH+OcVwQnyjD6f40sDTyD+PxuS1YslFFHUAXNB7VI9KMj8g/F49n4I+Wga7JorJKMdX269ARcg0UPffxyPPMTUvXr14Cx0aYGXEuGVFa15+JwQ2tCASG4s74fDYSqMm/sYeGlGu8+egqRhEBwzeYD19zvYsGRrHtpNVMzIf6fJKAnHQNKypvt2XNMMZkRt1idElAUF6rCFp5Cg+PDcbSynnSvuASpHoQ0i8fWm5K95OJziTW/vI41uPd4Q9wYL+OZGBN8ZXJceUY+rd4kIiOD9dab6uRBJAGlWBZzcYL9MKIF4dWmdor+AZI9LVESJ36r2KiPsWKRLkd6fcQ21hl1tp8vgxh8OV/EvYw67CDZ/3OK1h5IL/qBfBo4f5t33dUOAHR2560csqGDy+OYuDSCDbKT35aY/+9xg9defmAYcb2Db5LzXQduOAiyK7JDhDRt6NaViixyC6P1524+6dx2dd29iLVLWiec79o0HJU9rGclPC75sFBPhfuHCAFxSfrm3BtLJ9TYy76elnKVasxOOeXHV92CmLLdYaiyJqoDtLh5Mh3vJpXgW+ONUD6/0O6lkKjTtBwNy0ZTZR4lyQvYbsCHZ3CiN0wt0uWnaeg++1x3XOoCMx3pvalUBmvF4LzMaRQUuq1OtMVLwCiJccxpq1VY2qvsrFCtLD8aAH9EtOoySFKQsyBQyK+UKdMWwN1ec53vdkvB34H7WdmQ6J5zYle4fkoQNXs11OfUvpFFssH/kUtAF0aN3sUXNBDgYV 4mEavv++ WyVyI/tyv6t37xGmpeKIqYzpMNFv8q/METdKyBlZdnBagkWfZVMcKBxtZW1LiLNonLtN+HpSbD9OvIjnBVCpM8VTzbVNE+H/4yUSMMwwigqD3Ip6jm2erm71srjNiEGpqCksT7bQm3e1z1C+Ne7mAGYS6rvwCJcCbRyUu9VfBhcV7iUuK2ZQAEe4kNxpsm8D4QJo4oHWnKaRiJaBIXaq2iaiGH3l0riVz3JY8p13PzpvCfRiXtgeXHkTkmTBUiGWBtvJayuYBiv/VaIB3L3zA8E7sjRrcQvRKkURc7YyLv6uBnTtsQ3WQGLQqc3PBA+ahSsjYXCb5XLW1QloBtkswFvDEf+yj1wRmoH8tVR+53L9tcLB9K20Ssnmzt/lBKXKvlrYdhmJANt2qz/pGzT/nKl6lXMByR5FIZrba 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 dquota-cache shrinker. > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index e8232242dd34..6cb2d8911bc3 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -791,11 +791,7 @@ 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, -}; +static struct shrinker *dqcache_shrinker; /* * Safely release dquot and put reference to dquot. @@ -2991,8 +2987,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; }
Use new APIs to dynamically allocate the dquota-cache shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- fs/quota/dquot.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)