Discussion:
[Cocci] [PATCH] coccinelle: mini_lock: improve performance
Julia Lawall
2018-05-21 06:58:48 UTC
Permalink
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 <***@lip6.fr>

---
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(***@p,...);
-<+... when != E1
+... when != E1
+ when any
if (...) {
... when != E1
* ***@r ...;
}
-...+>
+... when != E1
+ when any
****@up(E1,...);

@script:python depends on org@
Masahiro Yamada
2018-05-22 14:22:45 UTC
Permalink
Post by Julia Lawall
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.
---
Applied to linux-kbuild. Thanks!
Post 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;
@@
-<+... when != E1
+... when != E1
+ when any
if (...) {
... when != E1
}
-...+>
+... when != E1
+ when any
@script:python depends on org@
--
Best Regards
Masahiro Yamada
Loading...