aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2018-05-21 02:58:48 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-05-22 10:00:23 -0400
commit32d0572a75c81a2c70394f9e110ca080b9a733b1 (patch)
treee6355b35da23d5818cac3691463a9d32c04d00b4
parent4c1d9bb0b5d3c0b3468ac8e68a05972eb957630f (diff)
coccinelle: mini_lock: improve performance
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 <Julia.Lawall@lip6.fr> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--scripts/coccinelle/locks/mini_lock.cocci6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/coccinelle/locks/mini_lock.cocci b/scripts/coccinelle/locks/mini_lock.cocci
index 47f649b0ea87..19c6ee5b986b 100644
--- a/scripts/coccinelle/locks/mini_lock.cocci
+++ b/scripts/coccinelle/locks/mini_lock.cocci
@@ -67,12 +67,14 @@ identifier lock,unlock;
67@@ 67@@
68 68
69*lock(E1@p,...); 69*lock(E1@p,...);
70<+... when != E1 70... when != E1
71 when any
71if (...) { 72if (...) {
72 ... when != E1 73 ... when != E1
73* return@r ...; 74* return@r ...;
74} 75}
75...+> 76... when != E1
77 when any
76*unlock@up(E1,...); 78*unlock@up(E1,...);
77 79
78@script:python depends on org@ 80@script:python depends on org@