From patchwork Tue Jun 11 16:42:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 17893 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7762625E0F for ; Thu, 13 Jun 2013 10:57:09 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id fe20sf10526873lab.2 for ; Thu, 13 Jun 2013 03:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:resent-from:resent-date:resent-message-id:resent-to :sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-google-group-id:list-post :list-help:list-archive:list-unsubscribe; bh=FFaPub1AMDphkfnwlUl+nlOj55xEeII7I3AuVmy40FQ=; b=nG9NscTIxstsBJGLBa58KRU+8MLIR7c0jq4OGCWjmSuPeU5WgQw3GtVyrYz4uh6PJ3 fBFggl+9gfh44q96KOqoiLXGo6bId8LB4G77TkX0Pa8khLzETBX0ObH2vyoKJxzQPnhJ u3pU7Wr1VSGOsfd+oMYwoio6BEGm6fVWzzUOD8GBT6Gotpc5xnwCwstt/3K66G1XjQsY JQ8vAk8zE2bXRwFVxTBEMkoE+BTeMMG2dq39ssV64s3EE9MLFPdFDFWLm3AeSYDiB2Yq K8m8n6GMxj+Py7mQnJUEulAVrZIIDroAOJF75U12+GDW1alNwFR2xgcd/lhXw4YP41BE b6Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:resent-from:resent-date:resent-message-id:resent-to :sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=FFaPub1AMDphkfnwlUl+nlOj55xEeII7I3AuVmy40FQ=; b=Ypk6bAS97sD2fr7Uq3WiCyG00MuEwohYyY2QBcN3XUACkRwtj80hDUhd4pCXrPF1Yn BjcE5QGGrrXrTZQ4ibNrhoUVy5PRyYlSiZdOi3rbbfkO1uX0VnyZ4t50QeXWAzy4RSRd lqvgegyqFNjG2MhkgpbzhzcO0++TblHbfQQnxOBqt79ld3sHbqCmhd01v+3z3KnkPYOl Q1cF6t+SOTMHuQJxii1dlb0l57QonUMOiV/HATONgDAfMFYUM9ueAcNUoVITZkgpEJUG 9c925ZP95aIIiO6FFTHRNfwlJFeD650qD6ps6oYacavpiYnxMUmiXCAqDzCiGvewZRFs xxHg== X-Received: by 10.180.37.229 with SMTP id b5mr6030039wik.4.1371121027531; Thu, 13 Jun 2013 03:57:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.9.47 with SMTP id w15ls405586wia.17.canary; Thu, 13 Jun 2013 03:57:07 -0700 (PDT) X-Received: by 10.180.39.236 with SMTP id s12mr7192084wik.14.1371121027342; Thu, 13 Jun 2013 03:57:07 -0700 (PDT) Received: from mail-ve0-x229.google.com (mail-ve0-x229.google.com [2607:f8b0:400c:c01::229]) by mx.google.com with ESMTPS id fd9si2549753wic.87.2013.06.13.03.57.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:57:07 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::229; Received: by mail-ve0-f169.google.com with SMTP id m1so7757775ves.0 for ; Thu, 13 Jun 2013 03:57:06 -0700 (PDT) X-Received: by 10.58.100.234 with SMTP id fb10mr131715veb.5.1371121026178; Thu, 13 Jun 2013 03:57:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.191.99 with SMTP id gx3csp16601vec; Thu, 13 Jun 2013 03:57:05 -0700 (PDT) X-Received: by 10.205.37.16 with SMTP id tc16mr57057bkb.100.1371121023376; Thu, 13 Jun 2013 03:57:03 -0700 (PDT) Received: from mail-bk0-x22a.google.com (mail-bk0-x22a.google.com [2a00:1450:4008:c01::22a]) by mx.google.com with ESMTPS id ns6si3522702bkb.349.2013.06.13.03.57.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:57:03 -0700 (PDT) Received-SPF: pass (google.com: domain of rric.net@gmail.com designates 2a00:1450:4008:c01::22a as permitted sender) client-ip=2a00:1450:4008:c01::22a; Received: by mail-bk0-f42.google.com with SMTP id jk13so5152501bkc.29 for ; Thu, 13 Jun 2013 03:57:01 -0700 (PDT) X-Received: by 10.204.163.130 with SMTP id a2mr63943bky.62.1371121021277; Thu, 13 Jun 2013 03:57:01 -0700 (PDT) Received: from rric.localhost (g224198135.adsl.alicedsl.de. [92.224.198.135]) by mx.google.com with ESMTPSA id ok9sm3054549bkb.8.2013.06.13.03.57.00 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:57:00 -0700 (PDT) Resent-From: Robert Richter Resent-Date: Thu, 13 Jun 2013 12:56:58 +0200 Resent-Message-ID: <20130613105658.GF12218@rric.localhost> Resent-To: linaro-kernel@lists.linaro.org, patches@linaro.org Received: from rric.localhost (f053086247.adsl.alicedsl.de. [78.53.86.247]) by mx.google.com with ESMTPSA id b12sm6160884bkz.0.2013.06.11.09.42.57 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 09:42:58 -0700 (PDT) Sender: Robert Richter From: Robert Richter To: Borislav Petkov Cc: Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , Jiri Olsa , linux-kernel@vger.kernel.org, Robert Richter , Robert Richter Subject: [PATCH v2 05/14] perf, persistent: Rework struct pers_event_desc Date: Tue, 11 Jun 2013 18:42:31 +0200 Message-Id: <1370968960-22527-6-git-send-email-rric@kernel.org> X-Mailer: git-send-email 1.8.1.1 In-Reply-To: <1370968960-22527-1-git-send-email-rric@kernel.org> References: <1370968960-22527-1-git-send-email-rric@kernel.org> X-Gm-Message-State: ALoCoQnepv/7XobzX15iavwu4UiltOuXtovOwCU2DUnTSCBIFEvvkc0NJt6ODHJbc7RG2DYftIgd X-Original-Sender: rric.net@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gmail.com Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Robert Richter Struct pers_event_desc is only used in kernel/events/persistent.c. Moving it there. Also, removing attr member as this is a copy of event->attr. Signed-off-by: Robert Richter Signed-off-by: Robert Richter --- include/linux/perf_event.h | 7 ------- kernel/events/persistent.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index d2a42b7..dc72c93 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -518,13 +518,6 @@ struct perf_output_handle { int page; }; -struct pers_event_desc { - struct perf_event_attr *attr; - struct perf_event *event; - struct list_head plist; - int fd; -}; - #ifdef CONFIG_PERF_EVENTS extern int perf_pmu_register(struct pmu *pmu, char *name, int type); diff --git a/kernel/events/persistent.c b/kernel/events/persistent.c index 53411b4..d7aaf95 100644 --- a/kernel/events/persistent.c +++ b/kernel/events/persistent.c @@ -8,6 +8,12 @@ /* 512 kiB: default perf tools memory size, see perf_evlist__mmap() */ #define CPU_BUFFER_NR_PAGES ((512 * 1024) / PAGE_SIZE) +struct pers_event_desc { + struct perf_event *event; + struct list_head plist; + int fd; +}; + static DEFINE_PER_CPU(struct list_head, pers_events); static struct perf_event * @@ -33,7 +39,6 @@ add_persistent_event_on_cpu(unsigned int cpu, struct perf_event_attr *attr, rcu_assign_pointer(event->rb, buf); desc->event = event; - desc->attr = attr; INIT_LIST_HEAD(&desc->plist); list_add_tail(&desc->plist, &per_cpu(pers_events, cpu)); @@ -59,7 +64,7 @@ static void del_persistent_event(int cpu, struct perf_event_attr *attr) struct perf_event *event = NULL; list_for_each_entry_safe(desc, tmp, &per_cpu(pers_events, cpu), plist) { - if (desc->attr->config == attr->config) { + if (desc->event->attr.config == attr->config) { event = desc->event; break; } @@ -78,7 +83,6 @@ static void del_persistent_event(int cpu, struct perf_event_attr *attr) perf_event_release_kernel(event); put_unused_fd(desc->fd); - kfree(desc->attr); kfree(desc); } @@ -165,7 +169,7 @@ int perf_get_persistent_event_fd(unsigned cpu, struct perf_event_attr *attr) return -EINVAL; list_for_each_entry(desc, &per_cpu(pers_events, cpu), plist) - if (desc->attr->config == attr->config) + if (desc->event->attr.config == attr->config) return __alloc_persistent_event_fd(desc); return -ENODEV;