From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail138.messagelabs.com (mail138.messagelabs.com [216.82.249.35]) by kanga.kvack.org (Postfix) with ESMTP id C98916B006E for ; Mon, 28 Nov 2011 10:30:19 -0500 (EST) Message-ID: <1322494194.2921.147.camel@twins> Subject: Re: [PATCH v7 3.2-rc2 3/30] uprobes: register/unregister probes. From: Peter Zijlstra Date: Mon, 28 Nov 2011 16:29:54 +0100 In-Reply-To: <20111118110713.10512.9461.sendpatchset@srdronam.in.ibm.com> References: <20111118110631.10512.73274.sendpatchset@srdronam.in.ibm.com> <20111118110713.10512.9461.sendpatchset@srdronam.in.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 Sender: owner-linux-mm@kvack.org List-ID: To: Srikar Dronamraju Cc: Linus Torvalds , Oleg Nesterov , Andrew Morton , LKML , Linux-mm , Ingo Molnar , Andi Kleen , Christoph Hellwig , Steven Rostedt , Roland McGrath , Thomas Gleixner , Masami Hiramatsu , Arnaldo Carvalho de Melo , Anton Arapov , Ananth N Mavinakayanahalli , Jim Keniston , Stephen Wilson On Fri, 2011-11-18 at 16:37 +0530, Srikar Dronamraju wrote: > +static void __unregister_uprobe(struct inode *inode, loff_t offset, > + struct uprobe *uprobe) > +{ > + struct list_head try_list; > + struct address_space *mapping; > + struct vma_info *vi, *tmpvi; > + struct vm_area_struct *vma; > + struct mm_struct *mm; > + loff_t vaddr; > + > + mapping =3D inode->i_mapping; > + INIT_LIST_HEAD(&try_list); > + while ((vi =3D find_next_vma_info(&try_list, offset, > + mapping, false)) !=3D NUL= L) { > + if (IS_ERR(vi)) > + break; So what kind of half-assed state are we left in if we try an unregister under memory pressure and how do we deal with that? > + mm =3D vi->mm; > + down_read(&mm->mmap_sem); > + vma =3D find_vma(mm, (unsigned long)vi->vaddr); > + if (!vma || !valid_vma(vma, false)) { > + list_del(&vi->probe_list); > + kfree(vi); > + up_read(&mm->mmap_sem); > + mmput(mm); > + continue; > + } > + vaddr =3D vma->vm_start + offset; > + vaddr -=3D vma->vm_pgoff << PAGE_SHIFT; > + if (vma->vm_file->f_mapping->host !=3D inode || > + vaddr !=3D vi->vaddr) { > + list_del(&vi->probe_list); > + kfree(vi); > + up_read(&mm->mmap_sem); > + mmput(mm); > + continue; > + } > + remove_breakpoint(mm); > + up_read(&mm->mmap_sem); > + mmput(mm); > + } > + > + list_for_each_entry_safe(vi, tmpvi, &try_list, probe_list) { > + list_del(&vi->probe_list); > + kfree(vi); > + } > + delete_uprobe(uprobe); > +}=20 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org