From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258Ab3AGOgt (ORCPT ); Mon, 7 Jan 2013 09:36:49 -0500 Received: from cantor2.suse.de ([195.135.220.15]:36997 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009Ab3AGOgr (ORCPT ); Mon, 7 Jan 2013 09:36:47 -0500 Date: Mon, 7 Jan 2013 14:36:43 +0000 From: Mel Gorman To: Hugh Dickins Cc: Zhouping Liu , Alexander Beregalov , Hillf Danton , Alex Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ingo Molnar , Johannes Weiner , Michel Lespinasse , Rik van Riel , Andrea Arcangeli Subject: Re: [PATCH] mm: thp: Acquire the anon_vma rwsem for lock during split Message-ID: <20130107143643.GG3885@suse.de> References: <1621091901.34838094.1356409676820.JavaMail.root@redhat.com> <535932623.34838584.1356410331076.JavaMail.root@redhat.com> <20130103175737.GA3885@suse.de> <20130104140815.GA26005@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 04, 2013 at 01:28:09PM -0800, Hugh Dickins wrote: > I've added Alexander, Hillf and Alex to the Cc. > > On Fri, 4 Jan 2013, Mel Gorman wrote: > > Zhouping, please test this patch. > > > > Andrea and Hugh, any comments on whether this could be improved? > > Your patch itself looks just right to me, no improvement required; > and it's easy to understand how the bug crept in, from a blanket > rwsem replacement of anon_vma mutex meeting the harmless-looking > anon_vma_interval_tree_foreach in __split_huge_page, which looked > as if it needed only the readlock provided by the usual method. > Indeed. Thanks Hugh for taking a look over it. > But I'd fight shy myself of trying to describe all the THP locking > conventions in the commit message: I haven't really tried to work > out just how right you've got all those details. > I thought it was risky myself but it was the best way of getting Andrea to object if I missed some subtlety! If I had infinite time I would follow up with a patch to Documentation/vm/transhuge.txt explaining how the anon_vma lock is used by THP. > The actual race in question here was just two processes (one or both > forked) doing split_huge_page() on the same THPage at the same time, > wasn't it? (Though of course we only see the backtrace from one of > them.) Which would be very confusing, and no surprise that the > pmd_trans_splitting test ends up skipping pmds already updated by > the racing process, so the mapcount doesn't match what's expected. > Of course we need exclusive lock against that, which you give it. > Ok, thanks. Will resend to Andrew with some changelog edits. -- Mel Gorman SUSE Labs