From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752145AbbJTLke (ORCPT ); Tue, 20 Oct 2015 07:40:34 -0400 Received: from mga09.intel.com ([134.134.136.24]:14587 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752014AbbJTLkL (ORCPT ); Tue, 20 Oct 2015 07:40:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,707,1437462000"; d="scan'208";a="830793224" From: Alexander Shishkin To: Mathieu Poirier , gregkh@linuxfoundation.org, a.p.zijlstra@chello.nl, acme@kernel.org, mingo@redhat.com, corbet@lwn.net, nicolas.pitre@linaro.org Cc: adrian.hunter@intel.com, zhang.chunyan@linaro.org, mike.leach@arm.com, tor@ti.com, al.grant@arm.com, pawel.moll@arm.com, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: Re: [PATCH V2 19/30] coresight: etb10: implementing the setup_aux() API In-Reply-To: <1445192687-24112-20-git-send-email-mathieu.poirier@linaro.org> References: <1445192687-24112-1-git-send-email-mathieu.poirier@linaro.org> <1445192687-24112-20-git-send-email-mathieu.poirier@linaro.org> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Tue, 20 Oct 2015 14:37:58 +0300 Message-ID: <874mhlhisp.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathieu Poirier writes: > /** > + * struct cs_buffer - keep track of a recording session' specifics > + * @cur: index of the current buffer > + * @nr_pages: max number of pages granted to us > + * @nr_bufs: number of clustered pages > + * @offset: offset within the current buffer > + * @size: how much space we have for this run > + * @data_size: how much we collected in this run > + * @head: head of the ring buffer > + * @lost: other than zero if we had a HW buffer wrap around > + * @snapshot: is this run in snapshot mode > + * @addr: virtual address this buffer starts at > + */ > +struct cs_buffers { > + unsigned int cur; > + unsigned int nr_pages; > + unsigned int nr_bufs; This one is not really used. > + unsigned long offset; > + unsigned long size; And this one seems to be only set in one place. > + local_t data_size; > + local_t head; And so is this one. > + local_t lost; > + bool snapshot; > + void *addr[0]; And this one seems to be a copy of what perf's ring buffer gives us. > +static void *etb_setup_aux(struct coresight_device *csdev, int cpu, > + void **pages, int nr_pages, bool overwrite) > +{ > + int node, pg; > + struct cs_buffers *buf; > + > + if (cpu == -1) > + cpu = smp_processor_id(); > + node = cpu_to_node(cpu); > + > + buf = kzalloc_node(offsetof(struct cs_buffers, addr[nr_pages]), > + GFP_KERNEL, node); > + if (!buf) > + return NULL; > + > + buf->snapshot = overwrite; > + buf->nr_pages = nr_pages; > + > + /* Record information about buffers */ > + for (pg = 0; pg < buf->nr_pages; pg++) > + buf->addr[pg] = pages[pg]; Yes, buf::addr is a copy of @pages. You could save some space by just saving @pages, it's going to be around until pmu::free_aux(). Regards, -- Alex