Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992489Ab2JYRYG (ORCPT ); Thu, 25 Oct 2012 13:24:06 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:46078 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935912Ab2JYRYD (ORCPT ); Thu, 25 Oct 2012 13:24:03 -0400 Message-ID: <508975A4.50203@gmail.com> Date: Thu, 25 Oct 2012 13:23:48 -0400 From: Sasha Levin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121024 Thunderbird/16.0.1 MIME-Version: 1.0 To: Peter Zijlstra CC: David Rientjes , Mel Gorman , Rik van Riel , Dave Jones , Andrew Morton , Linus Torvalds , KOSAKI Motohiro , bhutchings@solarflare.com, Konstantin Khlebnikov , Naoya Horiguchi , Hugh Dickins , KAMEZAWA Hiroyuki , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch for-3.7] mm, mempolicy: fix printing stack contents in numa_maps References: <20121008150949.GA15130@redhat.com> <20121017040515.GA13505@redhat.com> <1351167554.23337.14.camel@twins> <1351175972.12171.14.camel@twins> In-Reply-To: <1351175972.12171.14.camel@twins> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1981 Lines: 52 On 10/25/2012 10:39 AM, Peter Zijlstra wrote: > On Thu, 2012-10-25 at 14:19 +0200, Peter Zijlstra wrote: >> On Wed, 2012-10-24 at 17:08 -0700, David Rientjes wrote: >>> Ok, this looks the same but it's actually a different issue: >>> mpol_misplaced(), which now only exists in linux-next and not in 3.7-rc2, >>> calls get_vma_policy() which may take the shared policy mutex. This >>> happens while holding page_table_lock from do_huge_pmd_numa_page() but >>> also from do_numa_page() while holding a spinlock on the ptl, which is >>> coming from the sched/numa branch. >>> >>> Is there anyway that we can avoid changing the shared policy mutex back >>> into a spinlock (it was converted in b22d127a39dd ["mempolicy: fix a race >>> in shared_policy_replace()"])? >>> >>> Adding Peter, Rik, and Mel to the cc. >> >> Urgh, crud I totally missed that. >> >> So the problem is that we need to compute if the current page is placed >> 'right' while holding pte_lock in order to avoid multiple pte_lock >> acquisitions on the 'fast' path. >> >> I'll look into this in a bit, but one thing that comes to mind is having >> both a spnilock and a mutex and require holding both for modification >> while either one is sufficient for read. >> >> That would allow sp_lookup() to use the spinlock, while insert and >> replace can hold both. >> >> Not sure it will work for this, need to stare at this code a little >> more. > > So I think the below should work, we hold the spinlock over both rb-tree > modification as sp free, this makes mpol_shared_policy_lookup() which > returns the policy with an incremented refcount work with just the > spinlock. > > Comments? > > --- It made the warnings I've reported go away. Thanks, Sasha -- 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/