Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755353AbZA3M5i (ORCPT ); Fri, 30 Jan 2009 07:57:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752519AbZA3M5b (ORCPT ); Fri, 30 Jan 2009 07:57:31 -0500 Received: from brick.kernel.dk ([93.163.65.50]:18343 "EHLO kernel.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbZA3M5a (ORCPT ); Fri, 30 Jan 2009 07:57:30 -0500 Date: Fri, 30 Jan 2009 13:55:40 +0100 From: Jens Axboe To: Peter Zijlstra Cc: Linus Torvalds , Steven Rostedt , Andrew Morton , LKML , Rusty Russell , npiggin@suse.de, Ingo Molnar , Thomas Gleixner , Arjan van de Ven Subject: Re: [PATCH -v3] use per cpu data for single cpu ipi calls Message-ID: <20090130125540.GS30821@kernel.dk> References: <1233253380.4495.123.camel@laptop> <1233254680.4495.126.camel@laptop> <20090130112310.GI30821@kernel.dk> <1233318733.4495.174.camel@laptop> <20090130123858.GQ30821@kernel.dk> <1233319731.4495.177.camel@laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1233319731.4495.177.camel@laptop> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2513 Lines: 61 On Fri, Jan 30 2009, Peter Zijlstra wrote: > On Fri, 2009-01-30 at 13:38 +0100, Jens Axboe wrote: > > > > if (!wait) { > > > + /* > > > + * We are calling a function on a single CPU > > > + * and we are not going to wait for it to finish. > > > + * We first try to allocate the data, but if we > > > + * fail, we fall back to use a per cpu data to pass > > > + * the information to that CPU. Since all callers > > > + * of this code will use the same data, we must > > > + * synchronize the callers to prevent a new caller > > > + * from corrupting the data before the callee > > > + * can access it. > > > + * > > > + * The CSD_FLAG_LOCK is used to let us know when > > > + * the IPI handler is done with the data. > > > + * The first caller will set it, and the callee > > > + * will clear it. The next caller must wait for > > > + * it to clear before we set it again. This > > > + * will make sure the callee is done with the > > > + * data before a new caller will use it. > > > + * We use spinlocks to manage the callers. > > > + */ > > > > That last sentence appears stale now, since there's no locking involved > > for the per-cpu csd. > > Gah, I edited that, and generated the patch using > > # git diff --stat -p 4f4b6c1a94a8735bbdc030a2911cf395495645b6.. kernel/smp.c | xclip > > on Ingo's tip/master. However it seems such a diff does not include > non-commited changes, even though a regular git diff does: > > # git diff kernel/smp.c > diff --git a/kernel/smp.c b/kernel/smp.c > index 9eead6c..bbedbb7 100644 > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -251,7 +251,6 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info, > * it to clear before we set it again. This > * will make sure the callee is done with the > * data before a new caller will use it. > - * We use spinlocks to manage the callers. > */ > data = kmalloc(sizeof(*data), GFP_ATOMIC); > if (data) > > What is the recommended way to do such a diff? Drop the .. and it should work. Don't ask me why :-) -- Jens Axboe -- 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/