]> sourceware.org Git - systemtap.git/commitdiff
Remove the possibililty of sleeping from __stp_call_mmap_callbacks_*().
authorDavid Smith <dsmith@redhat.com>
Fri, 9 Dec 2011 19:43:17 +0000 (13:43 -0600)
committerDavid Smith <dsmith@redhat.com>
Fri, 9 Dec 2011 19:43:17 +0000 (13:43 -0600)
* runtime/task_finder2.c (__stp_call_mmap_callbacks_with_addr): Change
  down_read() to down_read_trylock() instead, which won't sleep.
  (__stp_call_mmap_callbacks_for_task): Ditto.

runtime/task_finder2.c

index 6bf6c010f76d0724a598663399ff4097aa40a8e8..09280a2d5a1ec823cd963ce27efb75f664b016ac 100644 (file)
@@ -614,7 +614,10 @@ __stp_call_mmap_callbacks_with_addr(struct stap_task_finder_target *tgt,
        if (! mm)
                return;
 
-       down_read(&mm->mmap_sem);
+       // The down_read() function can sleep, so we'll call
+       // down_read_trylock() instead, which can fail.
+       if (! down_read_trylock(&mm->mmap_sem))
+               return;
        vma = __stp_find_file_based_vma(mm, addr);
        if (vma) {
                // Cache information we need from the vma
@@ -1033,7 +1036,12 @@ __stp_call_mmap_callbacks_for_task(struct stap_task_finder_target *tgt,
                return;
        }
 
-       down_read(&mm->mmap_sem);
+       // The down_read() function can sleep, so we'll call
+       // down_read_trylock() instead, which can fail.
+       if (! down_read_trylock(&mm->mmap_sem)) {
+               _stp_kfree(mmpath_buf);
+               return;
+       }
 
        // First find the number of file-based vmas.
        vma = mm->mmap;
This page took 0.028521 seconds and 5 git commands to generate.