Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2176235rwb; Thu, 27 Jul 2023 03:24:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9vTg+FfQTtegGCvcszSdwaG7FP7t743c6RKcy8W052Wejeei7ZubjzCyH7FpfYwsvwurm X-Received: by 2002:a17:90a:e612:b0:268:4c01:eb56 with SMTP id j18-20020a17090ae61200b002684c01eb56mr3808370pjy.2.1690453460197; Thu, 27 Jul 2023 03:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690453460; cv=none; d=google.com; s=arc-20160816; b=xH0CznmUbmbReT4AI/8kZhWQiYB2+IkNFQqvp6wBeEwjeOB2BR4rOSIdwCfs8+eyCT 6WukMb6v6unB24oQJoVis6/odx4r7oY7wzG7EX6KjY1CgPnXj29RrV5RPDX952VOdLWJ rSLqHJ5BOFXP+B40RoCp/x0lvfqpv7AgL8C5ABeyMYkJZ/DyRLU2BGn/MFVZiWpUnrQS XLx/+obTb+OdNfUPN8nt64zq7YfZckh5A8Ws1G7kf7AkBW6X+Q0o5rwipV6Y0o9056Bt CKXntOE8wWyFnjS44zPdTsp7GsSsTOqzElg2ulz4xychBre7LaxjPm86RG0NICpuMB5X 3YPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=OYsCQphrFkTsVVXxjq3sue57eMySXbrEkugySFi/daU=; fh=UtvlAAabJDX3s71tkBocNudmIMWb3i+GgAwh02hpKno=; b=GdRB7+gfQ2jS6HiodV6keesZLcZDCc1XJzPFOWi9J5IFIbNnqjE+vwxxdWZFo93CnH DHwITIt8/+6SOo65NyMcPWQjYiKEdC7CL/HFWDTx6GVcdptf9xz8Z/D9dRyugL2W4K4f PcQYBvKipEyr9OFV6ExM8taQ8VemvZgxRC1s0ltdAMRKPgde7LYVlHZd1Ky9QwwwTwBs m7taR3nSvp/k3dAOIwSpDP1A61TKFeOWbpHMvvJEl7hn5S/uuw0e6yFOjxOob1tlxk4E Kjeek7ud9SDUZLxxSgLrobXqy9es9JqPnN1UeqE8KP654sY+wADMOGKzd9n2eFZxO17X H6SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VjGCTE5f; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a17090a348100b00267ec897aa7si1165597pjb.104.2023.07.27.03.24.02; Thu, 27 Jul 2023 03:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VjGCTE5f; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233625AbjG0KU4 (ORCPT + 99 others); Thu, 27 Jul 2023 06:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233571AbjG0KUy (ORCPT ); Thu, 27 Jul 2023 06:20:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A385619AF; Thu, 27 Jul 2023 03:20:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 38C6E61DED; Thu, 27 Jul 2023 10:20:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9266C433C8; Thu, 27 Jul 2023 10:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690453251; bh=Uv0jglg4XDxm5uiOcl1Fs0VDdmS3vnj5J06IHksC3j0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=VjGCTE5fXWQGMkstr5mWfG/olGcukHbx9MJ5gIHM1kJfwo/BiFcjiuEaiA2TxQad6 b/CL9D78jYHhDiLBxLD9gCBB6CtR9Pngnq1E4RM+cWQl1ITCzXzhPBEMorh0UStJGb V5QypMia7H1mT7Yv9W7oIRfkDRB1G3xJIxfo7Y/Lymzj+mXx3lcBAFmRFbWxhh8lk9 h4N9LjcMkMC3/ZfJEah0qCVly/fWQ4ostsbFgLI1m7GG/WQbkHJ87BAgn9cUsNUERW XrnUyEDaK9+tFU+Iukly/qv+tfC9IZiVkgJJJYsmEkH+2gmJEivzAz4IAcCpkEsNUW WY8rxT9ubVHrA== Message-ID: Date: Thu, 27 Jul 2023 19:20:46 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3 28/49] dm zoned: dynamically allocate the dm-zoned-meta shrinker Content-Language: en-US To: Qi Zheng 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, Muchun Song , 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 References: <20230727080502.77895-1-zhengqi.arch@bytedance.com> <20230727080502.77895-29-zhengqi.arch@bytedance.com> <56ee1d92-28ee-81cb-9c41-6ca7ea6556b0@bytedance.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <56ee1d92-28ee-81cb-9c41-6ca7ea6556b0@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 7/27/23 17:55, Qi Zheng wrote: >>>           goto err; >>>       } >>>   +    zmd->mblk_shrinker->count_objects = dmz_mblock_shrinker_count; >>> +    zmd->mblk_shrinker->scan_objects = dmz_mblock_shrinker_scan; >>> +    zmd->mblk_shrinker->seeks = DEFAULT_SEEKS; >>> +    zmd->mblk_shrinker->private_data = zmd; >>> + >>> +    shrinker_register(zmd->mblk_shrinker); >> >> I fail to see how this new shrinker API is better... Why isn't there a >> shrinker_alloc_and_register() function ? That would avoid adding all this code >> all over the place as the new API call would be very similar to the current >> shrinker_register() call with static allocation. > > In some registration scenarios, memory needs to be allocated in advance. > So we continue to use the previous prealloc/register_prepared() > algorithm. The shrinker_alloc_and_register() is just a helper function > that combines the two, and this increases the number of APIs that > shrinker exposes to the outside, so I choose not to add this helper. And that results in more code in many places instead of less code + a simple inline helper in the shrinker header file... So not adding that super simple helper is not exactly the best choice in my opinion. -- Damien Le Moal Western Digital Research