Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754722AbYFRMIu (ORCPT ); Wed, 18 Jun 2008 08:08:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752969AbYFRMIj (ORCPT ); Wed, 18 Jun 2008 08:08:39 -0400 Received: from sinclair.provo.novell.com ([137.65.248.137]:20819 "EHLO sinclair.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754137AbYFRMId convert rfc822-to-8bit (ORCPT ); Wed, 18 Jun 2008 08:08:33 -0400 Message-Id: <4858C286.BA47.005A.0@novell.com> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Wed, 18 Jun 2008 06:08:38 -0600 From: "Gregory Haskins" To: "Ingo Molnar" , "Marin Mitov" Cc: "Andi Kleen" , "Clark Williams" , "Steven Rostedt" , "Peter Zijlstra" , "Thomas Gleixner" , "Linus Torvalds" , , "Luis Claudio R. Goncalves" , "LKML" , "linux-rt-users" Subject: Re: [PATCH][resubmit] x86: enable preemption in delay References: <200805252108.25011.mitov@issp.bas.bg> <200806091911.21850.mitov@issp.bas.bg> <20080609161606.GA24841@elte.hu> <200806152058.17142.mitov@issp.bas.bg> <20080618075518.GD4135@elte.hu> In-Reply-To: <20080618075518.GD4135@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1702 Lines: 38 >>> On Wed, Jun 18, 2008 at 3:55 AM, in message <20080618075518.GD4135@elte.hu>, Ingo Molnar wrote: > * Marin Mitov wrote: > >> Why not something like that (do keep in mind I am not an expert :-): >> >> static void delay_tsc(unsigned long loops) >> { >> get and store the mask of allowed cpus; >> /* prevent the migration */ >> set the mask of allowed cpus to the current cpu only; >> /* is it possible? could it be guaranteed? */ >> loop for the delay; >> restore the old mask of allowed cpus; >> } >> >> You have got the idea. Could it be realized? Is it more expensive than >> the current realization? So, comments, please. > > hm, changing/saving/restorig cpus_allowed is really considered a 'heavy' > operation compared to preempt_disable(). On a 4096 CPUs box cpus_allowed > is 4096 bits which is half a kilobyte ... > > preempt_disable()/enable() on the other hand only touches a single > variable, (thread_info->preempt_count which is an u32) > > Ingo FWIW: I had submitted some "migration disable" patches a while back that would solve this without the cpus_allowed manipulations described here. Its more expensive than a preempt-disable (but its preemptible), yet its way cheaper (and more correct / less racy) than chaning cpus_allowed. I could resubmit if there was any interest, though I think Ingo said he didnt like the concept on the first pass. Anyway, FYI. -Greg -- 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/