Message ID | 20230727080502.77895-20-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 3EC8EC04E69 for <linux-mm@archiver.kernel.org>; Thu, 27 Jul 2023 08:09:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8A276B0088; Thu, 27 Jul 2023 04:09:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D60D96B0089; Thu, 27 Jul 2023 04:09:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C50648D0001; Thu, 27 Jul 2023 04:09:44 -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 B6C706B0088 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 04:09:44 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 98B0C1CA08F for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:09:44 +0000 (UTC) X-FDA: 81056667888.05.4BCFD1A Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by imf26.hostedemail.com (Postfix) with ESMTP id B96DC140014 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:09:42 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Uigp99md; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.169 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=1690445382; 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=GSWsN00ewH1CUxuL2on0amogNZtYjpfZMPk3tXk1MLc=; b=HswIQgnC7NtPBM4meMLx/HOvD+o6Atl5fkCDur9HXpsze3LV+kDhtThZPUpO7Z7hN/SKOW e405UYg5ZnD8vS76Pkhp1Lzz9GeyPOgZ37KV7r7r2j2fRIERfqNgZyGYq5tRhQQUIaaEXX MqbBts8jFtoJ5hrl166DOIcqqjJzy9g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445382; a=rsa-sha256; cv=none; b=esKkcQIM+uzwtiCLR65gig5wop9HnzQsr57Vd/5gKVtAm1lLAQylWsKYFsmgYTpzQCpKm3 gDmzUAtoPkDYLFGko9emMLfd2Aa9j2euaVtZ6xB0HRIB4IBbbNqjgmBi0ZEi9PcqBO7+Rs SuC7rZ+9wpgQq1JiblxmnJYqSFY+7xs= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Uigp99md; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-66d6a9851f3so167939b3a.0 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 01:09:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445381; x=1691050181; 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=GSWsN00ewH1CUxuL2on0amogNZtYjpfZMPk3tXk1MLc=; b=Uigp99md2Rr3CXBoApAa/OORnqo8B1J7RivQ80kk84PuD/8/0U/wiHIiPqvPSjzBq+ 4mgkiCdsVsAk9/e2muldWgdoE75BspngFHkVey9mAlq6MnrgeN5Z2UVnZxuIj86jdS6R rAWjfbsFjXDEfm8YOidjdqca7DNptBkelH0HrT7nXcdFtSlvKmDtxqUQOqWjbYzyZulg AN7Mzxd848XhJE6ClueXrvuJZWX5X85+XT80LyTl5276AdX2DnTvKQaDsxfVQAKr1XxX WaB1fRqts+Skr4BpFNBdK0X00kCFzaVEUe4nziyxeBmy6RtpnTKoOQLFGVCxxQosoZyC 4x+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445381; x=1691050181; 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=GSWsN00ewH1CUxuL2on0amogNZtYjpfZMPk3tXk1MLc=; b=hePOTSpT6bTO4g6EGuHGQuo38w4Ogn5A5w9xthkEezoEw/H72+Xo8L+V81mJRZny2d vqxyLeAmcgivFGhmn0QbbjHWQfXIP6IbQxddLC67rhGtcvxuSMjJwJHOoJhxa+Y1RaJ5 Ae/tD3Pho37SRMgVTcsZhENcafYxyYUc4fYulVZMTX07bYgIjuyX2Bxl2tCXVpck4C4E G8SLgwJyPd9gIBQJsuQKELb+NNyrkkD05EUO1lYvVksLhSvsOMmsvzgnVUVYcDJed2k7 NHDZbnwVTFB52X1hT7mhYQeUjGuFcybuGCX2Nj4rqbfkmkrbTy7Uj94apsSPiRn6uB14 lmig== X-Gm-Message-State: ABy/qLY6vFmZg2K0JclflUR/2SU0m5Tz57AITQGAq9ENuAHNoJBbyu4p duXkL3XrWbgZIhHjxqT3hcsxfg== X-Google-Smtp-Source: APBJJlHVjyqYSo1ak3Z7chV1yhtxMPzG2+b/e8BLYdWQhXdIbtZlkhi04HlfYJAG9z5TWY/X++2RBQ== X-Received: by 2002:a05:6a20:729a:b0:100:b92b:e8be with SMTP id o26-20020a056a20729a00b00100b92be8bemr5576237pzk.2.1690445381598; Thu, 27 Jul 2023 01:09:41 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:09:41 -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 v3 19/49] rcu: dynamically allocate the rcu-lazy shrinker Date: Thu, 27 Jul 2023 16:04:32 +0800 Message-Id: <20230727080502.77895-20-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: B96DC140014 X-Rspam-User: X-Stat-Signature: 9gr9og8j8aksr1r7xujj8pxo5iwfbw3s X-Rspamd-Server: rspam03 X-HE-Tag: 1690445382-567314 X-HE-Meta: U2FsdGVkX1+ZN+hYfMcl3hGo8C9wU9f6lcXMYHLiDa22NYyPMTllyDdLbO5UpdZGO6uMSOtKBex40aI0hACEb+g+UjOX8bwEYXuD1RYbJ/MHDcQkIFZw00BugnwenSGJ5vzNBuoavOrEVc/vRlqz9Rwj6U2YJLMvG1qrlA3njS5MesGdZLijVX7weFpvnO4jklDvcFL5DA7xuriHQidoslF3kyqSfN+7HGDT9n9GPfjNXzNrOQmyVuF7s1zcc5+D/7MNxO7EzHGm6RjDtB1uu447oBWzaZNa1xzIvzYx9xdt6+OX2DZIdOnLojw1gJ3LzyQzqjU/6Ua6fux3N/JvCHJAP3RvX8ogEC05a+x6HVzKdlBQETcVW+Sle0K4e4ves8mXk0iiUrSYISNQiiUBwJgK68fdbeJxUB4ajWZKcQr3Mc66xT62kyoSd7z4My8BF+t8w9D9UlxXMOqphZb7n6yJbYQWxGkibK8YthpmNXTpS/cpoOWOOy7U/Uf6Ff7XqId22Cl65nBewKLcI+V2BOuKfbwKnyq1k8Oaw+sM9dezewrAQ9ze+03yosKMsWmWXimJJqRXU2YkMwJ7qvYm/ZfR9AsWsCgTDMO4rtYlC9bsG71al1OcXr0HbVddn+VmXwNLBLkU0IA497xrxXala47vBi+RGvaHs+i8O0YQGHnP93eafKkUARWJTILKS6QYHdLpA9w/upGaQGzX3v71Z3vlV5Zj/nI7rw8Ab8IZ2uFQZW4Hi3h0gMASylCPIBdY73uWN9pKmh8RASgutuoS/id9R/N47YlpTnyBt+Z0p7m93jj+OerJB37e0plhMYvSSs+RxC4BAWoDW62EJkpTOBD9uuURqvpfRR2tBVjF/cnK0bP23f48iqX+KYZGwa6OJbqPpx/sicrDAkbroplvsbR+Ej7MsxMaJm2GOAxPR3AmUfu66YGeymWloR1yGuJiNooUpst2T/lRGhC5llK ZAvirMc+ SyNPF/ELkRRBLQKVo0D0PwOrDPegGS1ou1PI//rZT+sr2zrbPkmeMxOTrKuFMRjTF8l1D9E126kkOUytA0fQeO0KDFXBbiiroda1R+im/hcmw59KpWTOX1ZrvWvUAPQq4/h7GA29+b3+oyz+pvySh3TN6Km0jM0tR1Tot/5JrGmcw5OlYa6t7krqZfES7Qzk2A8jlePQC2suBzVm6xks52y8ZqY3n1uIahDVghVhAfrgsz2cU9mgnEGTUs172AM1sTP/ErWW9AZuG5bjLcce5GYDniqBrEWkKCoAC3o04EjtrrkxvEGb462B5M7SV8iWt7dv4VyqIwA6fUX1e+5SFuUdcL5hm89OcsG2SWbeKHALi40fZka2DAgf2AOq5++swUYEJi0oXManTTt/M/OyuVQdILCXz7S03ArvF 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/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h index 5598212d1f27..e1c59c33738a 100644 --- a/kernel/rcu/tree_nocb.h +++ b/kernel/rcu/tree_nocb.h @@ -1396,13 +1396,6 @@ lazy_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) return count ? count : SHRINK_STOP; } - -static struct shrinker lazy_rcu_shrinker = { - .count_objects = lazy_rcu_shrink_count, - .scan_objects = lazy_rcu_shrink_scan, - .batch = 0, - .seeks = DEFAULT_SEEKS, -}; #endif // #ifdef CONFIG_RCU_LAZY void __init rcu_init_nohz(void) @@ -1410,6 +1403,7 @@ void __init rcu_init_nohz(void) int cpu; struct rcu_data *rdp; const struct cpumask *cpumask = NULL; + struct shrinker * __maybe_unused lazy_rcu_shrinker; #if defined(CONFIG_NO_HZ_FULL) if (tick_nohz_full_running && !cpumask_empty(tick_nohz_full_mask)) @@ -1436,8 +1430,16 @@ void __init rcu_init_nohz(void) return; #ifdef CONFIG_RCU_LAZY - if (register_shrinker(&lazy_rcu_shrinker, "rcu-lazy")) - pr_err("Failed to register lazy_rcu shrinker!\n"); + lazy_rcu_shrinker = shrinker_alloc(0, "rcu-lazy"); + if (!lazy_rcu_shrinker) { + pr_err("Failed to allocate lazy_rcu shrinker!\n"); + } else { + lazy_rcu_shrinker->count_objects = lazy_rcu_shrink_count; + lazy_rcu_shrinker->scan_objects = lazy_rcu_shrink_scan; + lazy_rcu_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(lazy_rcu_shrinker); + } #endif // #ifdef CONFIG_RCU_LAZY if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
Use new APIs to dynamically allocate the rcu-lazy shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- kernel/rcu/tree_nocb.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)