From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755296Ab2C0PTh (ORCPT ); Tue, 27 Mar 2012 11:19:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31512 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754699Ab2C0PTg (ORCPT ); Tue, 27 Mar 2012 11:19:36 -0400 Date: Tue, 27 Mar 2012 16:37:37 +0200 From: Andrea Arcangeli To: Peter Zijlstra Cc: Linus Torvalds , Hillf Danton , "Paul E. McKenney" , Dan Smith , Paul Turner , Lai Jiangshan , Rik van Riel , Ingo Molnar , Andrew Morton , Lee Schermerhorn , linux-mm@kvack.org, Suresh Siddha , Mike Galbraith , Bharata B Rao , Thomas Gleixner , Johannes Weiner , linux-kernel@vger.kernel.org Subject: Re: [PATCH 11/39] autonuma: CPU follow memory algorithm Message-ID: <20120327143737.GI5906@redhat.com> References: <1332783986-24195-1-git-send-email-aarcange@redhat.com> <1332783986-24195-12-git-send-email-aarcange@redhat.com> <1332786353.16159.173.camel@twins> <4F70C365.8020009@redhat.com> <20120326194435.GW5906@redhat.com> <20120326203951.GZ5906@redhat.com> <1332837595.16159.208.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1332837595.16159.208.camel@twins> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.