From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753495AbYI0AFa (ORCPT ); Fri, 26 Sep 2008 20:05:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752339AbYI0AFW (ORCPT ); Fri, 26 Sep 2008 20:05:22 -0400 Received: from relay1.sgi.com ([192.48.171.29]:59378 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752162AbYI0AFW (ORCPT ); Fri, 26 Sep 2008 20:05:22 -0400 Message-ID: <48DD78C6.5030701@sgi.com> Date: Fri, 26 Sep 2008 17:05:26 -0700 From: Mike Travis User-Agent: Thunderbird 2.0.0.6 (X11/20070801) MIME-Version: 1.0 To: Steven Rostedt CC: Peter Zijlstra , LKML , Ingo Molnar , Thomas Gleixner , Andrew Morton , prasad@linux.vnet.ibm.com, Linus Torvalds , Mathieu Desnoyers , "Frank Ch. Eigler" , David Wilder , hch@lst.de, Martin Bligh , Christoph Hellwig , Masami Hiramatsu , Steven Rostedt , Arnaldo Carvalho de Melo Subject: Re: [PATCH v6] Unified trace buffer References: <20080925185154.230259579@goodmis.org> <20080925185236.244343232@goodmis.org> <48DC406D.1050508@redhat.com> <1222456474.16700.289.camel@lappy.programming.kicks-ass.net> <48DD61F4.3000704@sgi.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Steven Rostedt wrote: > On Fri, 26 Sep 2008, Mike Travis wrote: > >> Peter Zijlstra wrote: >>> On Fri, 2008-09-26 at 14:05 -0400, Steven Rostedt wrote: >>>> +struct ring_buffer { >>>> + unsigned long size; >>>> + unsigned pages; >>>> + unsigned flags; >>>> + int cpus; >>>> + atomic_t record_disabled; >>>> + >>>> + struct mutex mutex; >>>> + >>>> + /* FIXME: this should be online CPUS */ >>>> + struct ring_buffer_per_cpu *buffers[NR_CPUS]; >>> actually nr_possible makes sense, and you might consider always >>> allocating buffers (and keeping them for offlined cpus) to avoid massive >>> allocations/frees cpu-hotplug events. >>> >>> Mike Travis has been going over the kernel removing constructs like >>> this, and replacing them with dynamically allocated arrays of >>> nr_possible. >>> >>>> +}; >> The other thing to consider is using a percpu variable. > > This structure is allocated on request. > > -- Steve Ahh, then it would need the yet to be added cpu_alloc() from Christoph. Your best bet then is to allocate based on nr_cpu_ids. Cheers, Mike