From: Maxime Ripard <maxime@cerno.tech>
To: cocci@systeme.lip6.fr
Subject: [Cocci] Performance issue with quite simple patch?
Date: Wed, 13 Jan 2021 10:48:39 +0100 [thread overview]
Message-ID: <20210113094839.n5uym2ymhhnykzzt@gilmour> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1088 bytes --]
Hi!
I've been trying to get a patch to rename any variable called "state" in
a given set of callbacks.
This is the patch that I've come up with:
@ plane_atomic_func @
identifier helpers;
identifier func;
@@
(
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_check = func,
...,
};
|
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_disable = func,
...,
};
|
static const struct drm_plane_helper_funcs helpers = {
...,
.atomic_update = func,
...,
};
)
@@
identifier plane_atomic_func.func;
symbol state;
expression e;
type T;
@@
func(...)
{
...
- T state = e;
+ T plane_state = e;
<+...
- state
+ plane_state
...+>
}
However, it seems like at least on a file (in Linux,
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c), it takes quite big
performance hit with one CPU running at 100% until the timeout is hit.
Replacing <+... by ... makes it work instantly, but doesn't really do
what I'm expecting, so I guess it's a matter of the patch being
subobtimal?
Is there a more optimal way of doing it?
Thanks!
Maxime
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next reply other threads:[~2021-01-13 9:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-13 9:48 Maxime Ripard [this message]
2021-01-13 10:58 ` [Cocci] Performance issue with quite simple patch? Julia Lawall
2021-01-14 13:24 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210113094839.n5uym2ymhhnykzzt@gilmour \
--to=maxime@cerno.tech \
--cc=cocci@systeme.lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).