Re: [PATCH 11/39] autonuma: CPU follow memory algorithm

From: Andrea Arcangeli
Date: Tue Mar 27 2012 - 11:19:34 EST


On Tue, Mar 27, 2012 at 10:39:55AM +0200, Peter Zijlstra wrote:
> You can talk pretty much anything down to O(1) that way. Take an
> algorithm that is O(n) in the number of tasks, since you know you have a
> pid-space constraint of 30bits you can never have more than 2^30 (aka
> 1Gi) tasks, hence your algorithm is O(2^30) aka O(1).

Still this O notation thingy... This is not about the max value but
about the fact the number is _variable_ or _fixed_.

If you have a variable amount of entries (and variable amount of
memory) in a list it's O(N) where N is the number of entries (even if
we know the max ram is maybe 4TB?). If you've a _fixed_ number of them
it's O(1). Even if the fixed number is very large.

It basically shows it won't degraded depending on load, and the cost
per-schedule remains exactly fixed at all times (non liner cacheline
and out-of-order CPU execution/HT effects aside).

If it was O(N) the time this would take to run for each schedule shall
have to vary at runtime depending on a some variable factor N and
that's not the case here.

You can argue about CPU hotplug though.

But this is just math nitpicking because I already pointed out I agree
the cacheline hits on a 1024 way would be measurable and needs fixing.

I'm not sure how useful it is to keep arguing on the O notation when
we agree on what shall be optimized in practice.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/