From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751874Ab3LJVYQ (ORCPT ); Tue, 10 Dec 2013 16:24:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60655 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000Ab3LJVYM (ORCPT ); Tue, 10 Dec 2013 16:24:12 -0500 Date: Tue, 10 Dec 2013 22:24:09 +0100 From: Oleg Nesterov To: Linus Torvalds Cc: "H. Peter Anvin" , Ananth N Mavinakayanahalli , Andi Kleen , Borislav Petkov , Hugh Dickins , Ingo Molnar , Jiri Kosina , Peter Zijlstra , Srikar Dronamraju , Linux Kernel Mailing List Subject: Re: [PATCH 0/1] uprobes: Kill __replace_page(), change uprobe_write_opcode() to rely on gup(WRITE) Message-ID: <20131210212409.GA3179@redhat.com> References: <20131209211824.GA15006@redhat.com> <20131210191837.GA30680@redhat.com> <20131210200426.GA31862@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/10, Linus Torvalds wrote: > > On Tue, Dec 10, 2013 at 12:04 PM, Oleg Nesterov wrote: > >> We'd be *much* better off using get_user_pages_fast() if possible - > >> and I bet _is_ possible in 99% of all cases. > > > > We can't. get_user_pages_fast() takes mmap_sem. > > Yeah, and we need to look up the page table entry anyway, so what we > actually want here is just the page table walker, Yes, this is clear. And damn, somehow I forgot that _fast() can (obviously) only use current->mm. > none of the "get > page" crap at all. > > So the core function should (I think) just do something like: I'll try to think, but this is what I actually tried to avoid. I mean, > Put another way: I actually think the existing "__replace_page()" code > is closer to being good than that disgusting uprobe_write_opcode() > function. I think you may be getting rid of the wrong ugly function. And perhaps you are right. But my only motivation was: rely on gup() to simplify this code. Yes, gup() is slow, but it works and we can avoid the "nontrivial" things like page_remove_rmap/munlock_vma_page. If we want to optimize this code, then this patch obviously goes to the wrong direction, I agree. Oleg.