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
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;