Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp488842rwb; Thu, 27 Jul 2023 16:29:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEw2vc97ZmbPhM2RecDEpN7E/3p5UREVZizycYMlNZyYJB4CuwOSjHPJfbldmlDuXfmdqZC X-Received: by 2002:a05:6a00:2e11:b0:686:32aa:e72f with SMTP id fc17-20020a056a002e1100b0068632aae72fmr120147pfb.14.1690500579350; Thu, 27 Jul 2023 16:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690500579; cv=none; d=google.com; s=arc-20160816; b=V95QnF4SXJeXDh6yXbVKHgpFzFVmpMq60MLPb2tM/VrJseUMzEhcTODTJ3BZgxLsgP rma4+7Kxp6clvcbKdAj/CILONYhr9LKbdrz4oivBqBIHy7ZkEIXMuxN/d5AKXRC64TLP Z2h/3qvo1FJPlrF9Nj72ROOIX1ZV2rZAqS/XxCz6LVnsy35SMY2yWgqCAQnJnZJ1ihbs 8C7kHvZTAawP/J2kyuSS5JHxhJO/SC0EYOhdku+Ikue61u8lZdqGRYpRkO0093ixEnNB fG+UQ3/ITd+WlMoBpPSlZ0lbdmCBpYN9gt6cmEXA10CGbEaNnwnsL/sg6fe4XphmjmUe WoUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8CTrna5t3S7P99W+zrM1I2ApZYIkXTVQedDFVAI6oIw=; fh=1h1ED0qs1Rxgy4wnX1Z7/TGdW8A5z3LCtdbNkVYHKJ0=; b=wegW4zYsINswQSAHUKOgnnkCntPJF36JVX6V11amfwI7WxuMx0TX44kktI4nW4YQQT d2b8THtPTO62ln2ocbnwUK6ybEmhSU1F2bPvSkF2z8kf0jtzHrPS2WN6y8hze3oXkcAm r1LHZVjYhCeXK8wKUP2wkDHTqx09zfl7M6U401oM6ZU1bXQF1yuOPk7e//9541aZolGq 6gSVSbvmCDhzWhppPFTbKnM7BlAMkNTAMVcIK44xNE3txVSZTb74jIit8Xu/6qXK0PN4 RYRV88gx3334PyNSNTaOtA7fSQ/g5e/xoQtKJYEy6eT23DkCoYn2RhfOlglnhkhGptZh f1lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=X7pt5Ouy; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020aa788c5000000b0063b1fbbb8c5si2055362pff.131.2023.07.27.16.29.18; Thu, 27 Jul 2023 16:29:39 -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=@fromorbit-com.20221208.gappssmtp.com header.s=20221208 header.b=X7pt5Ouy; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233156AbjG0W7p (ORCPT + 99 others); Thu, 27 Jul 2023 18:59:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232483AbjG0W7n (ORCPT ); Thu, 27 Jul 2023 18:59:43 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD662D64 for ; Thu, 27 Jul 2023 15:59:41 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-686f94328a4so673986b3a.0 for ; Thu, 27 Jul 2023 15:59:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20221208.gappssmtp.com; s=20221208; t=1690498781; x=1691103581; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=8CTrna5t3S7P99W+zrM1I2ApZYIkXTVQedDFVAI6oIw=; b=X7pt5OuyEbf8f6R9fnvI9dxfnaaqjP1RGRY8ZMiJ1wEZkopGyRUZXV3N7HE87n67xj XeLWxsKHlNX6ErnVJUF/xO5BY5VT61hhmCqWCbxit+6W6UUMx7WmvB86s0q+wgGSoL6W koucWxrpBOYNBJME5+HxRa/lXlSreJXWQaoDeJrNnWxYMUw7bNkMz2551ucFVRtsjQZW 0ldvdZqoq1ohkP2t1Jbzv+uf1kwplqapkGN1TtrTmsgZICGsR0gfv1ElN5pvcVjNfGjj OPatiCTf9mYCZ8F6QAcUCONXn7kELLjAWaYShbgFOaFFniHTDeIvjRJJRIf4kK+rSYkZ RVyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690498781; x=1691103581; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8CTrna5t3S7P99W+zrM1I2ApZYIkXTVQedDFVAI6oIw=; b=i6Y3kMuOf/6Q6l4+9VnIFJobCuZtCBZZZKS5LsX9kY0sMa8N7kXoAETRn2YZ3cqkUB F7ab1wEeTvNpJSnYH/WPrzVuGvaVTEgrVhSFm/1K+wAsh44dPXhua4VLIW+38v4a/N4H cWB7s4USkNGt66K4vHlSx+y5/cyEPTrssJiw8IQyqq9NfNMgoypU8DdJ2/CSrcXEefTf etJsjm7kYAn3U9PQCwp0fv5/qLgMm95k2r9eHkwgaD4YzNzZIFfcEO7D76hkpP5pRnmF VMdDyVDhfSeXHGs58OgQmDrOu01u1mcwAXYGCZctvzFtud7PPZOAk6vOBWVbxUWdkqGs BKjQ== X-Gm-Message-State: ABy/qLZ9CaIAb+VLrR0GsAqh1cDjSBg+T7LDHkU++tp5Vz7kugaD4WR6 oQYBA2pIF88yk8maF4wPUIrhkw== X-Received: by 2002:a05:6a00:17a8:b0:64d:42b9:6895 with SMTP id s40-20020a056a0017a800b0064d42b96895mr61072pfg.5.1690498780930; Thu, 27 Jul 2023 15:59:40 -0700 (PDT) Received: from dread.disaster.area (pa49-186-119-116.pa.vic.optusnet.com.au. [49.186.119.116]) by smtp.gmail.com with ESMTPSA id p24-20020aa78618000000b0068702b66ab1sm1115813pfn.174.2023.07.27.15.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 15:59:40 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1qP9xJ-00BKKZ-1O; Fri, 28 Jul 2023 08:59:37 +1000 Date: Fri, 28 Jul 2023 08:59:37 +1000 From: Dave Chinner To: Damien Le Moal 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 Subject: Re: [PATCH v3 28/49] dm zoned: dynamically allocate the dm-zoned-meta shrinker Message-ID: References: <20230727080502.77895-1-zhengqi.arch@bytedance.com> <20230727080502.77895-29-zhengqi.arch@bytedance.com> <56ee1d92-28ee-81cb-9c41-6ca7ea6556b0@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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.... -Dave. -- Dave Chinner david@fromorbit.com