task_finder holding 'mmap_sem' too long
David Smith
dsmith@redhat.com
Mon Jun 1 17:49:00 GMT 2009
>> 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)
More information about the Systemtap
mailing list