Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp7332508imm; Mon, 21 May 2018 00:31:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpL4Ha5oJDNGhejK9crVdbM0NqxY95XFYuRpcYzYNWpVskjg21fNXEYdp6otw3V3TeGKYVO X-Received: by 2002:a62:ed12:: with SMTP id u18-v6mr19127156pfh.127.1526887866928; Mon, 21 May 2018 00:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526887866; cv=none; d=google.com; s=arc-20160816; b=g6sDyILQfEKBISIsiiG3D+u7uSFtfrbhkmp+WICUj4giFoWDq/aJiPeSzzgBQcYXQB gt43K2BrJnlTPnPJ2UZFqXwZCACvpMcLXmFOgEYmSBZYdSR0yaj1t/C/K6noD0bj+uWH jDWY66CGzhZ2ol3ORnrCOkUZ1OiTXAOhDlvvdy48Y/YESkjPogfrikFZtBMNHsh+I+EX vuXnmT86dRLAxKuSArXqy0pKLUiL2hIAntHh/2dksrymePw14KuDMN7BXPuDbBEtQtnC xl5Uf3rsSH+6DkUMh6sUoANZ6z0rlpiqy5B3OUboGJevE/01XgPR5nLfA9o6WVnptR3d xUlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9yrIdLSBGSBhzPjx8dpt1nYto7LkTsjT+KWAiJ62j/s=; b=BSlHpc6T3IS5b+j3yJqTy4FrUqfA8jdjtGpH0pU8h1LOZzQeAiSfsm/Kn5I8QpDHD5 22OySXucgD8zWr799rnMa95/Pkkmj6jn0FQZA4xdslNPOtAvU9DMgJA3+d0spC1e8vMG +lvH++wwWF5pUunDmSTzacRDsjHFg0iBUuvx6Y6FVvnL6748iMNSUlTwvCUFmpIx8Vzw f7VPt+6Kpvrn6X8WjEdt7ZeTpqgglhDXEGCkodMdaQs95PfpA6B8/yyxVm/kOur7fxS3 PR5ctJsHcqM2garXy8G2z0wXvwvtOJ8OXNGY6BgLM+5eLlpEHcKmpQ7swk1GD8exTtqJ 5COA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8-v6si13487944plo.306.2018.05.21.00.30.51; Mon, 21 May 2018 00:31:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751103AbeEUHab (ORCPT + 99 others); Mon, 21 May 2018 03:30:31 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:29390 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750867AbeEUHaa (ORCPT ); Mon, 21 May 2018 03:30:30 -0400 X-IronPort-AV: E=Sophos;i="5.49,426,1520895600"; d="scan'208";a="265862140" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 21 May 2018 09:30:28 +0200 From: Julia Lawall To: Masahiro Yamada Cc: kernel-janitors@vger.kernel.org, Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: [PATCH] coccinelle: mini_lock: improve performance Date: Mon, 21 May 2018 08:58:48 +0200 Message-Id: <1526885928-1712-1-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace <+... ...+> by ... when any. <+... ...+> is slow, and in some obscure cases involving backward jumps it doesn't force the unlock to actually come after the end of the if. Signed-off-by: Julia Lawall --- scripts/coccinelle/locks/mini_lock.cocci | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/coccinelle/locks/mini_lock.cocci b/scripts/coccinelle/locks/mini_lock.cocci index 47f649b..19c6ee5 100644 --- a/scripts/coccinelle/locks/mini_lock.cocci +++ b/scripts/coccinelle/locks/mini_lock.cocci @@ -67,12 +67,14 @@ identifier lock,unlock; @@ *lock(E1@p,...); -<+... when != E1 +... when != E1 + when any if (...) { ... when != E1 * return@r ...; } -...+> +... when != E1 + when any *unlock@up(E1,...); @script:python depends on org@