Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5668748imm; Tue, 16 Oct 2018 14:07:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV623ClYquMN0frHxvNF/fXfagcWXFhZztO7L7Mv6Y42HurNPDIgCCeogYqODmLVrGmHScjsX X-Received: by 2002:a63:ec4b:: with SMTP id r11-v6mr21537945pgj.295.1539724049660; Tue, 16 Oct 2018 14:07:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539724049; cv=none; d=google.com; s=arc-20160816; b=GeSDJrODKmjCnFXcdoV1F8NcFcGp1gJD9ELyPKp/T61fa27zqHI6+T3aN8u0yda0yL OVARta7IvfBKdVMI4qSsRKiDgSFLatGE3t3fku4f6liQR58nSlkpfMHhtwa5wnGeW6xe 0S7D9TNhT94Xl5kucAf1QcV5PwswALHgrgGzobAznnKXbBTi5crphTXS/+/Ngxpjf+k5 /aPFyXXlnUVYaWC/h5CU2PLk9lZ5XyGW5ma8kzHCecZMsauBiDJDUICg9Yo4dDBEwwnK pZuiuMiluW2uZuVRT4iDnWVuHaSy0o1B7n6wCnwqahJUAPWVvRjQniQwneaW00bCjYDO p1OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=aI/Kg4X8Nj1i2a2fyNQii/DKiJ0iopA4cJy+6JFDwVM=; b=GO7UAo+uGl8MxHdSYmqq9Lyl+VNzv/caewFumxEW+kkohVx7HqD+7ZAedo/XPAdkPA tbB7fhbYa4C5zpO9RM3Ze1M/WeRJDAAg5WyZG4qZpEpbfSv/h4FYax685+j6ruBWCo1G 2IadWZUpmWaxOJrji3DeFhqu8XPuLyKfb0xnHxAaQNNk/e/zXllr2ahWX6PZ2NCURr52 ND6jL7kVN11l0BD7ZSpbWdgb7WpHPwnBrydpQTGeUKzGW0pHLeplCZZ5wPMDs9bOkmS0 uvBKMSxYNnTxkkeOM8DpVdaTjFE9c2PuSfmL/XRLTlkIq8xT53/gQ8ofIrLX2hqWV2WQ WIdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="OBO6w1/O"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w6-v6si16072309pgm.557.2018.10.16.14.07.13; Tue, 16 Oct 2018 14:07:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="OBO6w1/O"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726944AbeJQE7F (ORCPT + 99 others); Wed, 17 Oct 2018 00:59:05 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:33883 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbeJQE7F (ORCPT ); Wed, 17 Oct 2018 00:59:05 -0400 Received: by mail-qk1-f194.google.com with SMTP id p6-v6so15150726qkg.1; Tue, 16 Oct 2018 14:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aI/Kg4X8Nj1i2a2fyNQii/DKiJ0iopA4cJy+6JFDwVM=; b=OBO6w1/OeJTwv8yIKchKYhURS+rEc5IpG43AscvPYcGA4X870iFLyWe1LUOS1NzXTL arGSaaAsYEOfYm3A3zCUOsaa42z5lK5yEuvnIRaECSLWl205qzN0GsDu8sVzyns5L3Uo 6GRYGsYqoOa2aKuTpavdEFSzDBsOg5JXAWlCOdhUqOsyluwta0s9YcSf1N6NqXNtdcZJ B28ueZp78dHM1fSxVbyj7FaPIEQjFta7PXimGzoQB6sSBi2TM3ksSS5chG1jSvjoIgTa hQIICO4nRzeOewNpJxITVWvX5HaUHD5nQ+GZHBd2B0jRlb7gfASEYwxgqufRuk8K9Hw3 yRLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aI/Kg4X8Nj1i2a2fyNQii/DKiJ0iopA4cJy+6JFDwVM=; b=shyakuHVX6gETMqHQ9JGvWbjl0Mv2Umdx2lOQnxGpf/C0BJIVVlSEQl69T6YGwwA5+ VT20OjUP3nkOgAP6y13VaCo/lF+4uW13SefgQWVzfDSwvKcpOy0bRE17BAghUngpzkJ4 z9ZMoiGt5htPE0dikg3Ls05NVtZLzaOZZM9adz4cL9MxF73yx+PYl8nURk3aR9aEJBBw bZIRaU4XHFWzxwQh6B0DmqtQNCulACrL98/In3Z63zLahJRksT86TWfFr8gVtRVywjJ1 us1bEDqhYVl364KLh2Hqndcy5zONcjg+eCD9yrqIfkyGw1PM+SGWQNvkQUom5nC0xTa2 hg2g== X-Gm-Message-State: ABuFfohbBIulLfUVNiNCLU4ayPfTaVtmoH2zyfXJksmArPgBXP+CG+Fy 4DkAPZasXZnavSTWvVdE3Sg= X-Received: by 2002:a37:5c81:: with SMTP id q123-v6mr22897586qkb.156.1539724009985; Tue, 16 Oct 2018 14:06:49 -0700 (PDT) Received: from [192.168.1.10] (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id v10-v6sm9208266qkv.90.2018.10.16.14.06.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 14:06:49 -0700 (PDT) Subject: Re: [mm PATCH v3 2/6] mm: Drop meminit_pfn_in_nid as it is redundant To: Alexander Duyck , linux-mm@kvack.org, akpm@linux-foundation.org Cc: pavel.tatashin@microsoft.com, mhocko@suse.com, dave.jiang@intel.com, linux-kernel@vger.kernel.org, willy@infradead.org, davem@davemloft.net, yi.z.zhang@linux.intel.com, khalid.aziz@oracle.com, rppt@linux.vnet.ibm.com, vbabka@suse.cz, sparclinux@vger.kernel.org, dan.j.williams@intel.com, ldufour@linux.vnet.ibm.com, mgorman@techsingularity.net, mingo@kernel.org, kirill.shutemov@linux.intel.com References: <20181015202456.2171.88406.stgit@localhost.localdomain> <20181015202703.2171.40829.stgit@localhost.localdomain> From: Pavel Tatashin Message-ID: <06e4428b-860e-1e66-defd-77666fcfa0c5@gmail.com> Date: Tue, 16 Oct 2018 17:06:48 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16/18 4:49 PM, Alexander Duyck wrote: > On 10/16/2018 1:33 PM, Pavel Tatashin wrote: >> >> >> On 10/15/18 4:27 PM, Alexander Duyck wrote: >>> As best as I can tell the meminit_pfn_in_nid call is completely >>> redundant. >>> The deferred memory initialization is already making use of >>> for_each_free_mem_range which in turn will call into __next_mem_range >>> which >>> will only return a memory range if it matches the node ID provided >>> assuming >>> it is not NUMA_NO_NODE. >>> >>> I am operating on the assumption that there are no zones or pgdata_t >>> structures that have a NUMA node of NUMA_NO_NODE associated with >>> them. If >>> that is the case then __next_mem_range will never return a memory range >>> that doesn't match the zone's node ID and as such the check is >>> redundant. >>> >>> So one piece I would like to verfy on this is if this works for ia64. >>> Technically it was using a different approach to get the node ID, but it >>> seems to have the node ID also encoded into the memblock. So I am >>> assuming this is okay, but would like to get confirmation on that. >>> >>> Signed-off-by: Alexander Duyck >> >> If I am not mistaken, this code is for systems with memory interleaving. >> Quick looks shows that x86, powerpc, s390, and sparc have it set. >> >> I am not sure about other arches, but at least on SPARC, there are some >> processors with memory interleaving feature: >> >> http://www.fujitsu.com/global/products/computing/servers/unix/sparc-enterprise/technology/performance/memory.html >> >> >> Pavel > > I get what it is for. However as best I can tell the check is actually > redundant. In the case of the deferred page initialization we are > already pulling the memory regions via "for_each_free_mem_range". That > function is already passed a NUMA node ID. Because of that we are > already checking the memory range to determine if it is in the node or > not. As such it doesn't really make sense to go through for each PFN and > then go back to the memory range and see if the node matches or not. > Agree, it looks redundant, nice clean-up, I like it. Reviewed-by: Pavel Tatashin Thank you, Pavel > You can take a look at __next_mem_range which is called by > for_each_free_mem_range and passed &memblock.memory and > &memblock.reserved to avoid: > https://elixir.bootlin.com/linux/latest/source/mm/memblock.c#L899 > > Then you can work your way through: > meminit_pfn_in_nid(pfn, node, state) >  __early_pfn_to_nid(pfn, state) >   memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn) >    memblock_search(&memblock.memory, pfn) > > From what I can tell the deferred init is going back through the > memblock.memory list we pulled this range from and just validating it > against itself. This makes sense for the standard init as that is just > going from start_pfn->end_pfn, but for the deferred init we are pulling > the memory ranges ahead of time so we shouldn't need to re-validate the > memory that is contained within that range.