* Re: [PATCH v3 28/49] dm zoned: dynamically allocate the dm-zoned-meta shrinker
[not found] ` <ba0868b2-9f90-3d81-1c91-8810057fb3ce@kernel.org>
@ 2023-07-27 22:59 ` Dave Chinner via Virtualization
0 siblings, 0 replies; only message in thread
From: Dave Chinner via Virtualization @ 2023-07-27 22:59 UTC (permalink / raw)
To: Damien Le Moal
Cc: kvm, djwong, roman.gushchin, Qi Zheng, virtualization, linux-mm,
dm-devel, linux-mtd, cel, x86, steven.price, cluster-devel,
xen-devel, linux-ext4, paulmck, linux-arm-msm, brauner, rcu,
linux-bcache, dri-devel, Muchun Song, yujie.liu, vbabka,
linux-raid, linux-nfs, tytso, netdev, muchun.song, linux-kernel,
linux-f2fs-devel, linux-xfs, senozhatsky, gregkh, linux-fsdevel,
akpm, linux-erofs, linux-btrfs, tkhai
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
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-27 22:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230727080502.77895-1-zhengqi.arch@bytedance.com>
[not found] ` <20230727080502.77895-29-zhengqi.arch@bytedance.com>
[not found] ` <baaf7de4-9a0e-b953-2b6a-46e60c415614@kernel.org>
[not found] ` <56ee1d92-28ee-81cb-9c41-6ca7ea6556b0@bytedance.com>
[not found] ` <ba0868b2-9f90-3d81-1c91-8810057fb3ce@kernel.org>
2023-07-27 22:59 ` [PATCH v3 28/49] dm zoned: dynamically allocate the dm-zoned-meta shrinker Dave Chinner via Virtualization
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).