From patchwork Tue Jun 11 16:42:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 17897 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7026925DF1 for ; Thu, 13 Jun 2013 10:57:20 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id bv4sf1793879qab.2 for ; Thu, 13 Jun 2013 03:57:20 -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=Rzm0EENiORUZhNx4BUSZeKpskx14EiDrD1Y0h8f2iew=; b=w1/PKmDGdAkJ+R52WYASaJj1T1htkeOhq01Q0jomY6vGndAzprE6w9oOMaXRlCW9BO Mr9JVDh8IEqSENvCFMQZMCoyItjVzw+rMzNQxWvu5utlLgs+D7rb86j58JF0QTTdtO6C UwW6UXDzRIAV6uaQ2G3mn8cuHIxD6CJZImdsl8/KwIuj1WvWz2Dc3y2zPMzonjyLKldS tlJyrNQwUqzjfdIFUj4ARZ8xY1sj2WIfxTZ8u/pChrxizLSWfrq4dBOn1QDGWhIQDmIE mAhhIGqSptpnZOgED6TGDqIkgpZS31oDS29ZW/PO+V6vEflBJO8+fze5atV+lNUayZPh Dlzw== 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=Rzm0EENiORUZhNx4BUSZeKpskx14EiDrD1Y0h8f2iew=; b=ZYKMqQEWH6i8uoKymXzz7mGBuHdzp2kqzesuVSDN5LRyVFTrHL4dne01PVCb2JY5Dw 11w3VlN7xEbIy/maOtR+zrPNpENvLRPZmYLaeuC1YQMPdyrkqb39P8rAFRIzWCZ3dklJ zQjqxv7y45HhFwL4KMWLCN+RqMdfFTtNiplCKx8Q+w2IIP3Jd2UKki2ivOijdD1bnzcz oWvtU0yFQXhlFZEn9idg54Ry0OIucGp5O8lVlQahDBsIqcedMjMFDWj2DLrffLyDscZq 80gaiMacqD60q0NHgrBClgR3uAAD5KnqAcyJ/s7Nwc+zwTcmjKoY/3aRKqAXq7nL1e4h VsLQ== X-Received: by 10.224.59.205 with SMTP id m13mr1298461qah.7.1371121040284; Thu, 13 Jun 2013 03:57:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.131 with SMTP id x3ls1810742qec.76.gmail; Thu, 13 Jun 2013 03:57:20 -0700 (PDT) X-Received: by 10.52.17.203 with SMTP id q11mr60085vdd.120.1371121040145; Thu, 13 Jun 2013 03:57:20 -0700 (PDT) Received: from mail-ve0-x22f.google.com (mail-ve0-x22f.google.com [2607:f8b0:400c:c01::22f]) by mx.google.com with ESMTPS id di3si10207182vcb.5.2013.06.13.03.57.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:57:20 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22f 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::22f; Received: by mail-ve0-f175.google.com with SMTP id da11so7600161veb.34 for ; Thu, 13 Jun 2013 03:57:20 -0700 (PDT) X-Received: by 10.52.171.80 with SMTP id as16mr74099vdc.90.1371121039931; Thu, 13 Jun 2013 03:57:19 -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 gx3csp16617vec; Thu, 13 Jun 2013 03:57:19 -0700 (PDT) X-Received: by 10.205.23.200 with SMTP id rb8mr63522bkb.73.1371121038806; Thu, 13 Jun 2013 03:57:18 -0700 (PDT) Received: from mail-bk0-x234.google.com (mail-bk0-x234.google.com [2a00:1450:4008:c01::234]) by mx.google.com with ESMTPS id qe7si2622319bkb.134.2013.06.13.03.57.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of rric.net@gmail.com designates 2a00:1450:4008:c01::234 as permitted sender) client-ip=2a00:1450:4008:c01::234; Received: by mail-bk0-f52.google.com with SMTP id d7so4697370bkh.25 for ; Thu, 13 Jun 2013 03:57:18 -0700 (PDT) X-Received: by 10.204.225.209 with SMTP id it17mr76219bkb.17.1371121038244; Thu, 13 Jun 2013 03:57:18 -0700 (PDT) Received: from rric.localhost (g224198135.adsl.alicedsl.de. [92.224.198.135]) by mx.google.com with ESMTPSA id i15sm9174909bkz.12.2013.06.13.03.57.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 03:57:17 -0700 (PDT) Resent-From: Robert Richter Resent-Date: Thu, 13 Jun 2013 12:57:14 +0200 Resent-Message-ID: <20130613105714.GK12218@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.43.04 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 09:43:05 -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 10/14] perf, persistent: Avoid adding identical events Date: Tue, 11 Jun 2013 18:42:36 +0200 Message-Id: <1370968960-22527-11-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: ALoCoQm94cHJNWwedv8CqE7E88knlJQTu13oKTobWX0b+keL9YNy2NyZrAx4pi4LVeqb0mmGXEdw X-Original-Sender: rric.net@gmail.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22f 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 Check if an event already exists before adding it. Signed-off-by: Robert Richter Signed-off-by: Robert Richter --- kernel/events/persistent.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/events/persistent.c b/kernel/events/persistent.c index 586cea5..4fcd071 100644 --- a/kernel/events/persistent.c +++ b/kernel/events/persistent.c @@ -40,6 +40,12 @@ add_persistent_event_on_cpu(unsigned int cpu, struct perf_event_attr *attr, mutex_lock(&per_cpu(pers_events_lock, cpu)); + desc = get_persistent_event(cpu, attr); + if (desc) { + event = ERR_PTR(-EEXIST); + goto out; + } + desc = kzalloc(sizeof(*desc), GFP_KERNEL); if (!desc) { event = ERR_PTR(-ENOMEM);