[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120327143737.GI5906@redhat.com>
Date: Tue, 27 Mar 2012 16:37:37 +0200
From: Andrea Arcangeli <aarcange@...hat.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Hillf Danton <dhillf@...il.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Dan Smith <danms@...ibm.com>, Paul Turner <pjt@...gle.com>,
Lai Jiangshan <laijs@...fujitsu.com>,
Rik van Riel <riel@...hat.com>, Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Lee Schermerhorn <Lee.Schermerhorn@...com>, linux-mm@...ck.org,
Suresh Siddha <suresh.b.siddha@...el.com>,
Mike Galbraith <efault@....de>,
Bharata B Rao <bharata.rao@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Johannes Weiner <hannes@...xchg.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 11/39] autonuma: CPU follow memory algorithm
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@...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