Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753356AbZDMU2U (ORCPT ); Mon, 13 Apr 2009 16:28:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751084AbZDMU2J (ORCPT ); Mon, 13 Apr 2009 16:28:09 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:42014 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935AbZDMU2I (ORCPT ); Mon, 13 Apr 2009 16:28:08 -0400 Date: Mon, 13 Apr 2009 13:19:50 -0700 (PDT) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: Ying Han cc: linux-mm@kvack.org, linux-kernel , akpm , Ingo Molnar , Mike Waychison , Rohit Seth , Hugh Dickins , Peter Zijlstra , "H. Peter Anvin" , =?ISO-8859-15?Q?T=F6r=F6k_Edwin?= , Lee Schermerhorn , Nick Piggin , Wu Fengguang Subject: Re: [V4][PATCH 0/4]page fault retry with NOPAGE_RETRY In-Reply-To: Message-ID: References: <604427e00904131244y68fa7e62x85d599f588776eee@mail.gmail.com> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1312 Lines: 40 On Mon, 13 Apr 2009, Linus Torvalds wrote: > > Well, have you tried the obvious optimization of _not_ doing the RETRY > path when atomic_read(&mm->counter) == 1? > > After all, if it's not a threaded app, and it doesn't have a possibility > of concurrent mmap/fault, then why release the lock? Ok, so the counter is called 'mm_users', not 'counter'. Anyway, I would try that in the arch patch, and just see what happens when you change the unsigned int fault_flags = FAULT_FLAG_RETRY; into unsigned int fault_flags; .. fault_flags = atomic_read(&mm->mm_users) > 1 ? FAULT_FLAG_RETRY : 0; where you should probably do that mm dereference only after checking that you're not in atomic context or something like that (so move the assignment down). The reason I'd suggest doing it in the caller of handle_mm_fault() rather than anywhere deeper in the call chain is that some callers _might_ really want to get the retry semantics even if they are the only ones. Imagine, for example, some kind of non-blocking "get_user_pages()" thing. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/