Message ID | 20230911094444.68966-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 4EE5CEE7FF4 for <linux-mm@archiver.kernel.org>; Mon, 11 Sep 2023 09:47:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DCD816B01F5; Mon, 11 Sep 2023 05:47:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D7C9E6B01F6; Mon, 11 Sep 2023 05:47:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1D806B01F7; Mon, 11 Sep 2023 05:47:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AE79B6B01F5 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 05:47:25 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 90D451408ED for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:47:25 +0000 (UTC) X-FDA: 81223838850.21.FCD72D7 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf20.hostedemail.com (Postfix) with ESMTP id A3DC31C000F for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:47:23 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=lq2wkk5+; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.176 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=1694425643; 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=nO5XG1oNP6pUjS3WN2+RrRDElLAKlnsgenuSaZhp694=; b=UBoBncW2XmxXN545OHzrLo9SpKLBhhJ5SC4JetMj0n2D+L51707J/Ps/TpgT0V9gg5p0bF u1EEEqsJ0nwZ1NYoohUPt+dSZtCbKGuQQvtApIgbRXB7zEnMhTnxf0BlFDKTBqIkmeTgM3 15+PoSocJjB0exj2MhBE68a6l65XVAs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694425643; a=rsa-sha256; cv=none; b=ZXv6gPTs7mIAKqG1MEj3vCdSyRKHUSWAmRuTh7oN/c7keuPWLHqQftRN9xoIFdXgD4fOnD MUZIfLa0yeLtMGa6jFcfdRhTxQZ6TIfZSUD8JhuSV11edfE+gRkXL4/7AcMeYNC49lmGf/ EZwWGGi7IKcQnFGVgGMifhaKblBjBZQ= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=lq2wkk5+; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1c0efe0c4acso7086865ad.0 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 02:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694425642; x=1695030442; darn=kvack.org; 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=nO5XG1oNP6pUjS3WN2+RrRDElLAKlnsgenuSaZhp694=; b=lq2wkk5+NY/scTOQcOxfdalCVh2v5nkRJ8qfMWOUEP/DTLN5DMLn/5URKbWxqmlrEt 6zEmnG4ToDNn8vA6PSb+Nmyb2oqspl6n7C7Vq8XBBLIDgiAV8/8HyLD6ks9TGcSUVg2+ ZTUb6T/oWN3+fhjYh5f7UoRtf3cXrUxBFCF1AyOZWAMxHu3/dmEMwkrNdqoFADOfwi87 FCvVCa/LHbqg9IJ3jmTtOqjSOc7C76QF6QOtRR0W4QJM86sdHCiCf+xb2DxnhVvvwLjr MCve6ZSwj/kZcqKHNejY2/FDyEfeAjCxe/PA8p1MrBFqtD0TFpGdqt9uXlbHGwEgKH5y xRog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694425642; x=1695030442; 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=nO5XG1oNP6pUjS3WN2+RrRDElLAKlnsgenuSaZhp694=; b=MlR3R+0WmQ/iHiXmzLlsRQCJ7unwTzsknY4Ir4S6EDmV7Zt/3s7IHn7VPpoYRk7oWr qObCSZ3SD8uUEJ3nFRrbJhobeIWSuPV8tJfeHI5cNi/r/mXkWVemma4YBXaTAGUeNTtW VZ8czO23Qyvgxu2ROZP9++i2WUHR5/pBdq527aYyhbxxRGmgxuT2GJRB5cbyOQz+MNMQ TnCPrbK/sssBBwDTKFNfJBNTcdhUJTTUQj+dyDACZYs/n1WboU2hXCaU/cVdxfKHXLXR FGe9HxBeNVZzzvupb65os21GEXSID9e+kQPpJ5spL3oEp/T6gGpXe8c2bVPB0k8v+ich b1dw== X-Gm-Message-State: AOJu0YxspQaQoWLEZTedVFIrebfry+52uOk68ciwr6+Ee2hxigLSBUaA vMi6Y+RV0XtmkZDR03JTWNfXUw== X-Google-Smtp-Source: AGHT+IGU0jWm5aUKgo65aoc1FmWqzP1rWPbNbFl1TEnUeGhWf2rII1K9xqSMkpAW8Vpnx3sOpXBIKg== X-Received: by 2002:a05:6a21:a594:b0:13e:1d49:7249 with SMTP id gd20-20020a056a21a59400b0013e1d497249mr13273426pzc.2.1694425642605; Mon, 11 Sep 2023 02:47:22 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id az7-20020a170902a58700b001bdc2fdcf7esm5988188plb.129.2023.09.11.02.47.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:47:22 -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, linux-fsdevel@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com>, Joel Fernandes <joel@joelfernandes.org>, rcu@vger.kernel.org Subject: [PATCH v6 15/45] rcu: dynamically allocate the rcu-lazy shrinker Date: Mon, 11 Sep 2023 17:44:14 +0800 Message-Id: <20230911094444.68966-16-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230911094444.68966-1-zhengqi.arch@bytedance.com> References: <20230911094444.68966-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A3DC31C000F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: iw1pergszpdxzntf8hoyg6osefap1dm3 X-HE-Tag: 1694425643-984884 X-HE-Meta: U2FsdGVkX1/JLXlEwDoLjiBhViDmkYaAlNTQY3Xw7KmzJScDUNslAKVSLEnHqxFOXtgBoLeNEtclyX01+1rg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mGbKsziX7dqKg6P9PnwtspOoxiNzdn8gPRDNZ8yibl4wiYIE8g6vMCEv/jK1n3M9URCuyPxR8hhPZlm04bLIKIPyvCo63592VoLVjl5g8wR2H86EGmHQg88+IT5QBCDLZTXA9DOuFOaeUzpyYv/VmPModkThanD8AXC4aBdtLNGS1pNb0ssegO6HrJrvnKhguo/qNcjSZ1HkoZ10sCLewvDKyHzx12rD8+gIndQVVEAIRzj2Z2V9UhBkzmCY/UdFcr7A7Kg6ovOkZiWi9Z+zcEeznQMu6B8xeEuBVbPx717bHzqfRpvQBT5icaLGRWfMTACax01Lmyqgr7VW9kOvXyKdQr+NGUyycCXL3F0xQgr4ySnoEXaB2K5xA== 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 Sep 11, 2023, at 17:44, Qi Zheng <zhengqi.arch@bytedance.com> wrote: > > Use new APIs to dynamically allocate the rcu-lazy shrinker. > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Acked-by: Muchun Song <songmuchun@bytedance.com> Thanks.
diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h index 5598212d1f27..4efbf7333d4e 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,15 @@ 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; + + shrinker_register(lazy_rcu_shrinker); + } #endif // #ifdef CONFIG_RCU_LAZY if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {