Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp341853ybg; Tue, 28 Jul 2020 07:25:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7bvpIt2ZBmyIbkxOjwXshVLkQJpJHnG6G2oY8hmB66txqCoaYR7+DLK3rqvGKGxknt/aj X-Received: by 2002:aa7:da46:: with SMTP id w6mr27402897eds.261.1595946323797; Tue, 28 Jul 2020 07:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595946323; cv=none; d=google.com; s=arc-20160816; b=yP/bqaegT2E0jz+Tyk8T+z3qBOom424No0j/Wl20L/Dt4n4W8/2qNkbizgG8yhYl1B kU+uXAFzSfk9Hw/cFRSKk4Zo2o+zRgK9sprebZ6XIaMBUd9dMTjTY7autBM4oP3xoN+L GHNaOB3oywHmdqTcvEt66N9VcFyDd1e7l+3h7v4wz2rpfbVKW1IiI1/h9Jqvtqw0yCZp O7kWf6vx5QAHLofvplaFmvvMrmxufZS60EAc2WcIi3WjQyWvEU1mJNlGMJxYtIp6L3I8 oWFbu/7f/iNconDbLGUzdxAtvClO8AhcNb0nU8n76bwKSp1mbmtp+//uc4Ta6rPf5Pb5 thGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=06rCqpwu1j4S1S47vgUTPXYPKKso17TGQwzOaoYSYfs=; b=LMITUlOM0sN76jBkv9AosbPD0n7A7RRwRGILPSEbk2UYJQl1f0xAvAeYEmfcQCPejt 8Hh2XBT7YPiqvrvXzkr7i8QiPlI24l22Ev5E00Gcf0ei4uvC0y6dymi9HxsiaMFZtiS4 SK3riS8Q75Eg8/DsazUONR3odulBU5oreZPYtf6AutCiZ9B5XbzYi99+qS1PzDxdV4uy 4QYSdPA6uN1TbrWZa1lWh1OZ1JC9l3ELJbJRF53BQ19iZczWPtTU9Y01KWh7AUd3V/WI cb7biDoCc3O7MU7Gz7LzST+gZeK+S/BLJqKG3JUlgpzk3AY7YJVl3kh0rCngkjbmQwI3 qSvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GtVsFuqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si4577536edv.104.2020.07.28.07.25.01; Tue, 28 Jul 2020 07:25:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GtVsFuqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730367AbgG1OYJ (ORCPT + 99 others); Tue, 28 Jul 2020 10:24:09 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53689 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730089AbgG1OYI (ORCPT ); Tue, 28 Jul 2020 10:24:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595946246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=06rCqpwu1j4S1S47vgUTPXYPKKso17TGQwzOaoYSYfs=; b=GtVsFuqyRfS1RkT25da+EhuUFf5MK+pGegTD127A0pLyWVLsTtxR3jny/u2SUL9VKue0wR zjkYY8l6DX8mAQJRrLoC7J+CTbzHM0/D8/VS0/RR8HLuez7E+VJ6vt9Qjh1l+QjbHxeH2N rsZkLJZxu1iQGHes548R3D8PVHuaLK4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-XL5fGaBiOsyWEWGpA51xEg-1; Tue, 28 Jul 2020 10:24:02 -0400 X-MC-Unique: XL5fGaBiOsyWEWGpA51xEg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8B54D1B18BC1; Tue, 28 Jul 2020 14:23:54 +0000 (UTC) Received: from localhost (ovpn-12-117.pek2.redhat.com [10.72.12.117]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 303B41010427; Tue, 28 Jul 2020 14:23:51 +0000 (UTC) Date: Tue, 28 Jul 2020 22:23:48 +0800 From: Baoquan He To: Mike Rapoport Cc: Andrew Morton , Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Dave Hansen , Ingo Molnar , Marek Szyprowski , Max Filippov , Michael Ellerman , Michal Simek , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Peter Zijlstra , Russell King , Stafford Horne , Thomas Gleixner , Will Deacon , Yoshinori Sato , clang-built-linux@googlegroups.com, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org Subject: Re: [PATCH 14/15] x86/numa: remove redundant iteration over memblock.reserved Message-ID: <20200728142348.GE10792@MiWiFi-R3L-srv> References: <20200728051153.1590-1-rppt@kernel.org> <20200728051153.1590-15-rppt@kernel.org> <20200728110254.GA14854@MiWiFi-R3L-srv> <20200728141504.GC3655207@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200728141504.GC3655207@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/28/20 at 05:15pm, Mike Rapoport wrote: > On Tue, Jul 28, 2020 at 07:02:54PM +0800, Baoquan He wrote: > > On 07/28/20 at 08:11am, Mike Rapoport wrote: > > > From: Mike Rapoport > > > > > > numa_clear_kernel_node_hotplug() function first traverses numa_meminfo > > > regions to set node ID in memblock.reserved and than traverses > > > memblock.reserved to update reserved_nodemask to include node IDs that were > > > set in the first loop. > > > > > > Remove redundant traversal over memblock.reserved and update > > > reserved_nodemask while iterating over numa_meminfo. > > > > > > Signed-off-by: Mike Rapoport > > > --- > > > arch/x86/mm/numa.c | 26 ++++++++++---------------- > > > 1 file changed, 10 insertions(+), 16 deletions(-) > > > > > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > > > index 8ee952038c80..4078abd33938 100644 > > > --- a/arch/x86/mm/numa.c > > > +++ b/arch/x86/mm/numa.c > > > @@ -498,31 +498,25 @@ static void __init numa_clear_kernel_node_hotplug(void) > > > * and use those ranges to set the nid in memblock.reserved. > > > * This will split up the memblock regions along node > > > * boundaries and will set the node IDs as well. > > > + * > > > + * The nid will also be set in reserved_nodemask which is later > > > + * used to clear MEMBLOCK_HOTPLUG flag. > > > + * > > > + * [ Note, when booting with mem=nn[kMG] or in a kdump kernel, > > > + * numa_meminfo might not include all memblock.reserved > > > + * memory ranges, because quirks such as trim_snb_memory() > > > + * reserve specific pages for Sandy Bridge graphics. > > > + * These ranges will remain with nid == MAX_NUMNODES. ] > > > */ > > > for (i = 0; i < numa_meminfo.nr_blks; i++) { > > > struct numa_memblk *mb = numa_meminfo.blk + i; > > > int ret; > > > > > > ret = memblock_set_node(mb->start, mb->end - mb->start, &memblock.reserved, mb->nid); > > > + node_set(mb->nid, reserved_nodemask); > > > > Really? This will set all node id into reserved_nodemask. But in the > > current code, it's setting nid into memblock reserved region which > > interleaves with numa_memoinfo, then get those nid and set it in > > reserved_nodemask. This is so different, with my understanding. Please > > correct me if I am wrong. > > You are right, I've missed the intersections of numa_meminfo with > memblock.reserved. > > x86 interaction with membock is so, hmm, interesting... Yeah, numa_clear_kernel_node_hotplug() intends to find out any memory node which has reserved memory, then make it as unmovable. Setting all node id into reserved_nodemask will break the use case of hot removing hotpluggable boot memory after system bootup.