All of lore.kernel.org
 help / color / mirror / Atom feed
From: linux@rasmusvillemoes.dk (Rasmus Villemoes)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Some spatch questions
Date: Tue, 03 Feb 2015 17:52:22 +0100	[thread overview]
Message-ID: <87a90vhr95.fsf@rasmusvillemoes.dk> (raw)

Hi Julia et al

As you may have seen, I've put a bunch of coccinelle scripts on github
(https://github.com/Villemoes/linux-cocci); I still have some more I
want to clean up before making them public.

Now, I'm having some trouble with some of these. For the sake of
threading [and because this turned out to be rather long], I'll try to
just post one question per thread.

The first is a performance problem. I wrote a perl script pcoc
(pronounced 'peacock', found in the root of the repository) to overcome
a few problems with the 'make coccicheck' approach:

(1) I've often seen garbled output, since nothing coordinates the access
to stdout between the spatch instances. That's especially annoying when
it took several minutes to complete.
(2) The output is not neatly sorted by subsystem, so running 'git apply
--stat' can't be used to get an overview of where there's most to gain.
(3) It's not easily applicable for projects other than the kernel.
(4) I grew tired of typing "make coccicheck COCCI=/some/file.cocci MODE=patch
M=sub/system/"; bash completion couldn't help with most of this. I
wanted to be able to just say 'pcoc /some/file.cocci sub/system/'.

As such, it works perfectly. But I've noticed something slightly
odd: The time required sometimes scales almost linearly with the number
of files each spatch instance is given; also, the memory use as seen in
top goes through the roof. If anything, I would expect the total time to
go down if each instance handles more files (since the semantic patch
would need to be parsed fewer times).

For example, running

  pcoc ~/projects/linux-cocci/wtf/ifelse.cocci --mode=context fs/ --popt '-L 100'

takes 55 seconds on my 8-core machine (with total time being 5m15.900s),
while

  pcoc ~/projects/linux-cocci/wtf/ifelse.cocci --mode=context fs/ --popt '-L 50'

takes 34 seconds (total time 3m51.802s).

In the former case, I see one of the spatch instances reach over 1G of
memory before finishing. When I do the equivalent

  make coccicheck COCCI=~/projects/linux-cocci/wtf/ifelse.cocci MODE=context M=fs/

it finishes in 28 seconds (2m32.598s total user time), and no spatch
instance uses more than 200 M of memory.

The only thing I can imagine would explain this is that when one passes
files explicitly on the command line, there is some ever-growing data
structure which is repeatedly traversed. Is this is a bug in spatch or
in my use of the tool? Is there a work-around?

Best,
Rasmus

             reply	other threads:[~2015-02-03 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 16:52 Rasmus Villemoes [this message]
2015-02-03 16:55 ` [Cocci] Some spatch questions Julia Lawall
2015-02-03 18:59 ` Julia Lawall
2015-02-03 21:50   ` Rasmus Villemoes
2015-02-03 21:57     ` Julia Lawall

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=87a90vhr95.fsf@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.