From nobody Thu Mar 28 16:00:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1561473932; cv=none; d=zoho.com; s=zohoarc; b=MBec5PnxaB6Pyc0rQ2nr9Djj/q8WweQSXaOVD2uNplAf/hDblT0+PYtxE6ztCfPgTZU5br66Suqa6yio4+5DqWcS921eHuS5fHIs/x1KmjEkxp6MxFiL6iQwD/klCE3dgo2lhciesHkjWYkEY75YJOm4fe2ocxUC44n1W1x9wuo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561473932; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FUu/yTWRaw2UTQlH4dPuPtlCBz+xtcnjl8q0o/zqg2M=; b=JDL3P3bOAyXDjJn0bkZTG0JF5yunjvR3pDRCfgm4KUxUE0Nom7PkR32519yKGn6Y0kVE1v3/O0EB7KR8XKVyQLE+YL5I/nNAX+l2DWi1wkUNZdUVu7ZTVMJ42a3oXJvu8H7VVCqzGlVsMVft+GFy3deodloq4Py/EjqY65i/F4w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1561473932937958.8254058851898; Tue, 25 Jun 2019 07:45:32 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmgP-00033m-2q; Tue, 25 Jun 2019 14:44:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmgO-00033h-Le for xen-devel@lists.xenproject.org; Tue, 25 Jun 2019 14:44:28 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ba2b56ee-9757-11e9-b050-9f325b346f34; Tue, 25 Jun 2019 14:44:25 +0000 (UTC) X-Inumbo-ID: ba2b56ee-9757-11e9-b050-9f325b346f34 Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: UEdUF6x2biZlXPYpShersNQuP8GGGoypxJNbcnalodYmrezOj9ZFgA9N7zzskk9KwLoJAqJuHL piFfKC4rasvQjYnElX55hCXk3a8xyaS+UPpWLotYbgmUg9n13R++LnDG02O92CbNxu+q9hBxpS gtsMHR3y3POzM4mLfgWJ3vchKVVtuVtIbDJkjq9cr/dz2akhhF9u4ZE8+uA7snJEuOEMNbuqzY LCqvwkU7VMiAqcF9Fgsj42F78AapP+EwOLe9nakZ1sGaENfFZAaSsPh+6p2KLceMG08CXMr+Mc VN8= X-SBRS: 2.7 X-MesageID: 2215123 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,416,1557201600"; d="scan'208";a="2215123" From: Andrew Cooper To: Xen-devel Date: Tue, 25 Jun 2019 15:43:48 +0100 Message-ID: <20190625144350.6176-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190625144350.6176-1-andrew.cooper3@citrix.com> References: <20190625144350.6176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/3] page-alloc: Rename the first_node local variable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" first_node is the name of a local variable, and part of the nodemask API. = The only reason this compiles is because the nodemask API is implemented as a macro rather than an inline function. It is confusing to read, and breaks when the nodemask API is cleaned up. Rename the local variable to just 'first' which is still clear in context. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap v2: * New --- xen/common/page_alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 7825fd8c42..7bbb44f7d1 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -810,7 +810,7 @@ static struct page_info *get_free_buddy(unsigned int zo= ne_lo, unsigned int order, unsigned int m= emflags, const struct domain *d) { - nodeid_t first_node, node =3D MEMF_get_node(memflags), req_node =3D no= de; + nodeid_t first, node =3D MEMF_get_node(memflags), req_node =3D node; nodemask_t nodemask =3D d ? d->node_affinity : node_online_map; unsigned int j, zone, nodemask_retry =3D 0; struct page_info *pg; @@ -832,7 +832,7 @@ static struct page_info *get_free_buddy(unsigned int zo= ne_lo, ASSERT_UNREACHABLE(); return NULL; } - first_node =3D node; + first =3D node; =20 /* * Start with requested node, but exhaust all node memory in requested @@ -878,19 +878,19 @@ static struct page_info *get_free_buddy(unsigned int = zone_lo, { /* Very first node may be caller-specified and outside nodemas= k. */ ASSERT(!nodemask_retry); - first_node =3D node =3D first_node(nodemask); + first =3D node =3D first_node(nodemask); if ( node < MAX_NUMNODES ) continue; } else if ( (node =3D next_node(node, nodemask)) >=3D MAX_NUMNODES ) node =3D first_node(nodemask); - if ( node =3D=3D first_node ) + if ( node =3D=3D first ) { /* When we have tried all in nodemask, we fall back to others.= */ if ( (memflags & MEMF_exact_node) || nodemask_retry++ ) return NULL; nodes_andnot(nodemask, node_online_map, nodemask); - first_node =3D node =3D first_node(nodemask); + first =3D node =3D first_node(nodemask); if ( node >=3D MAX_NUMNODES ) return NULL; } --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 16:00:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1561474355; cv=none; d=zoho.com; s=zohoarc; b=XtDV8CVrRa+im97GD1ZHe2v9LWyLd7hFdiYTdxGfUHfU7xEfvnZ2zrYABseZBu67SlMfTcKAYw3MdeK4RiyZT3zH3Ly5nRKPKfeYJbLa2aj8nLByne5XyUTef0vbF5cvsvGa2aexbMbUcTA8jMBaqD/Wv9RG8hmPxzlIhvF8/Ko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561474355; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=53X61v0fEI86VYux/ClAFboakJfO1c74fD6zPL8zSXA=; b=CHmyL+UUHE8GJCERdJxQgwqOH5ypX/qnCK9zCukHWFXn4Vd79Fy2rIrDEyvlD8wKn/IdMYniFkYkaiRcWXNrV0cEmivhfnXuL/60oIopURiPDky65UPatH/SNxEqroV0qWHkfI3iKOavfBUACY2p+m6ID5AAOPNVRalPsDwtksE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1561474355385953.9809801425746; Tue, 25 Jun 2019 07:52:35 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmn5-0003zl-6y; Tue, 25 Jun 2019 14:51:23 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmn4-0003zg-AQ for xen-devel@lists.xenproject.org; Tue, 25 Jun 2019 14:51:22 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id b14ce3e8-9758-11e9-821c-1be19607e8e7; Tue, 25 Jun 2019 14:51:20 +0000 (UTC) X-Inumbo-ID: b14ce3e8-9758-11e9-821c-1be19607e8e7 Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: jgN+Hex6taP29OxHbDLNssJYrrQ51Q2OJh55uhf1KEQd7/B1mWhfMff7cacokYiiZPlCmqgCt0 YV8Qrlyp7e4FEFKMqf7k4bGQVrSZ9+GNvRrKPo6x/raMG8wzDnqYhCHlqfYr10c4Th5y01Ueq1 LK+JPvwsLMNFzW5x3q9DjDfCBGRlLpi8sTgLV24gxjZaMRI9TWX3iG7B9B5v9LxKSka7aePWiZ q14sYyCKtkHyCCd/J37Js4riNsSvvD+/do7KefAh1vlgWYcrisEDheGMXY753fDihFspvLT6WI aD8= X-SBRS: 2.7 X-MesageID: 2190886 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,416,1557201600"; d="scan'208";a="2190886" From: Andrew Cooper To: Xen-devel Date: Tue, 25 Jun 2019 15:43:49 +0100 Message-ID: <20190625144350.6176-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190625144350.6176-1-andrew.cooper3@citrix.com> References: <20190625144350.6176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/3] nodemask: Remove implicit addressof from the API X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The nodemask API differs from the cpumask API because each wrapper to bitmap operations is further wrapped by a macro which takes the address of the nodemask objects. This results in code which is slightly confusing to read as it doesn't foll= ow C's calling conventions, and prohibits the use of slightly more complicated constructs for specifying parameters. Drop all wrapping macros, rename the nodemask static inline functions to dr= op the double underscores, and feed MAX_NUMNODES into appropriate locations. Take the opportunity to drop a compiler workaround for node_isset() for GCC 3.3.2 which is long out of support, and implment it with a static inline. Update all callers to use the correct indirection themselves. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap v2: * New --- xen/arch/x86/dom0_build.c | 12 +-- xen/arch/x86/numa.c | 8 +- xen/arch/x86/srat.c | 15 ++-- xen/common/domain.c | 8 +- xen/common/page_alloc.c | 28 +++---- xen/common/sched_credit.c | 2 +- xen/common/sysctl.c | 2 +- xen/include/xen/nodemask.h | 181 ++++++++++++++++++-----------------------= ---- 8 files changed, 110 insertions(+), 146 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index c69570920c..4af2ee0091 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -231,7 +231,7 @@ unsigned int __init dom0_max_vcpus(void) =20 if ( pv_shim ) { - nodes_setall(dom0_nodes); + nodes_setall(&dom0_nodes); =20 /* * When booting in shim mode APs are not started until the guest b= rings @@ -246,11 +246,11 @@ unsigned int __init dom0_max_vcpus(void) =20 for ( i =3D 0; i < dom0_nr_pxms; ++i ) if ( (node =3D pxm_to_node(dom0_pxms[i])) !=3D NUMA_NO_NODE ) - node_set(node, dom0_nodes); - nodes_and(dom0_nodes, dom0_nodes, node_online_map); - if ( nodes_empty(dom0_nodes) ) + node_set(node, &dom0_nodes); + nodes_and(&dom0_nodes, &dom0_nodes, &node_online_map); + if ( nodes_empty(&dom0_nodes) ) dom0_nodes =3D node_online_map; - for_each_node_mask ( node, dom0_nodes ) + for_each_node_mask ( node, &dom0_nodes ) cpumask_or(&dom0_cpus, &dom0_cpus, &node_to_cpumask(node)); cpumask_and(&dom0_cpus, &dom0_cpus, cpupool0->cpu_valid); if ( cpumask_empty(&dom0_cpus) ) @@ -344,7 +344,7 @@ unsigned long __init dom0_compute_nr_pages( if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] ) parse_dom0_mem(CONFIG_DOM0_MEM); =20 - for_each_node_mask ( node, dom0_nodes ) + for_each_node_mask ( node, &dom0_nodes ) avail +=3D avail_domheap_pages_region(node, 0, 0) + initial_images_nrpages(node); =20 diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index b3c9c12d7f..c36c69e842 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -186,15 +186,15 @@ void __init numa_init_array(void) mapping. To avoid this fill in the mapping for all possible CPUs, as the number of CPUs is not known yet. We round robin the existing nodes. */ - rr =3D first_node(node_online_map); + rr =3D first_node(&node_online_map); for ( i =3D 0; i < nr_cpu_ids; i++ ) { if ( cpu_to_node[i] !=3D NUMA_NO_NODE ) continue; numa_set_node(i, rr); - rr =3D next_node(rr, node_online_map); + rr =3D next_node(rr, &node_online_map); if ( rr =3D=3D MAX_NUMNODES ) - rr =3D first_node(node_online_map); + rr =3D first_node(&node_online_map); } } =20 @@ -271,7 +271,7 @@ void __init numa_initmem_init(unsigned long start_pfn, = unsigned long end_pfn) /* setup dummy node covering all memory */ memnode_shift =3D BITS_PER_LONG - 1; memnodemap =3D _memnodemap; - nodes_clear(node_online_map); + nodes_clear(&node_online_map); node_set_online(0); for ( i =3D 0; i < nr_cpu_ids; i++ ) numa_set_node(i, 0); diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index 47a4267220..348bcfea73 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -228,7 +228,7 @@ acpi_numa_x2apic_affinity_init(const struct acpi_srat_x= 2apic_cpu_affinity *pa) } =20 apicid_to_node[pa->apic_id] =3D node; - node_set(node, processor_nodes_parsed); + node_set(node, &processor_nodes_parsed); acpi_numa =3D 1; printk(KERN_INFO "SRAT: PXM %u -> APIC %08x -> Node %u\n", pxm, pa->apic_id, node); @@ -261,7 +261,7 @@ acpi_numa_processor_affinity_init(const struct acpi_sra= t_cpu_affinity *pa) return; } apicid_to_node[pa->apic_id] =3D node; - node_set(node, processor_nodes_parsed); + node_set(node, &processor_nodes_parsed); acpi_numa =3D 1; printk(KERN_INFO "SRAT: PXM %u -> APIC %02x -> Node %u\n", pxm, pa->apic_id, node); @@ -332,7 +332,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_m= em_affinity *ma) if (!(ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE)) { struct node *nd =3D &nodes[node]; =20 - if (!node_test_and_set(node, memory_nodes_parsed)) { + if (!node_test_and_set(node, &memory_nodes_parsed)) { nd->start =3D start; nd->end =3D end; } else { @@ -376,7 +376,7 @@ static int __init nodes_cover_memory(void) =20 do { found =3D 0; - for_each_node_mask(j, memory_nodes_parsed) + for_each_node_mask( j, &memory_nodes_parsed ) if (start < nodes[j].end && end > nodes[j].start) { if (start >=3D nodes[j].start) { @@ -480,10 +480,11 @@ int __init acpi_scan_nodes(u64 start, u64 end) return -1; } =20 - nodes_or(all_nodes_parsed, memory_nodes_parsed, processor_nodes_parsed); + nodes_or(&all_nodes_parsed, &memory_nodes_parsed, + &processor_nodes_parsed); =20 /* Finally register nodes */ - for_each_node_mask(i, all_nodes_parsed) + for_each_node_mask( i, &all_nodes_parsed ) { u64 size =3D nodes[i].end - nodes[i].start; if ( size =3D=3D 0 ) @@ -495,7 +496,7 @@ int __init acpi_scan_nodes(u64 start, u64 end) for (i =3D 0; i < nr_cpu_ids; i++) { if (cpu_to_node[i] =3D=3D NUMA_NO_NODE) continue; - if (!node_isset(cpu_to_node[i], processor_nodes_parsed)) + if (!node_isset(cpu_to_node[i], &processor_nodes_parsed)) numa_set_node(i, NUMA_NO_NODE); } numa_init_array(); diff --git a/xen/common/domain.c b/xen/common/domain.c index 2308588052..cf2a963687 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -613,9 +613,9 @@ void domain_update_node_affinity(struct domain *d) dom_affinity =3D cpumask_empty(dom_cpumask_soft) ? dom_cpumask : dom_cpumask_soft; =20 - nodes_clear(d->node_affinity); + nodes_clear(&d->node_affinity); for_each_cpu ( cpu, dom_affinity ) - node_set(cpu_to_node(cpu), d->node_affinity); + node_set(cpu_to_node(cpu), &d->node_affinity); } =20 spin_unlock(&d->node_affinity_lock); @@ -628,7 +628,7 @@ void domain_update_node_affinity(struct domain *d) int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity) { /* Being affine with no nodes is just wrong */ - if ( nodes_empty(*affinity) ) + if ( nodes_empty(affinity) ) return -EINVAL; =20 spin_lock(&d->node_affinity_lock); @@ -637,7 +637,7 @@ int domain_set_node_affinity(struct domain *d, const no= demask_t *affinity) * Being/becoming explicitly affine to all nodes is not particularly * useful. Let's take it as the `reset node affinity` command. */ - if ( nodes_full(*affinity) ) + if ( nodes_full(affinity) ) { d->auto_node_affinity =3D 1; goto out; diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 7bbb44f7d1..7bba5b0b2e 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -820,9 +820,9 @@ static struct page_info *get_free_buddy(unsigned int zo= ne_lo, { if ( d !=3D NULL ) { - node =3D next_node(d->last_alloc_node, nodemask); + node =3D next_node(d->last_alloc_node, &nodemask); if ( node >=3D MAX_NUMNODES ) - node =3D first_node(nodemask); + node =3D first_node(&nodemask); } if ( node >=3D MAX_NUMNODES ) node =3D cpu_to_node(smp_processor_id()); @@ -874,23 +874,23 @@ static struct page_info *get_free_buddy(unsigned int = zone_lo, return NULL; =20 /* Pick next node. */ - if ( !node_isset(node, nodemask) ) + if ( !node_isset(node, &nodemask) ) { /* Very first node may be caller-specified and outside nodemas= k. */ ASSERT(!nodemask_retry); - first =3D node =3D first_node(nodemask); + first =3D node =3D first_node(&nodemask); if ( node < MAX_NUMNODES ) continue; } - else if ( (node =3D next_node(node, nodemask)) >=3D MAX_NUMNODES ) - node =3D first_node(nodemask); + else if ( (node =3D next_node(node, &nodemask)) >=3D MAX_NUMNODES ) + node =3D first_node(&nodemask); if ( node =3D=3D first ) { /* When we have tried all in nodemask, we fall back to others.= */ if ( (memflags & MEMF_exact_node) || nodemask_retry++ ) return NULL; - nodes_andnot(nodemask, node_online_map, nodemask); - first =3D node =3D first_node(nodemask); + nodes_andnot(&nodemask, &node_online_map, &nodemask); + first =3D node =3D first_node(&nodemask); if ( node >=3D MAX_NUMNODES ) return NULL; } @@ -1167,7 +1167,7 @@ static unsigned int node_to_scrub(bool get_node) node =3D 0; =20 if ( node_need_scrub[node] && - (!get_node || !node_test_and_set(node, node_scrubbing)) ) + (!get_node || !node_test_and_set(node, &node_scrubbing)) ) return node; =20 /* @@ -1178,7 +1178,7 @@ static unsigned int node_to_scrub(bool get_node) for ( ; ; ) { do { - node =3D cycle_node(node, node_online_map); + node =3D cycle_node(node, &node_online_map); } while ( !cpumask_empty(&node_to_cpumask(node)) && (node !=3D local_node) ); =20 @@ -1201,10 +1201,10 @@ static unsigned int node_to_scrub(bool get_node) * then we'd need to take this lock every time we come in here. */ if ( (dist < shortest || closest =3D=3D NUMA_NO_NODE) && - !node_test_and_set(node, node_scrubbing) ) + !node_test_and_set(node, &node_scrubbing) ) { if ( closest !=3D NUMA_NO_NODE ) - node_clear(closest, node_scrubbing); + node_clear(closest, &node_scrubbing); shortest =3D dist; closest =3D node; } @@ -1356,7 +1356,7 @@ bool scrub_free_pages(void) spin_unlock(&heap_lock); =20 out_nolock: - node_clear(node, node_scrubbing); + node_clear(node, &node_scrubbing); return node_to_scrub(false) !=3D NUMA_NO_NODE; } =20 @@ -2006,7 +2006,7 @@ static void __init scrub_heap_pages(void) continue; =20 last_distance =3D INT_MAX; - best_node =3D first_node(node_online_map); + best_node =3D first_node(&node_online_map); /* Figure out which NODE CPUs are close. */ for_each_online_node ( j ) { diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 3c0d7c7267..611ff26153 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -1810,7 +1810,7 @@ csched_load_balance(struct csched_private *prv, int c= pu, } while( peer_cpu !=3D first_cpu ); =20 next_node: - peer_node =3D cycle_node(peer_node, node_online_map); + peer_node =3D cycle_node(peer_node, &node_online_map); } while( peer_node !=3D node ); } =20 diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 765effde8d..f1884b0ab9 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -280,7 +280,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_s= ysctl) bool_t do_meminfo =3D !guest_handle_is_null(ni->meminfo); bool_t do_distance =3D !guest_handle_is_null(ni->distance); =20 - num_nodes =3D last_node(node_online_map) + 1; + num_nodes =3D last_node(&node_online_map) + 1; =20 if ( do_meminfo || do_distance ) { diff --git a/xen/include/xen/nodemask.h b/xen/include/xen/nodemask.h index e287399352..cbf5d0ee33 100644 --- a/xen/include/xen/nodemask.h +++ b/xen/include/xen/nodemask.h @@ -58,12 +58,6 @@ * node_set_offline(node) clear bit 'node' in node_online_map * * for_each_online_node(node) for-loop node over node_online_map - * - * Subtlety: - * 1) The 'type-checked' form of node_isset() causes gcc (3.3.2, anyway) - * to generate slightly worse code. So use a simple one-line #define - * for node_isset(), instead of wrapping an inline inside a macro, the - * way we do the other calls. */ =20 #include @@ -73,161 +67,131 @@ typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; extern nodemask_t _unused_nodemask_arg_; =20 -#define node_set(node, dst) __node_set((node), &(dst)) -static inline void __node_set(int node, volatile nodemask_t *dstp) +static inline void node_set(int node, volatile nodemask_t *dstp) { set_bit(node, dstp->bits); } =20 -#define node_clear(node, dst) __node_clear((node), &(dst)) -static inline void __node_clear(int node, volatile nodemask_t *dstp) +static inline void node_clear(int node, volatile nodemask_t *dstp) { clear_bit(node, dstp->bits); } =20 -#define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES) -static inline void __nodes_setall(nodemask_t *dstp, int nbits) +static inline void nodes_setall(nodemask_t *dstp) { - bitmap_fill(dstp->bits, nbits); + bitmap_fill(dstp->bits, MAX_NUMNODES); } =20 -#define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES) -static inline void __nodes_clear(nodemask_t *dstp, int nbits) +static inline void nodes_clear(nodemask_t *dstp) { - bitmap_zero(dstp->bits, nbits); + bitmap_zero(dstp->bits, MAX_NUMNODES); } =20 -/* No static inline type checking - see Subtlety (1) above. */ -#define node_isset(node, nodemask) test_bit((node), (nodemask).bits) +static inline int node_isset(int node, const nodemask_t *src) +{ + return test_bit(node, src->bits); +} =20 -#define node_test_and_set(node, nodemask) \ - __node_test_and_set((node), &(nodemask)) -static inline int __node_test_and_set(int node, nodemask_t *addr) +static inline int node_test_and_set(int node, nodemask_t *addr) { return test_and_set_bit(node, addr->bits); } =20 -#define nodes_and(dst, src1, src2) \ - __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) -static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, - const nodemask_t *src2p, int nbits) +static inline void nodes_and(nodemask_t *dstp, const nodemask_t *src1p, + const nodemask_t *src2p) { - bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits); + bitmap_and(dstp->bits, src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_or(dst, src1, src2) \ - __nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES) -static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, - const nodemask_t *src2p, int nbits) +static inline void nodes_or(nodemask_t *dstp, const nodemask_t *src1p, + const nodemask_t *src2p) { - bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits); + bitmap_or(dstp->bits, src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_xor(dst, src1, src2) \ - __nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES) -static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, - const nodemask_t *src2p, int nbits) +static inline void nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, + const nodemask_t *src2p) { - bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits); + bitmap_xor(dstp->bits, src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_andnot(dst, src1, src2) \ - __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) -static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1= p, - const nodemask_t *src2p, int nbits) +static inline void nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, + const nodemask_t *src2p) { - bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits); + bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_complement(dst, src) \ - __nodes_complement(&(dst), &(src), MAX_NUMNODES) -static inline void __nodes_complement(nodemask_t *dstp, - const nodemask_t *srcp, int nbits) +static inline void nodes_complement(nodemask_t *dstp, const nodemask_t *sr= cp) { - bitmap_complement(dstp->bits, srcp->bits, nbits); + bitmap_complement(dstp->bits, srcp->bits, MAX_NUMNODES); } =20 -#define nodes_equal(src1, src2) \ - __nodes_equal(&(src1), &(src2), MAX_NUMNODES) -static inline int __nodes_equal(const nodemask_t *src1p, - const nodemask_t *src2p, int nbits) +static inline int nodes_equal(const nodemask_t *src1p, const nodemask_t *s= rc2p) { - return bitmap_equal(src1p->bits, src2p->bits, nbits); + return bitmap_equal(src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_intersects(src1, src2) \ - __nodes_intersects(&(src1), &(src2), MAX_NUMNODES) -static inline int __nodes_intersects(const nodemask_t *src1p, - const nodemask_t *src2p, int nbits) +static inline int nodes_intersects(const nodemask_t *src1p, + const nodemask_t *src2p) { - return bitmap_intersects(src1p->bits, src2p->bits, nbits); + return bitmap_intersects(src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_subset(src1, src2) \ - __nodes_subset(&(src1), &(src2), MAX_NUMNODES) -static inline int __nodes_subset(const nodemask_t *src1p, - const nodemask_t *src2p, int nbits) +static inline int nodes_subset(const nodemask_t *src1p, const nodemask_t *= src2p) { - return bitmap_subset(src1p->bits, src2p->bits, nbits); + return bitmap_subset(src1p->bits, src2p->bits, MAX_NUMNODES); } =20 -#define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES) -static inline int __nodes_empty(const nodemask_t *srcp, int nbits) +static inline int nodes_empty(const nodemask_t *srcp) { - return bitmap_empty(srcp->bits, nbits); + return bitmap_empty(srcp->bits, MAX_NUMNODES); } =20 -#define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES) -static inline int __nodes_full(const nodemask_t *srcp, int nbits) +static inline int nodes_full(const nodemask_t *srcp) { - return bitmap_full(srcp->bits, nbits); + return bitmap_full(srcp->bits, MAX_NUMNODES); } =20 -#define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES) -static inline int __nodes_weight(const nodemask_t *srcp, int nbits) +static inline int nodes_weight(const nodemask_t *srcp) { - return bitmap_weight(srcp->bits, nbits); + return bitmap_weight(srcp->bits, MAX_NUMNODES); } =20 -#define nodes_shift_right(dst, src, n) \ - __nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES) -static inline void __nodes_shift_right(nodemask_t *dstp, - const nodemask_t *srcp, int n, int nbits) +static inline void nodes_shift_right(nodemask_t *dstp, const nodemask_t *s= rcp, + int n) { - bitmap_shift_right(dstp->bits, srcp->bits, n, nbits); + bitmap_shift_right(dstp->bits, srcp->bits, n, MAX_NUMNODES); } =20 -#define nodes_shift_left(dst, src, n) \ - __nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES) -static inline void __nodes_shift_left(nodemask_t *dstp, - const nodemask_t *srcp, int n, int nbits) +static inline void nodes_shift_left(nodemask_t *dstp, const nodemask_t *sr= cp, + int n) { - bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); + bitmap_shift_left(dstp->bits, srcp->bits, n, MAX_NUMNODES); } =20 /* FIXME: better would be to fix all architectures to never return > MAX_NUMNODES, then the silly min_ts could be dropped. */ =20 -#define first_node(src) __first_node(&(src), MAX_NUMNODES) -static inline int __first_node(const nodemask_t *srcp, int nbits) +static inline int first_node(const nodemask_t *srcp) { - return min_t(int, nbits, find_first_bit(srcp->bits, nbits)); + return min_t(int, MAX_NUMNODES, + find_first_bit(srcp->bits, MAX_NUMNODES)); } =20 -#define next_node(n, src) __next_node((n), &(src), MAX_NUMNODES) -static inline int __next_node(int n, const nodemask_t *srcp, int nbits) +static inline int next_node(int n, const nodemask_t *srcp) { - return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1)); + return min_t(int, MAX_NUMNODES, + find_next_bit(srcp->bits, MAX_NUMNODES, n + 1)); } =20 -#define last_node(src) __last_node(&(src), MAX_NUMNODES) -static inline int __last_node(const nodemask_t *srcp, int nbits) +static inline int last_node(const nodemask_t *srcp) { - int node, pnode =3D nbits; - for (node =3D __first_node(srcp, nbits); - node < nbits; - node =3D __next_node(node, srcp, nbits)) + int node, pnode =3D MAX_NUMNODES; + + for (node =3D first_node(srcp); + node < MAX_NUMNODES; node =3D next_node(node, srcp)) pnode =3D node; + return pnode; } =20 @@ -237,27 +201,26 @@ static inline int __last_node(const nodemask_t *srcp,= int nbits) if (sizeof(m) =3D=3D sizeof(unsigned long)) { \ m.bits[0] =3D 1UL<<(node); \ } else { \ - nodes_clear(m); \ - node_set((node), m); \ + nodes_clear(&m); \ + node_set(node, &m); \ } \ m; \ }) =20 -#define first_unset_node(mask) __first_unset_node(&(mask)) -static inline int __first_unset_node(const nodemask_t *maskp) +static inline int first_unset_node(const nodemask_t *maskp) { - return min_t(int,MAX_NUMNODES, - find_first_zero_bit(maskp->bits, MAX_NUMNODES)); + return min_t(int, MAX_NUMNODES, + find_first_zero_bit(maskp->bits, MAX_NUMNODES)); } =20 -#define cycle_node(n, src) __cycle_node((n), &(src), MAX_NUMNODES) -static inline int __cycle_node(int n, const nodemask_t *maskp, int nbits) +static inline int cycle_node(int n, const nodemask_t *maskp) { - int nxt =3D __next_node(n, maskp, nbits); + int nxt =3D next_node(n, maskp); + + if (nxt =3D=3D MAX_NUMNODES) + nxt =3D first_node(maskp); =20 - if (nxt =3D=3D nbits) - nxt =3D __first_node(maskp, nbits); - return nxt; + return nxt; } =20 #define NODE_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES) @@ -305,8 +268,8 @@ static inline int __cycle_node(int n, const nodemask_t = *maskp, int nbits) extern nodemask_t node_online_map; =20 #if MAX_NUMNODES > 1 -#define num_online_nodes() nodes_weight(node_online_map) -#define node_online(node) node_isset((node), node_online_map) +#define num_online_nodes() nodes_weight(&node_online_map) +#define node_online(node) node_isset(node, &node_online_map) #else #define num_online_nodes() 1 #define node_online(node) ((node) =3D=3D 0) @@ -321,9 +284,9 @@ extern nodemask_t node_online_map; node; \ }) =20 -#define node_set_online(node) set_bit((node), node_online_map.bits) -#define node_set_offline(node) clear_bit((node), node_online_map.bits) +#define node_set_online(node) set_bit(node, node_online_map.bits) +#define node_set_offline(node) clear_bit(node, node_online_map.bits) =20 -#define for_each_online_node(node) for_each_node_mask((node), node_online_= map) +#define for_each_online_node(node) for_each_node_mask(node, &node_online_m= ap) =20 #endif /* __LINUX_NODEMASK_H */ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 16:00:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1561474034; cv=none; d=zoho.com; s=zohoarc; b=gUojJ850DBRJ1xrkYtjX+6+YHY1XJ42z3nYo01IjzY9dZTAOiELRYd4/R7ZUtRxtnm8nGoZSzvtc9BqOf+z364Uc8yozdMk0tO0WGpBdak+CqiLEOXjQeL8eomWmWSt540ZALBFqX2RWhe//0uM/BpD4zKY35T8cjwgDxJNA0OE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561474034; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Lnaem1Eexsztqajc5vWMnyq9b14sFFOVVExkg7IYTqI=; b=G+hWrjLL1ho9GsIJqSs1f10FSkjF9nFvpZ4jAPTXXhS6MHpB9dvJnCJ3Df8W3c2mzMLJ8EbVs08nVweFHqqnmF6MdglRatia4mq3eZ2ylrEbQo/igFhgvs269/t13s5Lw64/IEWgqxaUM+vIXHZgoyqlRJ6ZUTaxo3KLkSQdwYc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1561474034685108.00593590968094; Tue, 25 Jun 2019 07:47:14 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmhr-0003BU-G8; Tue, 25 Jun 2019 14:45:59 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmhq-0003BL-Np for xen-devel@lists.xenproject.org; Tue, 25 Jun 2019 14:45:58 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id f07dc2c9-9757-11e9-8980-bc764e045a96; Tue, 25 Jun 2019 14:45:56 +0000 (UTC) X-Inumbo-ID: f07dc2c9-9757-11e9-8980-bc764e045a96 Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: zK/LNadjFT54Kv9wQ8cr3tSWLolovWgYnRMO/FhBC1ILuhi52xIb4YoTJyvogh6nkI+m5GJBlJ xbmddveZyIVnSb2BVMdhSRMDufX6or7KDnk+aPRUK4l+j2TInwvOC830WncjVBU+YcyfALMKq3 fyzVFsLyOqlW49HywFE39YWDYrj9ft21GnhrH0vPTDdvQtzBfcTRKvp25ev2ssfYVqlXMKn0UF hk167bkANJviBM1OvFnal0mpKh6/wxt/jv7eIJ7s7pcq3CB/kdOZC2upl6ZvNWL+6/B1XyqtZZ kyk= X-SBRS: 2.7 X-MesageID: 2201612 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,416,1557201600"; d="scan'208";a="2201612" From: Andrew Cooper To: Xen-devel Date: Tue, 25 Jun 2019 15:43:50 +0100 Message-ID: <20190625144350.6176-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190625144350.6176-1-andrew.cooper3@citrix.com> References: <20190625144350.6176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/3] page-alloc: Clamp get_free_buddy() to online nodes X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" d->node_affinity defaults to NODE_MASK_ALL which has bits set outside of node_online_map. This in turn causes the loop in get_free_buddy() to waste effort iterating over offline nodes. Always clamp d->node_affinity to node_online_map when in use. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap v2: * Rebase over the nodemask API change, and implement with a single nodes_and() --- xen/common/page_alloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 7bba5b0b2e..fe1159b352 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -811,11 +811,15 @@ static struct page_info *get_free_buddy(unsigned int = zone_lo, const struct domain *d) { nodeid_t first, node =3D MEMF_get_node(memflags), req_node =3D node; - nodemask_t nodemask =3D d ? d->node_affinity : node_online_map; + nodemask_t nodemask; unsigned int j, zone, nodemask_retry =3D 0; struct page_info *pg; bool use_unscrubbed =3D (memflags & MEMF_no_scrub); =20 + /* Clamp nodemask to node_online_map and optionally d->node_affinity. = */ + nodes_and(&nodemask, &node_online_map, + d ? &d->node_affinity : &node_online_map); + if ( node =3D=3D NUMA_NO_NODE ) { if ( d !=3D NULL ) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu Mar 28 16:00:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1561474785; cv=none; d=zoho.com; s=zohoarc; b=FOn7vYu2guCp2n4NOpxF3cje7tT5VjINc6Y1Xtwadxvhcy9Qyf0JerWSnNqbn7jTOv76eGxDQDrNC2AByxD6zLnjf74VVBuxKcygGBsl9nhRUT7UomF9Bwt/NQHgTy//K9Y+3IwhYoN2dadtvSChNTEnEo0rNdM1N2LfasLT9lE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561474785; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=d9SmbCQ3/NiFEfnLPYW8ha0hrBYNRjsKov+is0PKrBY=; b=NjWiA05EclIuK/E3QwtDYlUYzdUAO4JUOcXX71FT3KvryH8IVmL5aTJr1e6cGKMS8XMXxWnGN9NwkOrolLown0LCQcVVWdKYQkYKXgJ17aUjemA9Ad/SUH5VXy6HMoigsJoslhMBfTXjlXf0HRVJcsK2I+5gKLzdSRkPIsyLi7U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1561474785106646.3220634335133; Tue, 25 Jun 2019 07:59:45 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmty-0004GQ-AG; Tue, 25 Jun 2019 14:58:30 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hfmtx-0004GL-0h for xen-devel@lists.xenproject.org; Tue, 25 Jun 2019 14:58:29 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id aff776a3-9759-11e9-8980-bc764e045a96; Tue, 25 Jun 2019 14:58:27 +0000 (UTC) X-Inumbo-ID: aff776a3-9759-11e9-8980-bc764e045a96 Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: DzvAelj4n+h43jA4j0B7rABQjUoixDYL20gdqWreUao6lSml24KfvJizOpkvFj9eEd93AfIGW5 cxtD2/ojmFw+QEIlRT5w8BriSj3xdDWxjRsUbE6rOnP4yk2dCQF2CU5vT2YLeIUjsz9sIBsvFF 2m3DMyOWZmMhcIeE9nuEGbcXZu7kOhP/OsBOsNT3Dr81PdLIHQLbRSJ6Ve4H7vOr0ncfDBlFTP E3Jvl/QQuOrfV5llPn4hi4nJTnUMg9UcnzmVH7u21kqgG91NGpg+4aTjF4ejlyBggP1WOxKm22 D/A= X-SBRS: 2.7 X-MesageID: 2205519 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.63,416,1557201600"; d="scan'208";a="2205519" From: Andrew Cooper To: Xen-devel Date: Tue, 25 Jun 2019 15:58:23 +0100 Message-ID: <20190625145823.17544-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190625144350.6176-1-andrew.cooper3@citrix.com> References: <20190625144350.6176-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/3] nodemask: Don't opencode cycle_node() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Julien Grall , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap --- xen/arch/x86/numa.c | 4 +--- xen/common/page_alloc.c | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c index c36c69e842..f7d320f207 100644 --- a/xen/arch/x86/numa.c +++ b/xen/arch/x86/numa.c @@ -192,9 +192,7 @@ void __init numa_init_array(void) if ( cpu_to_node[i] !=3D NUMA_NO_NODE ) continue; numa_set_node(i, rr); - rr =3D next_node(rr, &node_online_map); - if ( rr =3D=3D MAX_NUMNODES ) - rr =3D first_node(&node_online_map); + rr =3D cycle_node(rr, &node_online_map); } } =20 diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index fe1159b352..8858766c97 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -823,11 +823,8 @@ static struct page_info *get_free_buddy(unsigned int z= one_lo, if ( node =3D=3D NUMA_NO_NODE ) { if ( d !=3D NULL ) - { - node =3D next_node(d->last_alloc_node, &nodemask); - if ( node >=3D MAX_NUMNODES ) - node =3D first_node(&nodemask); - } + node =3D cycle_node(d->last_alloc_node, &nodemask); + if ( node >=3D MAX_NUMNODES ) node =3D cpu_to_node(smp_processor_id()); } --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel