Re: [PATCH] percpu: preemptless __per_cpu_counter_add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, Christoph.

On Thu, Apr 21, 2011 at 12:50:11PM -0500, Christoph Lameter wrote:
> Yes. But there was already a fuzzyiness coming with the
> __percpu_counter_sum() not seeing the percpu counters that are being
> updated due to unserialized access to the counters before this patch.
> There is no material difference here. The VM statistics counters work the
> same way and have to deal with similar fuzziness effects.

That basically amounts to "there's no difference between
percpu_counter_sum() and percpu_counter_read()", which is true in the
sense that both don't guarantee complete correctness.

The only difference between the two is the level of fuziness.  The
former deviates only by the number of concurrent updaters (and maybe
cacheline update latencies) while the latter may deviate in multiples
of @batch.

If you wanna say that the difference in the level of fuzziness is
irrelevant, the first patch of this series should be removing
percpu_counter_sum() before making any other changes.

So, yeah, here, the level of fuzziness matters and that's exactly why
we have the hugely costly percpu_counter_sum().  Even with the
proposed change, percpu_counter_sum() would tend to be more accurate
because the number of batch deviations is limited by the number of
concurrent updaters but it would still be much worse than before.

> The local counter increment was already decoupled before. The shifting of
> the overflow into the global counter was also not serialized before.

No, it wasn't.

	...
	if (count >= batch || count <= -batch) {
		spin_lock(&fbc->lock);
		fbc->count += count;
		__this_cpu_write(*fbc->counters, 0);
		spin_unlock(&fbc->lock);
	} else {
	...

percpu_counter_sum() would see either both the percpu and global
counters updated or un-updated.  It will never see local counter reset
with global counter not updated yet.

> There was no total accuracy before either.

It's not about total accuracy.  It's about different levels of
fuzziness.  If it can be shown that the different levels of fuzziness
doesn't matter and thus percpu_counter_sum() can be removed, I'll be a
happy camper.

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]