]> git.karo-electronics.de Git - karo-tx-linux.git/commit
oprofile: reduce mmap_sem hold for mm->exe_file
authorDavidlohr Bueso <dave@stgolabs.net>
Tue, 7 Apr 2015 23:57:05 +0000 (09:57 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 9 Apr 2015 09:07:11 +0000 (19:07 +1000)
commit6bd50e063abbe6f5eabcf564d376767689c18cd9
treee6f178a4cd6c702414f39a3e52a22393576302eb
parent727daad149b55841d8e9518a6dc7674a335d7baa
oprofile: reduce mmap_sem hold for mm->exe_file

sync_buffer() needs the mmap_sem for two distinct operations, both only
occurring upon user context switch handling:

 1) Dealing with the exe_file.

 2) Adding the dcookie data as we need to lookup the vma that
   backs it. This is done via add_sample() and add_data().

This patch isolates 1), for it will no longer need the mmap_sem for
serialization.  However, for now, make of the more standard
get_mm_exe_file(), requiring only holding the mmap_sem to read the value,
and relying on reference counting to make sure that the exe file won't
dissappear underneath us while doing the get dcookie.

As a consequence, for 2) we move the mmap_sem locking into where we really
need it, in lookup_dcookie().  The benefits are twofold: reduce mmap_sem
hold times, and cleaner code.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Robert Richter <rric@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/oprofile/buffer_sync.c