Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755777Ab1BYD0r (ORCPT ); Thu, 24 Feb 2011 22:26:47 -0500 Received: from smtp-out.google.com ([216.239.44.51]:13671 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755563Ab1BYD0q convert rfc822-to-8bit (ORCPT ); Thu, 24 Feb 2011 22:26:46 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=a5a1pEbP9jEzTZG6uoYMXTiAIKCSGK5yWo/8JYvbT0pgnsvVjYEPcB0I4ashFhhjp+ EVVm1y8fqFAZEJh36KJQ== MIME-Version: 1.0 In-Reply-To: <1298467932.2217.763.camel@twins> References: <20110216031831.571628191@google.com> <20110216031841.258879435@google.com> <1298467932.2217.763.camel@twins> From: Paul Turner Date: Thu, 24 Feb 2011 19:26:14 -0800 Message-ID: Subject: Re: [CFS Bandwidth Control v4 5/7] sched: add exports tracking cfs bandwidth control statistics To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Bharata B Rao , Dhaval Giani , Balbir Singh , Vaidyanathan Srinivasan , Gautham R Shenoy , Srivatsa Vaddagiri , Kamalesh Babulal , Ingo Molnar , Pavel Emelyanov , Herbert Poetzl , Avi Kivity , Chris Friesen , Nikhil Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 33 On Wed, Feb 23, 2011 at 5:32 AM, Peter Zijlstra wrote: > On Tue, 2011-02-15 at 19:18 -0800, Paul Turner wrote: >> + ? ? ? raw_spin_lock(&cfs_b->lock); >> + ? ? ? cfs_b->throttled_time += (rq->clock - cfs_rq->throttled_timestamp); >> + ? ? ? raw_spin_unlock(&cfs_b->lock); > > That seems to put the cost of things on the wrong side. Read is rare, > update is frequent, and you made the frequent thing the most expensive > one. Hum.. the trade-off here is non-trivial I think - This update is only once per-quota period (*if* we throttled within that period). This places the frequency in the 10s-100s of ms range. - Sampling would probably occur on an order of once a second (assuming some enterprise management system that cares about these statistics). If we make the update cheaper by moving this per-cpu, then yes the updates are cheaper but the reads now having per-cpu cost makes the overall cost about the same (multiplying frequency by delta cost). We could move the global accrual to an atomic, but this isn't any cheaper given that this lock shouldn't be contended. > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/