This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
task_finder holding 'mmap_sem' too long
- From: David Smith <dsmith at redhat dot com>
- To: Jim Keniston <jkenisto at us dot ibm dot com>
- Cc: ananth at in dot ibm dot com, William Cohen <wcohen at redhat dot com>, Roland McGrath <roland at redhat dot com>, systemtap <systemtap at sources dot redhat dot com>
- Date: Mon, 01 Jun 2009 12:48:50 -0500
- Subject: task_finder holding 'mmap_sem' too long
- References: <4A15A354.4050000@redhat.com> <20090522094036.GD5562@in.ibm.com> <20090523015651.D7354FC35D@magilla.sf.frob.com> <20090525104509.GA19797@in.ibm.com> <4A1BE332.8070302@redhat.com> <1243357331.3570.25.camel@dyn9047018094.beaverton.ibm.com>
>> On Tue, 2009-05-26 at 07:40 -0500, David Smith wrote:
>> Hmm. Looking back through the task_finder code, I believe the mmap_sem
>> is being held so that the vma list doesn't get deleted from underneath
>> the task_finder. However, I'm not sure that can really happen in the
>> cases where it is done. It might be possible that calling
>> 'get_task_mm()' would be enough here.
>>
>> It looks like the task_finder runs callbacks with mmap_sem held in 2 places:
>>
>> 1) When initially attaching to a "interesting" thread, it gets stopped.
>> In the quiesce handler, the mmap callbacks are run for vma's that
>> existed before task_finder attached to it. (This is only done for the
>> thread group leader.) The entire vma list is processed in this matter.
>>
>> 2) At syscall exit, if the call is mmap or mmap2, the callbacks are
>> called on the new vma. In this case it would be possible to hold
>> mmap_sem, get the information needed out of the new vma, release
>> mmap_sem, then call the callbacks.
After a bit of work, I've fixed these 2 issues (the fixes are in commits
9b59029 and bec8cf6 for the curious). The task_finder no longer holds
the mmap_sem while making callbacks.
In case 1), the new code grabs the mmap_sem, caches information about
each vma, releases the mmap_sem, then makes the callbacks.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)