Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16941156rwd; Mon, 26 Jun 2023 18:02:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5EqxjT9HoudhU2f4Rmjy2gLS220Iw4fs/6AYjgimCE8niCHs7VVAVauJceinZjx2WgToGf X-Received: by 2002:a05:6a20:7d9a:b0:12a:40e6:888a with SMTP id v26-20020a056a207d9a00b0012a40e6888amr1204044pzj.37.1687827727823; Mon, 26 Jun 2023 18:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687827727; cv=none; d=google.com; s=arc-20160816; b=Dy4gpl8+2KEqvFNtGeTFOrVy9z3U+kSYTEHxEZiNSd4/MDzLDUjMn9pD6JUCQ/0pAf jWfmFgn5Z+Irl0Dneiv72FmqJwVa2kGTUl9Mez4ce0UuqSedKeQ7TaAGpFxgvKXaDrJ7 OEME92ErM93HzDgZo6D4wJEpzVU3gk3yQYuJCNpcD7SGhTm8OBW/sj77iFZqsK5iuDXL AWQwaX6Y+A8aLl7ErGoJbxhGLvfE61AJW9nYlTJMwE7vhhJaqElF0BiaxG8YvFmO7lVr dkr9Uohw7D+xuhxMWc4BtX2OAVHxlPHgxPi3gMPwsqrjOY76NA0PMW9EOcUTZ9qlLNJF A0bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lEUNC4yu391ZipIarBJdBNNSKKwuEE68IDglnXmmpXM=; fh=yDxy1xrIJ/yVXquds01B+N5RlmFPQ6fBHuR2bIaUPjE=; b=Y022vpjCP0ShPXNDrLtRS7B3gnHV+fbFQcR2sma5DOFci8wUewTvD3yO/ZUlcqaMp5 iyBETVLtPYtAQqbOEYPvoNbufllN+ZPpP4TeJAMp20ikCWo4xRmWYRrkTdlKbdQ1yv/p mr/sD5GX+ekZQp2SPog/hcupAVDKy9IDUIocUb7Yv+uaVQHqX2Pz91Idpp9b6CGayrmb 9dH9rTdA7aqP7SqYAehhW/uXfaAWCJMTAOJo7lOsNqgF+DBsEpoyABTgO6AiOGe5l6cb awjBcYHG7jd1tR/2p6UWn5eqY5B8Os/BZkUldqsmH5sbOzVaPKRfEBpsrmM2oBSgoyv6 +iiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Yp6DPLes; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a170902b68a00b001b053ea9b8dsi5638741pls.570.2023.06.26.18.01.55; Mon, 26 Jun 2023 18:02:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Yp6DPLes; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbjF0At0 (ORCPT + 99 others); Mon, 26 Jun 2023 20:49:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjF0AtZ (ORCPT ); Mon, 26 Jun 2023 20:49:25 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4DDE172A; Mon, 26 Jun 2023 17:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687826964; x=1719362964; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=NIvD168ivu638YoBw6zU4zgstOCr5dCsNkfps809nx0=; b=Yp6DPLesMY5Rez9THF7eStDuOuhOCHJz5iQ4VlifpAvA0UwZpOkwFZa3 XxwU/+5mV+bgxlQ30776NOTNv2nz0Pwz0ztCB5Y9a91h+zQFqUazhz/Yx l8XCpPA4FeoUwBSaF299/zzCAhfEkvP91YfEpB2Bum51OGonOCTiwyjgd wZPQEc+pIvD19BnYQ8/yBpDNLnktha3lh92XEEj2MevzvnfyvGbWjCtuG lkJwDFoOyyxc97ceabCKwvxlAJ198WmLIQPLQd9QDWaH+zlmMdYktzUDy xIS1drlKcmSxIv31Ne29QyTy+VeVuHEsxx9SI6MQt8eOpS2YFqst3yfTS Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="364883703" X-IronPort-AV: E=Sophos;i="6.01,161,1684825200"; d="scan'208";a="364883703" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 17:49:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="666492554" X-IronPort-AV: E=Sophos;i="6.01,161,1684825200"; d="scan'208";a="666492554" Received: from aschofie-mobl2.amr.corp.intel.com (HELO aschofie-mobl2) ([10.212.171.4]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 17:49:23 -0700 Date: Mon, 26 Jun 2023 17:49:22 -0700 From: Alison Schofield To: Dan Williams Cc: "Rafael J. Wysocki" , Len Brown , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Andrew Morton , Jonathan Cameron , Dave Jiang , Mike Rapoport , x86@kernel.org, linux-cxl@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Derick Marks Subject: Re: [PATCH v3 1/2] x86/numa: Introduce numa_fill_memblks() Message-ID: References: <2fd3778271d4fd3c4278c75c582daf6df4dcc503.1687645837.git.alison.schofield@intel.com> <6497d8421945c_2ed72941@dwillia2-xfh.jf.intel.com.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6497d8421945c_2ed72941@dwillia2-xfh.jf.intel.com.notmuch> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 24, 2023 at 11:01:38PM -0700, Dan Williams wrote: > alison.schofield@ wrote: > > From: Alison Schofield > > > > numa_fill_memblks() fills in the gaps in numa_meminfo memblks > > over an physical address range. > [..] > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > > index 2aadb2019b4f..152398bdecc4 100644 > > --- a/arch/x86/mm/numa.c > > +++ b/arch/x86/mm/numa.c > [..] > > +int __init numa_fill_memblks(u64 start, u64 end) > > +{ > > + struct numa_memblk **blk = &numa_memblk_list[0]; > > + struct numa_meminfo *mi = &numa_meminfo; > > + int count = 0; > > + u64 prev_end; > > + > > + /* > > + * Create a list of pointers to numa_meminfo memblks that > > + * overlap start, end. Exclude (start == bi->end) since > > + * end addresses in both a CFMWS range and a memblk range > > + * are exclusive. > > + * > > + * This list of pointers is used to make in-place changes > > + * that fill out the numa_meminfo memblks. > > + */ > > + for (int i = 0; i < mi->nr_blks; i++) { > > + struct numa_memblk *bi = &mi->blk[i]; > > + > > + if (start < bi->end && end >= bi->start) { > > + blk[count] = &mi->blk[i]; > > + count++; > > + } > > + } > > + if (!count) > > + return NUMA_NO_MEMBLK; > > + > > + /* Sort the list of pointers in memblk->start order */ > > + sort(&blk[0], count, sizeof(blk[0]), cmp_memblk, NULL); > > + > > + /* Make sure the first/last memblks include start/end */ > > + blk[0]->start = min(blk[0]->start, start); > > + blk[count - 1]->end = max(blk[count - 1]->end, end); > > + > > + /* > > + * Fill any gaps by tracking the previous memblks > > + * end address and backfilling to it if needed. > > + */ > > + prev_end = blk[0]->end; > > + for (int i = 1; i < count; i++) { > > + struct numa_memblk *curr = blk[i]; > > + > > + if (prev_end >= curr->start) { > > + if (prev_end < curr->end) > > + prev_end = curr->end; > > + } else { > > + curr->start = prev_end; > > + prev_end = curr->end; > > + } > > + } > > + return 0; > > +} > > +EXPORT_SYMBOL_GPL(numa_fill_memblks); > > After deleting this export you can add: Drats! Sorry for missing that. > > Reviewed-by: Dan Williams