From nobody Wed Nov 27 21:28:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=bytedance.com ARC-Seal: i=1; a=rsa-sha256; t=1690445407; cv=none; d=zohomail.com; s=zohoarc; b=GwCivD/DhbOyPtgYPtNYjvTRC5csyhEjf9bi484NyAHn/Bu+LFdMojY2hT8ynxlEMrazAAVK8bQvqkn/Kp+wlSO7j2odA1IeLbHnlL+PJZD4jcFZYfoSvqOxV/sZ8iVsRDStE3CHzIs+YgpuytEgzmqaFPNZaALZ8DDWH+mvM5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690445407; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=et7oKjMo2RpAm9eGe6PO8KzXkO6yMET8jj6KuxhxE1o=; b=GDn4rGDRR3xsAVmAHi1VRqnh0Xu63ujNWv0MzBpxAcMvRFWAVNuR+ZToPpiJM/KjYmjIKjDUE3pdxVfz4ppCJzCFKctMoN67n1PrPt3E2/XlV5qBLzxFJ1bAXN1nlGGmQyFamnvt2FVlqJ8KDiQBXrVkS0x/Iqaaeh5PulrjkxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1690445407784632.6418810427956; Thu, 27 Jul 2023 01:10:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.570856.893179 (Exim 4.92) (envelope-from ) id 1qOw3y-0006zT-Bq; Thu, 27 Jul 2023 08:09:34 +0000 Received: by outflank-mailman (output) from mailman id 570856.893179; Thu, 27 Jul 2023 08:09:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qOw3y-0006z3-8p; Thu, 27 Jul 2023 08:09:34 +0000 Received: by outflank-mailman (input) for mailman id 570856; Thu, 27 Jul 2023 08:09:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qOw3w-0005Vh-JJ for xen-devel@lists.xenproject.org; Thu, 27 Jul 2023 08:09:32 +0000 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [2607:f8b0:4864:20::433]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e96888dd-2c54-11ee-8613-37d641c3527e; Thu, 27 Jul 2023 10:09:31 +0200 (CEST) Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-682b1768a0bso174988b3a.0 for ; Thu, 27 Jul 2023 01:09:30 -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.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 01:09:28 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e96888dd-2c54-11ee-8613-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690445369; x=1691050169; 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=et7oKjMo2RpAm9eGe6PO8KzXkO6yMET8jj6KuxhxE1o=; b=ZArGb8yz+8ycxhYpd3TfnObsbskAktwxKp/LK6E+gx1lOsm2QqxHLjO1qFt766mx4G 4UOFzMb5rOBT3wq7QpcOo/50dqnABPqLouzBdNx69dJP3kndLHofbdJgcQSOE87tIEP3 gOFIB0th/ApJ4utKzdT3r6irRm20AGsjylo629bfexLkXBuL+hMcZdtnwSmPAtxRA7F8 l3r/R789CkvCTacsaPitu2Mn9fHBZCoAT7Xd7Py97lY3Lp4c0X3H7O8uSS1JwsanI4Cy Pf3LZprk/pnZjQej6Xzx3T3CJ+QGRGxZd7LUmSV8XGImv+0X4BPv+EIagOcfGqekhivR Bv+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690445369; x=1691050169; 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=et7oKjMo2RpAm9eGe6PO8KzXkO6yMET8jj6KuxhxE1o=; b=Uqxq1PNqQg5M+u6b4EIpc4ClaBoGkJMh5LfXEq0bg3TPQBgDJH72W9g0BbTZEZ8K6l 1cEIWJJB9oYzQRLR1GuXIakCzKOqp1HRCUA3PLEN7MYJ1wnx9oI1pALItfEgWfW0NS09 QB4fnZOw19L++6cWlJUmrPMvboHPlJqd3MKUN1TCngf72CYp/KvuWxm1sRR/CtyZf8Ii KJp8qijCvu1w6wdUXlpu0m/g0UDbaUhVLu2rl2k/twg5YvQdPXjFc5INhbp5U7I7eR06 ZyYor+9Uez9Cc2AKZFEe7d5yL88vZ/KPEGX2mFnWrYWvVj63NPp0wcctdtUJOybFXDwG PD0w== X-Gm-Message-State: ABy/qLZu5KG8s8XOvKHR5g7Id6ru0QnHXhXXD4PSl4GAtGZ86/nKiV7A cd9cVVtNHEAcGNX2jf2A1lWyVg== X-Google-Smtp-Source: APBJJlGUbAM65UTyBU06poLXl/mtaX6EX5YDf65AxeW9rsxnsdAR4xxA054nRzBMt6Eu4ihj5O0Oaw== X-Received: by 2002:a05:6a20:7da5:b0:137:3941:17b3 with SMTP id v37-20020a056a207da500b00137394117b3mr5573135pzj.6.1690445369382; Thu, 27 Jul 2023 01:09:29 -0700 (PDT) From: Qi Zheng 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 , Muchun Song Subject: [PATCH v3 18/49] ubifs: dynamically allocate the ubifs-slab shrinker Date: Thu, 27 Jul 2023 16:04:31 +0800 Message-Id: <20230727080502.77895-19-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: quoted-printable X-ZohoMail-DKIM: pass (identity @bytedance.com) X-ZM-MESSAGEID: 1690445409422100001 Content-Type: text/plain; charset="utf-8" Use new APIs to dynamically allocate the ubifs-slab shrinker. Signed-off-by: Qi Zheng Reviewed-by: Muchun Song --- fs/ubifs/super.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index b08fb28d16b5..c690782388a8 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -54,11 +54,7 @@ module_param_cb(default_version, &ubifs_default_version_= ops, &ubifs_default_vers static struct kmem_cache *ubifs_inode_slab; =20 /* UBIFS TNC shrinker description */ -static struct shrinker ubifs_shrinker_info =3D { - .scan_objects =3D ubifs_shrink_scan, - .count_objects =3D ubifs_shrink_count, - .seeks =3D DEFAULT_SEEKS, -}; +static struct shrinker *ubifs_shrinker_info; =20 /** * validate_inode - validate inode. @@ -2373,7 +2369,7 @@ static void inode_slab_ctor(void *obj) =20 static int __init ubifs_init(void) { - int err; + int err =3D -ENOMEM; =20 BUILD_BUG_ON(sizeof(struct ubifs_ch) !=3D 24); =20 @@ -2439,10 +2435,16 @@ static int __init ubifs_init(void) if (!ubifs_inode_slab) return -ENOMEM; =20 - err =3D register_shrinker(&ubifs_shrinker_info, "ubifs-slab"); - if (err) + ubifs_shrinker_info =3D shrinker_alloc(0, "ubifs-slab"); + if (!ubifs_shrinker_info) goto out_slab; =20 + ubifs_shrinker_info->count_objects =3D ubifs_shrink_count; + ubifs_shrinker_info->scan_objects =3D ubifs_shrink_scan; + ubifs_shrinker_info->seeks =3D DEFAULT_SEEKS; + + shrinker_register(ubifs_shrinker_info); + err =3D ubifs_compressors_init(); if (err) goto out_shrinker; @@ -2467,7 +2469,7 @@ static int __init ubifs_init(void) dbg_debugfs_exit(); ubifs_compressors_exit(); out_shrinker: - unregister_shrinker(&ubifs_shrinker_info); + shrinker_free(ubifs_shrinker_info); out_slab: kmem_cache_destroy(ubifs_inode_slab); return err; @@ -2483,7 +2485,7 @@ static void __exit ubifs_exit(void) dbg_debugfs_exit(); ubifs_sysfs_exit(); ubifs_compressors_exit(); - unregister_shrinker(&ubifs_shrinker_info); + shrinker_free(ubifs_shrinker_info); =20 /* * Make sure all delayed rcu free inodes are flushed before we --=20 2.30.2