Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756346Ab3FRRBy (ORCPT ); Tue, 18 Jun 2013 13:01:54 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:44085 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756153Ab3FRRBw (ORCPT ); Tue, 18 Jun 2013 13:01:52 -0400 Date: Tue, 18 Jun 2013 19:01:48 +0200 From: Frederic Weisbecker To: Oleg Nesterov Cc: Ingo Molnar , Vince Weaver , linux-kernel@vger.kernel.org, Peter Zijlstra , Paul Mackerras , Arnaldo Carvalho de Melo , trinity@vger.kernel.org, Jiri Olsa Subject: Re: [PATCH 2/2] hw_breakpoint: Introduce "struct bp_cpuinfo" Message-ID: <20130618170145.GI17619@somewhere.redhat.com> References: <20130602194912.GA3277@redhat.com> <20130602195057.GC3277@redhat.com> <20130618123741.GC17619@somewhere.redhat.com> <20130618144225.GA26920@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130618144225.GA26920@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2363 Lines: 77 On Tue, Jun 18, 2013 at 04:42:25PM +0200, Oleg Nesterov wrote: > On 06/18, Frederic Weisbecker wrote: > > > > On Sun, Jun 02, 2013 at 09:50:57PM +0200, Oleg Nesterov wrote: > > > This patch simply moves all per-cpu variables into the new single > > > per-cpu "struct bp_cpuinfo". > > > > > > To me this looks more logical and clean, but this can also simplify > > > the further potential changes. In particular, I do not think this > > > memory should be per-cpu, it is never used "locally". After this > > > change it is trivial to turn it into, say, bootmem[nr_cpu_ids]. > > > > > > Signed-off-by: Oleg Nesterov > > > > I'm ok with the patch because it's indeed more logical and clean to pack the info > > to a single struct. > > Great, > > > But I'm not sure why you think using per-cpu is a problem. It's not only > > deemed for optimized local uses, > > But it is. > > Simplest example, > > for_each_possible_cpu(cpu) > total_count = per_cpu(per_cpu_count, cpu); > > Every per_cpu() likely means the cache miss. Not to mention we need the > additional math to calculate the address of the local counter. > > for_each_possible_cpu(cpu) > total_count = bootmem_or_kmalloc_array[cpu]; > > is much better in this respect. > > And note also that per_cpu_count above can share the cacheline with > another "hot" per-cpu variable. Ah I see, that's good to know. But these variables are supposed to only be touched from slow path (perf events syscall, ptrace breakpoints creation, etc...), right? So this is probably not a problem? > > > it's also convenient for allocations and > > de-allocation, or static definitions. > > Yes, this is advantage. But afaics the only one. > > > I'm not sure why bootmem would make > > more sense. > > Or kcalloc(nr_cpu_ids), I didn't really mean that alloc_bootmem() is > necessarily the best option. Ok. Well if there are any real performance issue I don't mind using arrays of course. > > > Other than this in the changelog, the patch is nice, thanks! > > > > Acked-by: Frederic Weisbecker > > Thanks ;) > > Oleg. > -- 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/