From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752114AbbJLMG5 (ORCPT ); Mon, 12 Oct 2015 08:06:57 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:2997 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbbJLMG4 (ORCPT ); Mon, 12 Oct 2015 08:06:56 -0400 Message-ID: <561BA200.20108@huawei.com> Date: Mon, 12 Oct 2015 20:05:20 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Peter Zijlstra , Kaixu Xia CC: , , , , , , , , , , Subject: Re: [RFC PATCH 1/2] perf: Add the flag sample_disable not to output data on samples References: <1444640563-159175-1-git-send-email-xiakaixu@huawei.com> <1444640563-159175-2-git-send-email-xiakaixu@huawei.com> <20151012120257.GO3816@twins.programming.kicks-ass.net> In-Reply-To: <20151012120257.GO3816@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.561BA212.027C,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ca0914da1af3f69f397e20cf9af54ba7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/10/12 20:02, Peter Zijlstra wrote: > On Mon, Oct 12, 2015 at 09:02:42AM +0000, Kaixu Xia wrote: >> --- a/include/linux/perf_event.h >> +++ b/include/linux/perf_event.h >> @@ -483,6 +483,8 @@ struct perf_event { >> perf_overflow_handler_t overflow_handler; >> void *overflow_handler_context; >> >> + atomic_t *sample_disable; >> + >> #ifdef CONFIG_EVENT_TRACING >> struct trace_event_call *tp_event; >> struct event_filter *filter; >> diff --git a/kernel/events/core.c b/kernel/events/core.c >> index b11756f..f6ef45c 100644 >> --- a/kernel/events/core.c >> +++ b/kernel/events/core.c >> @@ -6337,6 +6337,9 @@ static int __perf_event_overflow(struct perf_event *event, >> irq_work_queue(&event->pending); >> } >> >> + if ((event->sample_disable) && atomic_read(event->sample_disable)) >> + return ret; >> + >> if (event->overflow_handler) >> event->overflow_handler(event, data, regs); >> else > Try and guarantee sample_disable lives in the same cacheline as > overflow_handler. Could you please explain why we need them to be in a same cacheline? Thank you. > I think we should at the very least replace the kzalloc() currently used > with a cacheline aligned alloc, and check the structure layout to verify > these two do in fact share a cacheline.