[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240417155438.1060996-1-alexjlzheng@tencent.com>
Date: Wed, 17 Apr 2024 23:54:38 +0800
From: Jinliang Zheng <alexjlzheng@...il.com>
To: djwong@...nel.org
Cc: alexjlzheng@...il.com,
alexjlzheng@...cent.com,
chandan.babu@...cle.com,
david@...morbit.com,
linux-kernel@...r.kernel.org,
linux-xfs@...r.kernel.org
Subject: Re: [PATCH v3 RESEND] xfs: remove redundant batch variables for serialization
On Wed, 17 Apr 2024 08:27:13 -0700, djwong@...nel.org wrote:
> On Wed, Apr 17, 2024 at 08:07:35PM +0800, alexjlzheng@...il.com wrote:
> > From: Jinliang Zheng <alexjlzheng@...cent.com>
> >
> > Historically, when generic percpu counters were introduced in xfs for
> > free block counters by commit 0d485ada404b ("xfs: use generic percpu
> > counters for free block counter"), the counters used a custom batch
> > size. In xfs_mod_freecounter(), originally named xfs_mod_fdblocks(),
> > this patch attempted to serialize the program using a smaller batch size
> > as parameter to the addition function as the counter approaches 0.
> >
> > Commit 8c1903d3081a ("xfs: inode and free block counters need to use
> > __percpu_counter_compare") pointed out the error in commit 0d485ada404b
> > ("xfs: use generic percpu counters for free block counter") mentioned
> > above and said that "Because the counters use a custom batch size, the
> > comparison functions need to be aware of that batch size otherwise the
> > comparison does not work correctly". Then percpu_counter_compare() was
> > replaced with __percpu_counter_compare() with parameter
> > XFS_FDBLOCKS_BATCH.
> >
> > After commit 8c1903d3081a ("xfs: inode and free block counters need to
> > use __percpu_counter_compare"), the existence of the batch variable is
> > no longer necessary, so this patch is proposed to simplify the code by
> > removing it.
> >
> > Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>
> > ---
> > Changelog:
> >
> > v3: Resend for the second time
> >
> > v2: https://lore.kernel.org/linux-xfs/20230918043344.890817-1-alexjlzheng@tencent.com/
> >
> > v1: https://lore.kernel.org/linux-xfs/20230908235713.GP28202@frogsfrogsfrogs/T/#t
>
> ...you still haven't answered my question from V1: What problem are you
> solving with this patch?
Hi, thank you for your reply. :)
I'm trying to simplify the code. When percpu_counter_add_batch() and
__percpu_counter_compare() use the same batch size, percpu_counter can count
correctly, so there is no need to reduce the batch size to 1, which will cause
unnecessary serialization.
Best regards,
Jinliang Zheng
>
> --D
Powered by blists - more mailing lists