Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755409AbaGQAya (ORCPT ); Wed, 16 Jul 2014 20:54:30 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:50562 "EHLO mail-ig0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755373AbaGQAyX (ORCPT ); Wed, 16 Jul 2014 20:54:23 -0400 Date: Wed, 16 Jul 2014 17:54:20 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Vlastimil Babka cc: Andrew Morton , Andrea Arcangeli , Mel Gorman , Rik van Riel , "Kirill A. Shutemov" , Bob Liu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [patch v2] mm, tmp: only collapse hugepages to nodes with affinity for zone_reclaim_mode In-Reply-To: <53C69C7B.1010709@suse.cz> Message-ID: References: <53C69C7B.1010709@suse.cz> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) 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 Wed, 16 Jul 2014, Vlastimil Babka wrote: > I wonder if you could do this here? > > if (khugepaged_node_load[nid]) > return false; > > If the condition is true, it means you already checked the 'nid' node against > all other nodes present in the pmd in a previous khugepaged_scan_pmd iteration. > And if it passed then, it would also pass now. If meanwhile a new node was found > and recorded, it was also checked against everything present at that point, > including 'nid'. So it should be safe? > > The worst case (perfect interleaving page per page, so that "node != last_node" > is true in each iteration) complexity then reduces from O(HPAGE_PMD_NR * > MAX_NUMNODES) to O(HPAGE_PMD_NR + MAX_NUMNODES) iterations. > Excellent suggestion, thanks Vlastimil! -- 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/