Message ID | 20230911094444.68966-6-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 A56BFEE7FF4 for <linux-mm@archiver.kernel.org>; Mon, 11 Sep 2023 09:45:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 47CC56B01A0; Mon, 11 Sep 2023 05:45:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 42DA86B01A1; Mon, 11 Sep 2023 05:45:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F4346B01A2; Mon, 11 Sep 2023 05:45:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1DA436B01A0 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 05:45:56 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E56E0140916 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:45:55 +0000 (UTC) X-FDA: 81223835070.02.53D4F46 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf08.hostedemail.com (Postfix) with ESMTP id 1BEBE16001B for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:45:53 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=B5O3j2Gm; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf08.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 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=1694425554; 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=6FwhLiYYaF8GJm0hS886+94gWet3PBBx4VE+fsMZAKg=; b=gLSSDiMtaHJQa3aNUnVTDHgZUw/ZNj0KHKpIlj2at3zqK/+m58kOPEemHG1PE7GRc7BVSG Lcf/+xhoxeM1CZRi40xnpY/MAnvP1L1QErO7AkcMIlnOpO7uc8ghD1r4QEr1Dbp4HZGbXt hSuXCh3qgXEPTrDX4Psuxkv66fBwkoA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=B5O3j2Gm; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf08.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694425554; a=rsa-sha256; cv=none; b=ZJq6x8Ti4j2Tuaf2jLeYZ2+Akr4Ro68rKFT+iJPRCkFxf1eT47jXW7f7vp75I9ZmBxEAH3 79mswTAiNq6pFlYIO5Zm23kzqjPSCz23kRqB92Su8DyJ7Q37jOZjcH6nSx33T/YLKzPfzz 8+cB/viVMGqzl1LaCc2vdDvGZPyRY/U= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1c0efe0c4acso7083365ad.0 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 02:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694425553; x=1695030353; 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=6FwhLiYYaF8GJm0hS886+94gWet3PBBx4VE+fsMZAKg=; b=B5O3j2GmMlDtFdZf2vzb12DgF3FNoauCqA2C+RDNhy0yoeRq8fja8jgTfK56fcv0/d /f0uPYujBFFIrITOL4lR48PHxJmWevKdSleD3UKtPVSakY7wUWyvPvtIKXWIBOeulULr f3HNiFC9pvolOfQRzeIN9DTUE0aJ5ol54N9T0Empq3Pu+NzEw9w3CpvVuoIUxFeDJKmP SY6HCvoUdrYDQJjogdf2n0wBmKiYgXfwlC/lNgRXp2jCrGxR95gjfbVYuzDOz4q4yW4b Vbh3fQP6010eVbwczO5im3auFfCYEtpEXCmuFJ/qpxJgiyU23M9p3S+Kcl0GFe9JA+gg vexA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694425553; x=1695030353; 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=6FwhLiYYaF8GJm0hS886+94gWet3PBBx4VE+fsMZAKg=; b=Et488LV0oT0XJAnYYRiqKxahY0I+73nmXuURMkGFZVpMQXcZzjjoZcOmVT3s+AvBS/ IqgTCjBPidTnaGdDI6MvE4zxsicJsQndO8E9NT3vykjDpyBy3Slzv4CWjRroZdzx49LC 46YldSI24PW2f23YRCLEFyhlcrxzwO4d3KxP69/SOnN6trmqqzXqCPzM3JHk6kVBOcfL BO4o0E5yTkJaUitluslh9cB8TPlWeupMqmIftz0torpRFc7vWkJSg82jhOErRN6CSElP KIzk3J1kMidMZhh88H88GwktsfALzlE4xovO6vj0X5DwFDMR+uw0y62wcYIS7gjmMnXP L2eA== X-Gm-Message-State: AOJu0Yzsp3fvOzKlgzg7YnBmlM1kO6xmlmTrZGdE+pv+ysE8ObA88X3Z XBI9zh/wjqn9/wUvOOYv10egJg== X-Google-Smtp-Source: AGHT+IHJaWa+7S6PEpk0MEo5uFVZCUWjKmc0DPmv6mKvqIMnxGI/EF90IQq3u3ePRTZciiGyrN8JSg== X-Received: by 2002:a17:903:41c8:b0:1c0:bf60:ba4f with SMTP id u8-20020a17090341c800b001c0bf60ba4fmr11505655ple.4.1694425553045; Mon, 11 Sep 2023 02:45:53 -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.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:45:52 -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>, Muchun Song <songmuchun@bytedance.com>, Juergen Gross <jgross@suse.com>, Stefano Stabellini <sstabellini@kernel.org>, Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, xen-devel@lists.xenproject.org Subject: [PATCH v6 05/45] xenbus/backend: dynamically allocate the xen-backend shrinker Date: Mon, 11 Sep 2023 17:44:04 +0800 Message-Id: <20230911094444.68966-6-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: 1BEBE16001B X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: nythmtt6hboj39ei1nwd1o8bxkfq41ay X-HE-Tag: 1694425553-658330 X-HE-Meta: U2FsdGVkX18AYCToE5DK+Z1U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YomQ1p014Mu/6pisHOfkseKQKImgE8meI9jD6pL0JlH1+s6NDeP/e2yeKyO5jiy5saSs3/OdV5md5I6M7apzU5Jhtr6z7n8XQrIWJDBAYh+3pEPav98JcM96/kxyMMEmQHj+kbvZZOgCpchrBWfKbK57jmQ/m8qwv+dwpnHPaNSDawfB+F6nUFNIr2dFUh/4en29MuR4CTej8ZjdFjGLJCjBN3DCGDKkUiPgeIgbk6AkDZ5EearHpw/AUqY8FtPzn0IqGcUmkOgZzaHlFcE7YulPSgpACi339jm5fE12o9ZG2eiR8K99Xw6OhQRVaJidV/G8Pt8Iu57rI5VZ8hta1nRdzDORxZ5e076OSdGSzySuLvXvC8l6kRuwVWKobJSx0lnus6uNfihWiYrKIdFLPmDoUrkLjfN8xhQjHPassJLADa+D5CEpUkIRuvKckwaqDuZ/34nkO7fOKTN2uoqvQA5fur9Q4uOILsVUY/g7pm07Ta/EqUQUhLd0rUayvq2G7YvV71ln1Nbi3Nm1O6VJSIJqXe6IWw== 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/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c index da96c260e26b..5ebb7233076f 100644 --- a/drivers/xen/xenbus/xenbus_probe_backend.c +++ b/drivers/xen/xenbus/xenbus_probe_backend.c @@ -284,13 +284,9 @@ static unsigned long backend_shrink_memory_count(struct shrinker *shrinker, return 0; } -static struct shrinker backend_memory_shrinker = { - .count_objects = backend_shrink_memory_count, - .seeks = DEFAULT_SEEKS, -}; - static int __init xenbus_probe_backend_init(void) { + struct shrinker *backend_memory_shrinker; static struct notifier_block xenstore_notifier = { .notifier_call = backend_probe_and_watch }; @@ -305,8 +301,15 @@ static int __init xenbus_probe_backend_init(void) register_xenstore_notifier(&xenstore_notifier); - if (register_shrinker(&backend_memory_shrinker, "xen-backend")) - pr_warn("shrinker registration failed\n"); + backend_memory_shrinker = shrinker_alloc(0, "xen-backend"); + if (!backend_memory_shrinker) { + pr_warn("shrinker allocation failed\n"); + return 0; + } + + backend_memory_shrinker->count_objects = backend_shrink_memory_count; + + shrinker_register(backend_memory_shrinker); return 0; }