Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751444Ab0AGUHx (ORCPT ); Thu, 7 Jan 2010 15:07:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750996Ab0AGUHw (ORCPT ); Thu, 7 Jan 2010 15:07:52 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:39393 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750887Ab0AGUHv (ORCPT ); Thu, 7 Jan 2010 15:07:51 -0500 Date: Thu, 7 Jan 2010 12:06:48 -0800 (PST) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: "Paul E. McKenney" cc: Peter Zijlstra , Christoph Lameter , Arjan van de Ven , KAMEZAWA Hiroyuki , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "minchan.kim@gmail.com" , "hugh.dickins" , Nick Piggin , Ingo Molnar Subject: Re: [RFC][PATCH 6/8] mm: handle_speculative_fault() In-Reply-To: <20100107192035.GO6764@linux.vnet.ibm.com> Message-ID: References: <20100104182813.753545361@chello.nl> <20100105054536.44bf8002@infradead.org> <20100105192243.1d6b2213@infradead.org> <1262884960.4049.106.camel@laptop> <20100107192035.GO6764@linux.vnet.ibm.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: 1172 Lines: 37 On Thu, 7 Jan 2010, Paul E. McKenney wrote: > > + > > + spin_lock(&mm->page_table_lock); > > + if (vma->vm_end == cur_brk) { > > + vma->vm_end = brk; > > + mm->brk = brk; > > + cur_brk = brk; > > + } > > + spin_unlock(&mm->page_table_lock); > > + > > + if (cur_brk != brk) > > Can this be "if (cur_brk < brk)"? Seems like it should, given the > earlier tests, but I don't claim to understand the VM code. It's really just a flag, to test whether the final check (inside the spinlock) succeeded, or whether we perhaps raced with _another_ brk() call that also had the mm_sem for reading. We know that cur_brk was different from brk before - because otherwise we'd have just returned early (or done the slow case). So testing whether it's different afterwards really only tests whether that cur_brk = brk; statment was executed or not. I could have used a separate flag called "success" or something. 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/