public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: David Smith <dsmith@redhat.com>
To: Jim Keniston <jkenisto@us.ibm.com>
Cc: ananth@in.ibm.com, William Cohen <wcohen@redhat.com>,
	        Roland McGrath <roland@redhat.com>,
	        systemtap <systemtap@sources.redhat.com>
Subject: task_finder holding 'mmap_sem' too long
Date: Mon, 01 Jun 2009 17:49:00 -0000	[thread overview]
Message-ID: <4A241482.3000007@redhat.com> (raw)
In-Reply-To: <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)

      reply	other threads:[~2009-06-01 17:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4A15A354.4050000@redhat.com>
     [not found] ` <20090522094036.GD5562@in.ibm.com>
     [not found]   ` <20090523015651.D7354FC35D@magilla.sf.frob.com>
     [not found]     ` <20090525104509.GA19797@in.ibm.com>
     [not found]       ` <4A1BE332.8070302@redhat.com>
2009-05-26 19:06         ` 20090521 systemtap meeting notes Jim Keniston
2009-06-01 17:49           ` David Smith [this message]

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=4A241482.3000007@redhat.com \
    --to=dsmith@redhat.com \
    --cc=ananth@in.ibm.com \
    --cc=jkenisto@us.ibm.com \
    --cc=roland@redhat.com \
    --cc=systemtap@sources.redhat.com \
    --cc=wcohen@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).