Message ID | 20230724094354.90817-8-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 5C817C0015E for <linux-mm@archiver.kernel.org>; Mon, 24 Jul 2023 09:46:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3C00900003; Mon, 24 Jul 2023 05:46:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEC116B007B; Mon, 24 Jul 2023 05:46:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB298900003; Mon, 24 Jul 2023 05:46:33 -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 CC5016B0078 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 05:46:33 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9BD51160A15 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:46:33 +0000 (UTC) X-FDA: 81046025466.03.FAA7FCA Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf19.hostedemail.com (Postfix) with ESMTP id B61481A0016 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:46:31 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=I+UdRoo7; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.180 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=1690191991; 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=TtWMuwNQICElQwN/uI+F3WL3CTikAs+Dtp5goHq/uX4=; b=xqORlOEeTCvmxb0F1y/YvEjw3nC+4J2wqIQkAaHzgE9c2jvunf5oxW/IoYsrBHW4RDb9Gz 4MXfIAU6PULxfOpdu/S+euG3jNAsES4QwEnqDrBGuGXAchlbu347JmDnZsr0hrU9Qegs7p AbXsWhRye9oor1lB3TGGrs9IkhVQ4Ls= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=I+UdRoo7; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690191991; a=rsa-sha256; cv=none; b=3a0ToX/9kFThlZVW424ma5a/yN+/a3KTMIqea530kNpEk0CKySkxU9MERrDDhGSb2NOs+g HEFSnnX9OptqybjAKDGCKGIIXtUO7n1wOBADhPaL5lEXeaL5GKW5XVlD3T+tcZeECj1tY+ aoU9+Ds8xDejgIsf3y+pCY7NiShETjY= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1b8c364ad3bso8856895ad.1 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 02:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690191990; x=1690796790; 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=TtWMuwNQICElQwN/uI+F3WL3CTikAs+Dtp5goHq/uX4=; b=I+UdRoo7PtFa/HFb9ptM84BLJk51Oz8G0P2vA9d94Wc/XjfftjzLyxRBwA01anb/sX 9mresCrzzrrBEvcw02T2JRUzwmE2N5g0vsbRd5C+EoXN25pNGYeZ6g16/FMxa3H5VNDH 6ji0rzPXwUbXzJbwXvPiq1FHNNE8ocU8HPGADHiXDhNHZabYES9ASLXofIUnLzuIXCW+ kwLOx4qHBhz6RtbAZxDD88fTSzK7LENJJOn1r+bRhOQmNpcKYfm1Yk1Egb7OAZu9liNf 8Q2C/an05GdrxKmh9WrMTyMLOPzFeZw3WZtFR0oz9alHcEF4Djwn7mAV20C2gc5TCLWm V2MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690191990; x=1690796790; 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=TtWMuwNQICElQwN/uI+F3WL3CTikAs+Dtp5goHq/uX4=; b=TBVoXAcSoYFqfjrNMOwCK2darun0uUmvPrlVF7edO9p1z39KDUwTtosnKKO7oXSote HmL65dXer2raDgUZ3kmNeE5S+RdqnpquK9MHvcHWdo2JWmBZ4W4HlaGGp4bvYVbsYqYK eZkcTPJ/XQ9UqACCuxt5yP3J2tm73YTn5SMsHhwQnlfJmrCBtvuEmcGUl/CyiG/U460E vEohMEg/8OCgP5ANRV6Z93BzmfODqmnXl1LxxhdXl5dDaxLtHHbHKAOTPg6VamXxLdZp TlApgAh+3q/9jLyzWJYY440n4HZtX7DMSfoAoMhwULeYfJknJ0G2wO43Ufw3YnVW/m4B ElhA== X-Gm-Message-State: ABy/qLbSKLjVecEbSbi5C4bsjNPKghKf5OZj22WjybIZHcV9OLhnXgG2 Rs3nY3HR4I3ZaHkpj/lpc1J2OQ== X-Google-Smtp-Source: APBJJlE4z/oQr/nYJvsLLx4ZH1UH5CYL5idBHg9QqjGajgFE/t5dphI4tPFsRKn6N/RjSu5tdTiopA== X-Received: by 2002:a17:902:ecd2:b0:1b8:b4f6:1327 with SMTP id a18-20020a170902ecd200b001b8b4f61327mr12289687plh.6.1690191990533; Mon, 24 Jul 2023 02:46:30 -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.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 02:46:30 -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 07/47] xenbus/backend: dynamically allocate the xen-backend shrinker Date: Mon, 24 Jul 2023 17:43:14 +0800 Message-Id: <20230724094354.90817-8-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: B61481A0016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: k799dbjei69tw5hngxbakgwhmxej6ffd X-HE-Tag: 1690191991-653087 X-HE-Meta: U2FsdGVkX1/3C2QCNBDVCebtzimPVTfPVdOnDMnzq/9BwTBk4wMxaGk+xrgaLqLQB1fb0Zog6p+9SD93uWYSa8qjnPRS0/fjdbx0AY+mlDQ/9XSXxDP0IGZKl4Z3103vcmfAyelHmDFVQ2ZpSqora2VPXhTgJvZuo3nnQYSNuj2bQm/rfDsqFUPsKky0c1nsSTA/73Nnn7G+rFqSz3Gqa6oIGZsChh3/ByREJZhsbmiDYaZ08nWRW7T1KuHKWuCx+JnQjb4nMebjLVZquMNiCVK1zZCCW+ESClNI3sLvOX66AQ91rQvHtr2jR2lMKqmN9JOdXPO9ApJZuhiNGriqEi+5t2YyaYvjcJnQgWx2GIU+k1ytKJzAqDuCGE6OacUlTaDbG1vW9r5/S+rRW7k7zpr/PiquPxfEy0EGpNW8wEU2h0HFwbSphv6RfLQmXRGi4OACNg/Vs5B8df3eEC2QyEYtWU6A1YVDSM0FWJsSRNEHhepU2vNjSFfG+sph22oI+Dc/Yd1qWvrO8B51s3CQDB2AixfGoFHUiZ7Hr1hFPeKJNhkOY6gAmWQkVVNQ03rgdzc1dB6Hmrp0S9BJLXnKwvL+M9S136i0cpZNjdW1jFQXD24BOOGYzUppz9biR6EXM+A22L4AOp/Ej+d/PN5z2+O3R1lNculUfJEn6Y45rtBlRSdqTG86fI/YBt4SzJNwluqZuTSZGkfsGa4JxCDXlBjQ8f5fiCiwwd/ev7toRuaHzG3CorM4GEqgbQPqIGvI43nas15c1YA6NJedm97om6IfBStCVshs2ts91NaUS61tync/nqzlw8HR+6D+cmD+bBDBFQeC5lLJSJd+JV0Jie4qvGEmDTDkLDzbHxjJ/A4M12KGvucZSeVVT/5ya5N1+SZlDh3DiIC+XmeskTJ8Qcx8ImlFKhbwXNN0G4WpynEdBjCxv3ZvYxZXo+yUSuXau2v655uhQZRXStbfn4v jQ9KYt6i FeWPTmDg96r4DvjWO21fD+KnO7YCngZHcQbvMwgsJDAxhBbclug/lsMGaJ/9v8qD7WPdvaG18f7vEYrwOe2khGUkPo37+CFriLrEO1rbigwGq+l2avmgqlxFReco45T82lMxVtLKih5iGxihLJKPt7kIiO3+roO6tlHx9iAUg7s2ShrEdv3eX7XlVu52zOQDmTUrJ2Xwi3lgXh1u5cFXJBUBjENprypxU9E2uRM4OGOJ482ybxxg0MFczZj32oG+tw1Pnm+B7JBLRoie2z8pErvHpPQpjfR6VQP26GsooYwviztDfjBJ+CkYbeNfrwxC40PXtxIcPPAfPV2eXlrTwOqHvvImzjMvH/u4VgC8z0DiXZHUSizoW+X6l8rHuaFMORDUVECKhpjnApdXnc7yMu6yqOxfQqBegNWEd 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 xen-backend shrinker. > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks.
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c index da96c260e26b..b4c3cf27af30 100644 --- a/drivers/xen/xenbus/xenbus_probe_backend.c +++ b/drivers/xen/xenbus/xenbus_probe_backend.c @@ -284,10 +284,7 @@ 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 struct shrinker *backend_memory_shrinker; static int __init xenbus_probe_backend_init(void) { @@ -305,8 +302,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; }
Use new APIs to dynamically allocate the xen-backend shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- drivers/xen/xenbus/xenbus_probe_backend.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)