From patchwork Tue Jun 11 16:42:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 17888 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f200.google.com (mail-gh0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 22F2D25DF1 for ; Thu, 13 Jun 2013 10:56:50 +0000 (UTC) Received: by mail-gh0-f200.google.com with SMTP id 10sf4344971ghy.7 for ; Thu, 13 Jun 2013 03:56:49 -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=1LWJzvOSWIIVZnIyxeYFdy2+Rlu8GYd8ybGD1gxkAwk=; b=YO7gGrv0UjTDRJWGgfrvWHgmJjHZuqbDuCLj++5RZ5jUBuVGZHV/zGgQ32oPcpkEiZ XKkv2JBoNRKTZOpvaoTyvMiiDfW0dafiZb6m/QF5srdQc2+Nmk1mNlPZ8bRLLWqFLn2E Q99vguzPY1qKSkKrE6gy/m5V+/JnYzIVnz950MEWor9snFxXvpUzG8IWpj6k4OJxtLip c8Fv3YR77Tduo7mZhRW8j/q04EWTB9IQ6/BVZhzU2qbMLBX0H1lbDa61K3OYwLQshm8Z 7nNH1NK1IYLfzIAhHLGQZAoOcK4+UpxP+OxJFMehZSHndzcx/vap9Pf60MVqnqxsDGcs 3wow== 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=1LWJzvOSWIIVZnIyxeYFdy2+Rlu8GYd8ybGD1gxkAwk=; b=gJnKDm9eqG2PLubj7fb7frxStBQjKyCU4X92h7sjUgouQOI+656nSaXMDJ6LjmfYoY TvydEBX3ybepz7hEyd4Fu8Mls8cosgUIoJaryvHHYZLh6Q9rQWvpGRvEU6k4VMsApPJk EA1hlsg6nM8uivAMmU4aFG7/H6JpITrrGOCweysGaZ5xJSvKGOhLpX6yVkufyfmyixog v8IGRxnVnnkSbnRAiR7P9qexNoG2JRs6vuIG10xP3xcr9KIYS1196EDOdpHzxjX6Gdv0 h9eNMXRxiuthKogx0YEWgsukW2Ehp3cuZiL8nb5QhrFu1ARLvn/bydpK/VhON8jlU2ef RGSA== X-Received: by 10.236.79.67 with SMTP id h43mr90317yhe.46.1371121009880; Thu, 13 Jun 2013 03:56:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.103.132 with SMTP id fw4ls4021191qeb.17.gmail; Thu, 13 Jun 2013 03:56:49 -0700 (PDT) X-Received: by 10.58.255.229 with SMTP id at5mr85269ved.44.1371121009736; Thu, 13 Jun 2013 03:56:49 -0700 (PDT) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [2607:f8b0:400c:c02::230]) by mx.google.com with ESMTPS id p8si10171031vdv.148.2013.06.13.03.56.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:56:49 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::230 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:c02::230; Received: by mail-vb0-f48.google.com with SMTP id w15so4591289vbf.7 for ; Thu, 13 Jun 2013 03:56:49 -0700 (PDT) X-Received: by 10.52.171.80 with SMTP id as16mr73617vdc.90.1371121009615; Thu, 13 Jun 2013 03:56:49 -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 gx3csp16594vec; Thu, 13 Jun 2013 03:56:48 -0700 (PDT) X-Received: by 10.204.58.137 with SMTP id g9mr51753bkh.119.1371121008176; Thu, 13 Jun 2013 03:56:48 -0700 (PDT) Received: from mail-bk0-x22f.google.com (mail-bk0-x22f.google.com [2a00:1450:4008:c01::22f]) by mx.google.com with ESMTPS id pr7si3530055bkb.242.2013.06.13.03.56.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:56:48 -0700 (PDT) Received-SPF: pass (google.com: domain of rric.net@gmail.com designates 2a00:1450:4008:c01::22f as permitted sender) client-ip=2a00:1450:4008:c01::22f; Received: by mail-bk0-f47.google.com with SMTP id jg1so4882010bkc.34 for ; Thu, 13 Jun 2013 03:56:47 -0700 (PDT) X-Received: by 10.205.39.201 with SMTP id tn9mr62345bkb.79.1371121007447; Thu, 13 Jun 2013 03:56:47 -0700 (PDT) Received: from rric.localhost (g224198135.adsl.alicedsl.de. [92.224.198.135]) by mx.google.com with ESMTPSA id j8sm9216909bky.17.2013.06.13.03.56.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:56:46 -0700 (PDT) Resent-From: Robert Richter Resent-Date: Thu, 13 Jun 2013 12:56:43 +0200 Resent-Message-ID: <20130613105643.GB12218@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.51 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 09:42:52 -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, Borislav Petkov , Robert Richter Subject: [PATCH v2 01/14] perf, ring_buffer: Use same prefix Date: Tue, 11 Jun 2013 18:42:27 +0200 Message-Id: <1370968960-22527-2-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: ALoCoQlW/SKPoNTzozQUZahHEMpZ5ATCAw2cCKix1tC6k0aHVbs2zg/kWuRyXCPRwp1xNStY8pqA X-Original-Sender: rric.net@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::230 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: Borislav Petkov Rename ring_buffer-handling functions consistently with the "rb_" prefix. Signed-off-by: Borislav Petkov Signed-off-by: Robert Richter --- kernel/events/core.c | 37 +++++++++++++++++-------------------- kernel/events/ring_buffer.c | 7 +++---- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index a0780b3..b790ab6 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -198,8 +198,7 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx, static void update_context_time(struct perf_event_context *ctx); static u64 perf_event_time(struct perf_event *event); -static void ring_buffer_attach(struct perf_event *event, - struct ring_buffer *rb); +static void rb_attach(struct perf_event *event, struct ring_buffer *rb); void __weak perf_event_print_debug(void) { } @@ -3022,7 +3021,7 @@ static void free_event_rcu(struct rcu_head *head) kfree(event); } -static void ring_buffer_put(struct ring_buffer *rb); +static void rb_put(struct ring_buffer *rb); static void free_event(struct perf_event *event) { @@ -3054,7 +3053,7 @@ static void free_event(struct perf_event *event) } if (event->rb) { - ring_buffer_put(event->rb); + rb_put(event->rb); event->rb = NULL; } @@ -3299,8 +3298,8 @@ static unsigned int perf_poll(struct file *file, poll_table *wait) * t0: T1, rb = rcu_dereference(event->rb) * t1: T2, old_rb = event->rb * t2: T2, event->rb = new rb - * t3: T2, ring_buffer_detach(old_rb) - * t4: T1, ring_buffer_attach(rb1) + * t3: T2, rb_detach(old_rb) + * t4: T1, rb_attach(rb1) * t5: T1, poll_wait(event->waitq) * * To avoid this problem, we grab mmap_mutex in perf_poll() @@ -3312,7 +3311,7 @@ static unsigned int perf_poll(struct file *file, poll_table *wait) rcu_read_lock(); rb = rcu_dereference(event->rb); if (rb) { - ring_buffer_attach(event, rb); + rb_attach(event, rb); events = atomic_xchg(&rb->poll, 0); } rcu_read_unlock(); @@ -3617,8 +3616,7 @@ unlock: return ret; } -static void ring_buffer_attach(struct perf_event *event, - struct ring_buffer *rb) +static void rb_attach(struct perf_event *event, struct ring_buffer *rb) { unsigned long flags; @@ -3634,8 +3632,7 @@ unlock: spin_unlock_irqrestore(&rb->event_lock, flags); } -static void ring_buffer_detach(struct perf_event *event, - struct ring_buffer *rb) +static void rb_detach(struct perf_event *event, struct ring_buffer *rb) { unsigned long flags; @@ -3648,7 +3645,7 @@ static void ring_buffer_detach(struct perf_event *event, spin_unlock_irqrestore(&rb->event_lock, flags); } -static void ring_buffer_wakeup(struct perf_event *event) +static void rb_wakeup(struct perf_event *event) { struct ring_buffer *rb; @@ -3672,7 +3669,7 @@ static void rb_free_rcu(struct rcu_head *rcu_head) rb_free(rb); } -static struct ring_buffer *ring_buffer_get(struct perf_event *event) +static struct ring_buffer *rb_get(struct perf_event *event) { struct ring_buffer *rb; @@ -3687,7 +3684,7 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event) return rb; } -static void ring_buffer_put(struct ring_buffer *rb) +static void rb_put(struct ring_buffer *rb) { struct perf_event *event, *n; unsigned long flags; @@ -3724,10 +3721,10 @@ static void perf_mmap_close(struct vm_area_struct *vma) atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); vma->vm_mm->pinned_vm -= event->mmap_locked; rcu_assign_pointer(event->rb, NULL); - ring_buffer_detach(event, rb); + rb_detach(event, rb); mutex_unlock(&event->mmap_mutex); - ring_buffer_put(rb); + rb_put(rb); free_uid(user); } } @@ -3881,7 +3878,7 @@ static const struct file_operations perf_fops = { void perf_event_wakeup(struct perf_event *event) { - ring_buffer_wakeup(event); + rb_wakeup(event); if (event->pending_kill) { kill_fasync(&event->fasync, SIGIO, event->pending_kill); @@ -6567,7 +6564,7 @@ set: if (output_event) { /* get the rb we want to redirect to */ - rb = ring_buffer_get(output_event); + rb = rb_get(output_event); if (!rb) goto unlock; } @@ -6575,13 +6572,13 @@ set: old_rb = event->rb; rcu_assign_pointer(event->rb, rb); if (old_rb) - ring_buffer_detach(event, old_rb); + rb_detach(event, old_rb); ret = 0; unlock: mutex_unlock(&event->mmap_mutex); if (old_rb) - ring_buffer_put(old_rb); + rb_put(old_rb); out: return ret; } diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index cd55144..b514c56 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -212,8 +212,7 @@ void perf_output_end(struct perf_output_handle *handle) rcu_read_unlock(); } -static void -ring_buffer_init(struct ring_buffer *rb, long watermark, int flags) +static void rb_init(struct ring_buffer *rb, long watermark, int flags) { long max_size = perf_data_size(rb); @@ -290,7 +289,7 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) rb->nr_pages = nr_pages; - ring_buffer_init(rb, watermark, flags); + rb_init(rb, watermark, flags); return rb; @@ -395,7 +394,7 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) rb->page_order = ilog2(nr_pages); rb->nr_pages = !!nr_pages; - ring_buffer_init(rb, watermark, flags); + rb_init(rb, watermark, flags); return rb;