From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752515Ab0H0XGM (ORCPT ); Fri, 27 Aug 2010 19:06:12 -0400 Received: from smtp110.prem.mail.ac4.yahoo.com ([76.13.13.93]:39318 "HELO smtp110.prem.mail.ac4.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751819Ab0H0XGL (ORCPT ); Fri, 27 Aug 2010 19:06:11 -0400 X-Yahoo-SMTP: _Dag8S.swBC1p4FJKLCXbs8NQzyse1SYSgnAbY0- X-YMail-OSG: mKXUFPkVM1mSwv_l7Ul3fLSkc8OUcDbznIee6c_MjpCG7g5 _8GsyhgJjGBGQMZWTMfz6ycnq04Xd2jRQaqpcZVvnhP5xh37g9H4K4nG68Tv iCpPXixoJact8UJLwmT61EDtpJEki30xAZcXJk9NLZkc4vzDtQdJza3C8UDv l9kqpb6ieJLkZGJEsyYUMOyhLR7mM9X8TqSJHgqJhNABiDFL2vNH.c9MezCk SsHfKUIcj8P4jOgeGfk.HbAW4j2R_ X-Yahoo-Newman-Property: ymail-3 Date: Fri, 27 Aug 2010 18:06:07 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@router.home To: Hugh Dickins cc: Andrea Arcangeli , Linus Torvalds , Andrew Morton , Rik van Riel , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm: fix hang on anon_vma->root->lock In-Reply-To: Message-ID: References: <20100826235052.GZ6803@random.random> <20100827095546.GC6803@random.random> User-Agent: Alpine 2.00 (DEB 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 On Fri, 27 Aug 2010, Hugh Dickins wrote: > >> I do not see a second check (*after* taking the lock) in the patch > > if (page_mapped(page)) > return anon_vma; As far as I can tell you would have to recheck the mapping pointer and the pointer to the root too after taking the lock because only taking the lock stabilitzes the object. Any other data you may have obtained before acquiring the lock may have changed. > >> and the way the lock is taken can be a problem in itself. > > No, that's what we rely upon SLAB_DESTROY_BY_RCU for. SLAB_DESTROY_BY_RCU does not guarantee that the object stays the same nor does it prevent any fields from changing. Going through a pointer with only SLAB_DESTROY_BY_RCU means that you can only rely on the atomicity guarantee for pointer updates. You get a valid pointer but pointer changes are not prevented by SLAB_DESTROY_BY_RCU. The only guarantee of that would be through other synchronization techniques. If you believe that the page lock provides sufficient synchronization that then this approach may be ok.