Message ID | 20230727080502.77895-10-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 636AEC04E69 for <linux-mm@archiver.kernel.org>; Thu, 27 Jul 2023 08:07:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 01B696B0080; Thu, 27 Jul 2023 04:07:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F34C48D0001; Thu, 27 Jul 2023 04:07:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD5546B0083; Thu, 27 Jul 2023 04:07:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CE4AF6B0080 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 04:07:42 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8C865C0452 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:07:42 +0000 (UTC) X-FDA: 81056662764.10.0E11CAC Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by imf12.hostedemail.com (Postfix) with ESMTP id C7B2F40017 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 08:07:40 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=bsOGFEHM; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf12.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.171 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=1690445260; 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=bO4yc6b0222dRNj48HoFyPuU9QjRVolFKKVhhMGpLKw=; b=l8Aj+brXRCsFmdl+AWgGKt9mNEgf2aTo5PfqMQvfz4is4T2jJ0S189U4VSJjrFcRTnXEw/ zGREI79Uql30GfCBcOZfdVYf0nD5ZRTFC0yPxriD2V5oCKVRlE7+M8prHEq95HRfIyszVG DkFJq/cvZ+OrTfC5DXcckz2mHooHsAw= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=bsOGFEHM; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf12.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.171 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690445260; a=rsa-sha256; cv=none; b=8NZXs3UrR5gpWYaSSCWbKtHcFPVx/XdAs53sjaG8ChG6IqT2dsE7eMvO05p2n0G8Qb0R9i 5S/VPGDNe11ldpf572GTJ5WTqb+PzNnPFRuymR+BYDcV7/NbNGfs5ghMh2p4nA8HJLTaUW Af8ErtVptHnhjRbPSjK4SPqC5oGErR0= Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-682b1768a0bso174679b3a.0 for <linux-mm@kvack.org>; Thu, 27 Jul 2023 01:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445259; x=1691050059; 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=bO4yc6b0222dRNj48HoFyPuU9QjRVolFKKVhhMGpLKw=; b=bsOGFEHMBlylId/BUUU6j2E7pnjQ9uMa3Dv7D6LoIY48uPLQavKrpj689NrNUpNLTl Aanz7sKMrDaOTTGh4q0MwHTWAvihn1jLx/NBWz0K9CQrFU5rnVI5CzfKG4yO6ADEleGk +0iHBjbO0i9m2+usUNEX9xFmZ3EhQv1mJHg4H05ocCDdgDOngyKPTxLLXx+aCRh/qeWu DaVggQ15a1Fk3lZ/quyODiCtb+FgmREKB0V2Ac2I9AcArTAe8N9Pb2STGieOdKv9GKuP YDdg42gSOnr6HuMRpDchso7LM2qcKeKJNp+Y2dbUP8m4urT1oK6m0eJU2zmqUir1DcF2 Lspg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445259; x=1691050059; 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=bO4yc6b0222dRNj48HoFyPuU9QjRVolFKKVhhMGpLKw=; b=Hi97L6KUue8xu4OIY68QjgjbhqF7DGZZMHZNi8CC7Pl7SZk1LALaY5yR53/UIdy5uE AwsDU5LrHbm0MHzkanslEF/OlGTE995UsAYDJzSBqG0Y63IfFN8klnU+twfXLA22NC8C 1hpW9AAvt/3/ZI9JQTofHXnoRsYqR79HInJm1sdLcLaEOGSQ/MXeIQc+Skj5KPabkCRq rmNw7kWLgfQAQdNKxmFisRSmF4A7Ki6yzPE8DchNPh8YGIZplEXxbViLCn8Q0eVQHdXw 8RTByxpuZ4jvcadUZfWPYvJJbihSVbGlYdqHDmvLr/v60/n7SA8wTZ7O6WZvpZUePw3k IOYg== X-Gm-Message-State: ABy/qLZ4n9vwVSxyQtC8sDSHEodWxRxWid4j8gvvkoCQWrQNsutU+HDD r0WuERAGiWpX7uLYFe8OZC/DbQ== X-Google-Smtp-Source: APBJJlEtjuu7JvMViG/zI1+BRK6QgnXajX34xFKdSMMqB1WswZOW9mIhLIlLvIrLtx031P4ulw5hGg== X-Received: by 2002:a05:6a20:9381:b0:137:8f19:1de7 with SMTP id x1-20020a056a20938100b001378f191de7mr6160325pzh.0.1690445259706; Thu, 27 Jul 2023 01:07:39 -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.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:07:39 -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>, Muchun Song <songmuchun@bytedance.com> Subject: [PATCH v3 09/49] xenbus/backend: dynamically allocate the xen-backend shrinker Date: Thu, 27 Jul 2023 16:04:22 +0800 Message-Id: <20230727080502.77895-10-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-Rspam-User: X-Stat-Signature: b18qc5j7x8nt1pn3kjcjoyfo55y63s49 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C7B2F40017 X-HE-Tag: 1690445260-778965 X-HE-Meta: U2FsdGVkX18TqQo8i7/g0RI58r78aTd515KtjXqubah+ik19FSpF5B2NTejTieqxqunULlRl4K4AoeXPXK5vQENysvfH4qP7GIipA1NJKw5tbSz+sXVQRv03868Fg0R5whmYtMomygnjtExbIHX3abimfZhxbqP1B4z6wWXgzw+4zpR1pPSTl6DZBW8SbHPYgsOlUBy7yd72fA6BpVPNO6xKcE4diWxNFxhBO1A3LdT7gAXRXji75gd0ahXYjEwG1RdjnJdAnR4KKJeGFjnLCOgrSKZg+qQmxkBKAauSCnnNy6nSDDBXxME6R072eJV0+8kjkq6WuF4tgCQDAyNC1W0DqIxJQG5sCTvgWCmkXIMBeWrYKOlHbBUziRYCrA4Emge6WZscJ3r1fkkCWlcu2X66WZuGnKwnG/lCNUd6QfMjhTgfYvNROp2y6MjlhWwXt7QGWS5Wz7utfa6/judtnoWemzLOoO4ZsbsIKIpfZZVAaoLbH3RuCUBf+3Jx61PFIksUANRep70Bqg/RjDQMRLRdGqKeVPLSh01aMMzxzsT1i9uCD2zEV9WDYikS8j9PmEbvlw3v3Lbn8IP383snJZTArLXUC2j81YKGoVI2g7m4cT3OPGZpmfJVdC0Rl/5UpowZ0QaXVADor6QWJdEVRo7URrM/eYKOhAPMr6PtP0pO/dokL7ZYKNFR4U/zuW/lcJ9IvTqpNEXvDwmP9+OaVT9xbT+FGG8KO0jjFPMq12uxqjvHrMiSFJaWKYSCUaU4k5RNWpI6fTibkI+QCXuACU292StcWggkFvSwzkj4dGH7CuAuNAJwnWxcyHzf/9AUpj1dump/TYdPJf2n14qlbFOTylN0/C0y3N9zieVjz3LwSVhEU2uNJMT0gFP1ZVa/RQ6NwLirRb9yr3WYXXH3zxpEyu8r9TdXHk5sRJlBf3RkdBlgvpmg1pLW1KdWLsk+mjS9Y4HTG2z63FshKeT M0ePGus/ TnvzAsEILO6PQJaWMJlpjbxJlskb1q9e3jtb3mQqhhugQ6EI+mnQKbxcH4QbudeIBRvUmRADGK6Ze89y4yScasXvw5HWkLoH2GMjv6hGyayWRCJSU/WZASrHtKUsDOt/VpmfvopuZ1P7o4NL2jC5vCAjaONc8xMTpm0Hb63C/CK1HZiVCBDqqYH5IwemvCactdDOwvNcvvfCmTvZJOGlFGl4FUGQoItV9CzgabkcSSMYNlgB0CNmopzg53ddBqClcrwyn0MKYFF1gdizDhwAv0VMSV6DoNJJ+Dty/v0aVXdblJ1bTxbvxgV0DiAro+QOBihVJzGsE8mtP0OuK5/RdWXWJ9kvDHlsyx2zHhzcTcE1NzUopvf3DQwrDYnmvv+eDft0fBX3lt5MaV8V0/wqGhBP+rzUAjkddcKAN 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..929c41a5ccee 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,16 @@ 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; + backend_memory_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(backend_memory_shrinker); return 0; }