From: Dave Chinner <david@fromorbit.com>
To: 王旭 <xuw2015@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: use percpu_counter_compare instead of naive comparing
Date: Fri, 17 Apr 2015 18:15:49 +1000 [thread overview]
Message-ID: <20150417081549.GG15810@dastard> (raw)
In-Reply-To: <CAPBX1xK85i8x3h1XmGsYi=0YvRiWqvKhFTOY-QJ3-XDtmm7BVg@mail.gmail.com>
On Fri, Apr 17, 2015 at 03:15:21PM +0800, 王旭 wrote:
> On Fri, Apr 17, 2015 at 12:06 PM, Dave Chinner <david@fromorbit.com> wrote:
> > On Fri, Apr 17, 2015 at 10:22:24AM +0800, xuw2015@gmail.com wrote:
> >> From: George Wang <xuw2015@gmail.com>
> >>
> >> Function percpu_counter_read just return the current counter, regardless of
> >> every cpu's count. This counter can be negative value, which will cause the
> >> checking of "allocated inode counts <= m_maxicount" false positive.
> >
> > Have you actually seen this, or is it just theoretical?
>
> I produced it by running unionmount-testsuites for overlay, based xfs as upper
> and lowerdir. I think I can extract the procedure to reproduce it.
Inteesting. I've never been able to get the unionmount-testsuit to
actually be able to run, let alone had it find problems.
> >> Commit 501ab3238753 "xfs: use generic percpu counters for inode counter
> <snip>
> > The correct fix is to use percpu_counter_read_positive(), because in
> > the majority of cases args.mp->m_maxicount is orders of magnitude
> > larger (20 million inodes per 100GB of fs space for small filesystems)
> > than the unaggregated per-cpu counts can cause the sum to go
> > negative. Hence if it is negative, it may as well be zero because it
> > makes no difference to the default threshold configurations.
>
> Thanks for the explanation, and I agree that totally.
> Besides, shall we use the exact count in xfs_fs_counts? Because it's a ioctl
> function, not so much sensitive performance.
Right, but that makes percpu_counter_read_positive is perfect for
ioctls like this: what is reported to userspace is never
perfectly accurate on a busy filesystem. Also, we don't what someone
repeatedly running that ioctl to adversely affect the performance of
the filesystem, which is what would happen if it was an accurate
sum.....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2015-04-17 8:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 2:22 [PATCH] xfs: use percpu_counter_compare instead of naive comparing xuw2015
2015-04-17 4:06 ` Dave Chinner
2015-04-17 7:15 ` 王旭
2015-04-17 8:15 ` Dave Chinner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150417081549.GG15810@dastard \
--to=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
--cc=xuw2015@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox