From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946200AbbGQNuy (ORCPT ); Fri, 17 Jul 2015 09:50:54 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:59808 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946172AbbGQNuv (ORCPT ); Fri, 17 Jul 2015 09:50:51 -0400 Date: Fri, 17 Jul 2015 15:50:42 +0200 From: Peter Zijlstra To: Mel Gorman Cc: Andrew Morton , Nicolai Stange , Dave Hansen , Alex Ng , Fengguang Wu , Linux-MM , LKML Subject: Re: [PATCH 3/3] mm, meminit: Allow early_pfn_to_nid to be used during runtime Message-ID: <20150717135042.GO19282@twins.programming.kicks-ass.net> References: <1437135724-20110-1-git-send-email-mgorman@suse.de> <1437135724-20110-4-git-send-email-mgorman@suse.de> <20150717131232.GK19282@twins.programming.kicks-ass.net> <20150717131729.GE2561@suse.de> <20150717132922.GN19282@twins.programming.kicks-ass.net> <20150717133913.GF2561@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150717133913.GF2561@suse.de> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 17, 2015 at 02:39:13PM +0100, Mel Gorman wrote: > I'm don't know and no longer have access to the necessary machine to test > any more. You make a reasonable point and I would be surprised if it was > noticable. On the other hand, conditional locking is evil and the patch > reflected my thinking at the time "we don't need locks during boot". It's > the type of thinking that should be backed with figures if it was to be > used at all so lets go with; Last time I tested it, an uncontended spinlock (cache hot) ran around 20 cycles, the unlock is a regular store (x86) and in single digit cycles. I doubt modern hardware makes it go slower. > ---8<--- > mm, meminit: Allow early_pfn_to_nid to be used during runtime v2 > > early_pfn_to_nid historically was inherently not SMP safe but only > used during boot which is inherently single threaded or during hotplug > which is protected by a giant mutex. With deferred memory initialisation > there was a thread-safe version introduced and the early_pfn_to_nid > would trigger a BUG_ON if used unsafely. Memory hotplug hit that check. > This patch makes early_pfn_to_nid introduces a lock to make it safe to > use during hotplug. > > Reported-and-tested-by: Alex Ng > Signed-off-by: Mel Gorman Acked-by: Peter Zijlstra (Intel)