From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757157AbZEVI5m (ORCPT ); Fri, 22 May 2009 04:57:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751920AbZEVI5f (ORCPT ); Fri, 22 May 2009 04:57:35 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:55097 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751590AbZEVI5e (ORCPT ); Fri, 22 May 2009 04:57:34 -0400 Date: Fri, 22 May 2009 10:57:16 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: Paul Mackerras , linux-kernel@vger.kernel.org, Corey Ashford , Thomas Gleixner Subject: Re: [PATCH 2/2] perf_counter: optimize context switch between identical inherited contexts Message-ID: <20090522085716.GB13482@elte.hu> References: <18966.10075.781053.231153@cargo.ozlabs.ibm.com> <18966.10666.517218.332164@cargo.ozlabs.ibm.com> <1242981131.26820.620.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1242981131.26820.620.camel@twins> User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Zijlstra wrote: > On Fri, 2009-05-22 at 14:27 +1000, Paul Mackerras wrote: > > > The equivalence of contexts is detected by keeping a pointer in > > each cloned context pointing to the context it was cloned from. > > To cope with the situation where a context is changed by adding > > or removing counters after it has been cloned, we also keep a > > generation number on each context which is incremented every time > > a context is changed. When a context is cloned we take a copy > > of the parent's generation number, and two cloned contexts are > > equivalent only if they have the same parent and the same > > generation number. In order that the parent context pointer > > remains valid (and is not reused), we increment the parent > > context's reference count for each context cloned from it. > > > + u32 generation; > > Suppose someone writes a malicious proglet that inherits the > counters, puts the child to sleep, does 2^32 mods on the counter > set, and then wakes up the child. > > Would that merely corrupt the results, or make the kernel explode? i think it should be an u64. Ingo