[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <A91A91A5-9EF0-42FE-B1C3-184D65112EA9@mit.edu>
Date: Fri, 26 Aug 2011 07:48:52 -0400
From: Theodore Tso <tytso@....EDU>
To: Anton Blanchard <anton@...ba.org>
Cc: adilger.kernel@...ger.ca, eric.dumazet@...il.com, tj@...nel.org,
linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] percpu_counter: Put a reasonable upper bound on percpu_counter_batch
On Aug 25, 2011, at 5:29 PM, Anton Blanchard wrote:
>
> When testing on a 1024 thread ppc64 box I noticed a large amount of
> CPU time in ext4 code.
>
> ext4_has_free_blocks has a fast path to avoid summing every free and
> dirty block per cpu counter, but only if the global count shows more
> free blocks than the maximum amount that could be stored in all the
> per cpu counters.
>
> Since percpu_counter_batch scales with num_online_cpus() and the maximum
> amount in all per cpu counters is percpu_counter_batch * num_online_cpus(),
> this breakpoint grows at O(n^2).
I understand why we would want to reduce this number. Unfortunately, the
question is what do we do if all 1024 threads try to do buffered writes into
the file system at the same instant, when we have less than 4 megabytes
of space left?
The problem is that we can then do more writes than we have space, and
we will only find out about it at write back time, when the process may have
exited already -- at which point data loss is almost inevitable. (We could
keep the data in cache and frantically page the system administrator to
delete some files to make room for dirty data, but that's probably not going
to end well….)
What we can do if we must clamp this threshold is to also increase the
threshold at which we shift away from delayed allocation. We'll then
allocate each block at write time, which does mean more CPU and
less efficient allocation of blocks, but if we're down to our last 4 megabytes,
there's probably not much we can do that will be efficient as far as
block layout anyway….
-- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists