[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1274440538.26328.3575.camel@gandalf.stny.rr.com>
Date: Fri, 21 May 2010 07:15:38 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
Arnaldo Carvalho de Melo <acme@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 09/10] perf: Remove more fastpath code
On Fri, 2010-05-21 at 11:02 +0200, Peter Zijlstra wrote:
> plain text document attachment (perf-opt-output-more.patch)
> Sanity checks cost instructions
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
> -
> - /*
> - * Check we didn't copy past our reservation window, taking the
> - * possible unsigned int wrap into account.
> - */
> - if (WARN_ON_ONCE(((long)(handle->head - handle->offset)) < 0))
> - return;
Are you sure you want to remove this? I mean, sanity checks are a small
cost (I have several in the ftrace ring buffer) and can catch bugs in
case something happens during development. Especially when the code is
under a lot of flux.
I even have a sanity check that Ingo asked me to add, which would detect
if a tracer (not the ring buffer, but the user of the ring buffer)
recursed on itself. I think that check detected one bug in the function
tracer in the begging, but hasn't caught anything since.
-- Steve
> -
> do {
> - unsigned long size = min(handle->size, len);
> + unsigned long size = min_t(unsigned long, handle->size, len);
>
> memcpy(handle->addr, buf, size);
>
> @@ -3054,15 +3045,12 @@ int perf_output_begin(struct perf_output
> goto fail;
> } while (local_cmpxchg(&data->head, offset, head) != offset);
>
> - handle->offset = offset;
> - handle->head = head;
> -
> if (head - local_read(&data->wakeup) > data->watermark)
> local_add(data->watermark, &data->wakeup);
>
> - handle->page = handle->offset >> (PAGE_SHIFT + page_order(data));
> + handle->page = offset >> (PAGE_SHIFT + page_order(data));
> handle->page &= data->nr_pages - 1;
> - handle->size = handle->offset & ((PAGE_SIZE << page_order(data)) - 1);
> + handle->size = offset & ((PAGE_SIZE << page_order(data)) - 1);
> handle->addr = data->data_pages[handle->page];
> handle->addr += handle->size;
> handle->size = (PAGE_SIZE << page_order(data)) - handle->size;
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists