[Top] [All Lists]

Re: [PATCH] xfs: use percpu_counter_compare instead of naive comparing

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs: use percpu_counter_compare instead of naive comparing
From: çæ <xuw2015@xxxxxxxxx>
Date: Fri, 17 Apr 2015 15:15:21 +0800
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=aazHGilcP3nvYEOTZQifrzLwZcSMKUq6i/kzhGemiX0=; b=Z7uWhl+/GYlKWv44+stJH5Cm8210vpZzClscuKvXx7Obmh9LmjQVXz26YU94+ngEt5 5WSCVaX12GVD/lwfR+DD4lzasgvCaqMn097fYIYI2H2uGKYJxGCO7V1XPS8p6s4ggr36 mxh4Q5nfNpMq+JY5DIIOz7HE5HRmgB0cRDb7tJh/gnrJljuJWTT8CHwGdN6IAbMzo1zN p8NSy0fYQKL+jJLvxvVqYGpmZskRRIiw7cXOtRbxVsDgavDe+q5es7cow8ousVeTfMPv SHa9GbOViudMbkC9qFQi1EtxpayfnLvtqVK89I6oLbbzRwbtykZl9DERWxfPVTb7f5ja HNqg==
In-reply-to: <20150417040605.GE15810@dastard>
References: <1429237344-5668-1-git-send-email-xuw2015@xxxxxxxxx> <20150417040605.GE15810@dastard>
On Fri, Apr 17, 2015 at 12:06 PM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
> On Fri, Apr 17, 2015 at 10:22:24AM +0800, xuw2015@xxxxxxxxx wrote:
>> From: George Wang <xuw2015@xxxxxxxxx>
>> 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.

>> Commit 501ab3238753 "xfs: use generic percpu counters for inode counter
> 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.

<Prev in Thread] Current Thread [Next in Thread>