Messages in this thread | | | From | Denis Efremov <> | Subject | Re: [Cocci] [PATCH] coccinelle: api: add kvfree script | Date | Sat, 6 Jun 2020 00:15:03 +0300 |
| |
On 6/5/20 11:51 PM, Julia Lawall wrote: > Is there a strong reason for putting the choice rule first? It may make > things somewhat slower than necessary, if it matches in many places, > because the opportunity rule will have to detect that it doesn't care > about all of those places.
No, I didn't know that order of rules matters. I just checked it, my PC shows no difference in exec time if I swap these rules.
"choice" doesn't check the size. "opportunity" is more strict. The motivation for adding 2 rules is that we could recommend to use kvmalloc* only when there is a size condition. At the same time, we should skip all if (...) {kmalloc()} else {vmalloc()}, res = kmalloc() if (!res) {vmalloc()} cases as false positives.
It seems that it's not possible to use subexpression rule "expression size <= choice.E" in this case.
> Also, there is no need to exceed 80 characters here. You can put a > newline in the middle of a \( ... \)
Ok, I will fix it in v2 after all comments/suggestions.
Thanks, Denis
| |