Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp519087rwb; Thu, 27 Jul 2023 17:04:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5iclNzKUCHu8ZXL23hL2aoYJU7rRoFhu6MmHchzqSQHTko9LT3D1yFFlbXKDIXpLMh9Gg X-Received: by 2002:a05:6358:9494:b0:134:fdfc:4319 with SMTP id i20-20020a056358949400b00134fdfc4319mr802870rwb.20.1690502683311; Thu, 27 Jul 2023 17:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690502683; cv=none; d=google.com; s=arc-20160816; b=LciaUHETL+nktxsvxDEMPF5mCWWecWkEOq+6s2G5IEy417XTIxFG5oktgPMG2js5S9 oBr2ehpYF+Kj46MpVdGSKn7ToyBQ5ZkqU3O9ZochW/S10YH2erBPK0V0x1UHHAD/SESh yFZSfJx3lDGtJfVhPBum1b5rDFljZkbqP1z+riiTgIpPveiF2yl0+irxO3RLOf3hPQGm w72JjBCwsG9oCWPN1ojKro3jAH7zAU9mhpJPyVB7QmFEtTjzoggikWG8zhNVy0oR1fpg TLOSJDjRvdP0/KZPt4l3fQ5HzpOvd7GxjZwsTcpWlv1uiaZT0+aY1/tPO9DXMwlCMyFX 9FGQ== 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:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=GhQYpQtzB93TK2lOPrHFGZqAvfZLTmLHDaXv2Rau1bA=; fh=X0wQtQDs8WwzmFpOX+cFEk1I93yJSxngGssbxPFkIzI=; b=Kgj5XKj1MBAo+PG+7xDTElOz4iv8HkwsOLCRhuCRF2El/rmpfgpA4DtXk0MwPAXUOq WltnVeVqyjywIQ2CbO6H71rwSYauI0Q641eUN0+GLz4FwRM63m+ibAo506IAfECwc7Ed HwM6EyKvQHeUYTTyUvuKkfHDjNJ6VZLm/+P+qoG8ZGHUdyPZBqOM+HXrfdMSJ4afpAtg M96/Y8FeP38iqKRDzwZzqBrtGbOCyehqdHq40NwCoN1VAj0xsJLx/Ca83BYlpshnPuB+ 6BNwlB1lZ9R6K8TBmPp8RT/pcxAxjio6h8lc1zBOIL4JEvnjG4bZPPX/gEGCoZfV6JpN GZqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ak6ozI5M; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 q201-20020a632ad2000000b00553c2f85095si1854423pgq.832.2023.07.27.17.04.22; Thu, 27 Jul 2023 17:04:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=Ak6ozI5M; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 S232168AbjG0XtG (ORCPT + 99 others); Thu, 27 Jul 2023 19:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbjG0Xs7 (ORCPT ); Thu, 27 Jul 2023 19:48:59 -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 395133A8B; Thu, 27 Jul 2023 16:48:45 -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 C2C1461EFF; Thu, 27 Jul 2023 23:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5FDC433C7; Thu, 27 Jul 2023 23:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690501724; bh=Ttxo2VAoV3s10tVDpG1rs4f+uNBtPiAAdsRn7qEPqAI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Ak6ozI5MGJ+V/aaPZbipUbe6ZARep0hinqcaIFmiUbGlXqA4l6qqKubv3sXd24Wis E3nRqNpMPjywrGRezhx8kIl9BfOcFGOjuYtEl0wjzGKmd2W/r6L34Y8Q/Asia9+Ai+ N65piXMA54Y1i5SwziMjZGbgl+PlpLxLOgApRck3LvpJfpGiaZrCds1yq/RX5+TIOO TcyhaMq04sGg4mmvI/xNg53Zl5ogRkSJoPUjgXBUN2wkW+R/Z24fG4Bcn7szmrfhkb 1Y0rUs2KyI/CXZncywoQIP9j5+uNlee3CVuHYo0iSwOTdXpuIWfOUm7reRjWTqpcd1 EASuIvTp5UKtQ== Message-ID: <217f3a7e-7681-0da6-aaa7-252a1451f7ba@kernel.org> Date: Fri, 28 Jul 2023 08:48:37 +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 To: Dave Chinner Cc: Qi Zheng , 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, 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> Content-Language: en-US From: Damien Le Moal Organization: Western Digital Research In-Reply-To: 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-nfs@vger.kernel.org On 7/28/23 07:59, Dave Chinner wrote: > On Thu, Jul 27, 2023 at 07:20:46PM +0900, Damien Le Moal wrote: >> 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... > > It's not just a "simple helper" - it's a function that has to take 6 > or 7 parameters with a return value that must be checked and > handled. > > This was done in the first versions of the patch set - the amount of > code in each caller does not go down and, IMO, was much harder to > read and determine "this is obviously correct" that what we have > now. > >> So not adding that super simple >> helper is not exactly the best choice in my opinion. > > Each to their own - I much prefer the existing style/API over having > to go look up a helper function every time I want to check some > random shrinker has been set up correctly.... OK. All fair points. -- Damien Le Moal Western Digital Research