[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110907210855.414d417e@kryten>
Date: Wed, 7 Sep 2011 21:08:55 +1000
From: Anton Blanchard <anton@...ba.org>
To: Theodore Tso <tytso@....EDU>
Cc: Tejun Heo <tj@...nel.org>, Eric Dumazet <eric.dumazet@...il.com>,
adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] percpu_counter: Put a reasonable upper bound on
percpu_counter_batch
Hi Ted,
> Um, this was an ext4 patch and I pointed out it could cause
> problems. (Specifically, data loss…)
I'm a bit confused. While the comment mentions ext4, the patch is just
putting an upper bound on the size of percpu_counter_batch and it is
useful for percpu_counter_compare() too:
static void compute_batch_value(void)
{
int nr = num_online_cpus();
- percpu_counter_batch = max(32, nr*2);
+ /*
+ * The cutoff point for the percpu_counter_compare() fast path grows
+ * at num_online_cpus^2 and on a big enough machine it will be
+ * unlikely to hit.
+ * We clamp the batch value to 1024 so the cutoff point only grows
+ * linearly past 512 CPUs.
+ */
+ percpu_counter_batch = clamp(nr*2, 32, 1024);
}
The batch value should be opaque to the rest of the kernel. If ext4
requires a specific batch value we can use the functions that take
an explicit one (eg __percpu_counter_add).
Anton
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists