import UBI numactl-2.0.19-3.el9

This commit is contained in:
eabdullin 2025-11-11 15:53:46 +00:00
parent d919d7a3ed
commit 2d56350a52
4 changed files with 155 additions and 1 deletions

View File

@ -0,0 +1,80 @@
From 1159e00f4f8604fdbb36a8fb04a1c86ce3cdc054 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
Date: Thu, 23 Jan 2025 18:50:09 +0800
Subject: [PATCH 1/2] libnuma.c: Introduce numa_preferred_err()
After commit 87c6834 ( libnuma: Convert preferred node into a mask),
numa_preferred() returns -1 if no suitable node is found. Before that,
it returns 0.
The users still expect the old behavior, and use 0 as an index to
an array. In order to avoid modifying the existing code, let's introduce
another API numa_preferred_err() to report error if no suitable node is
available and keep numa_preferred() in its original form.
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
libnuma.c | 12 +++++++++++-
numa.h | 3 +++
versions.ldscript | 1 +
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/libnuma.c b/libnuma.c
index 1ffe207..380e8a6 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -1947,7 +1947,7 @@ static struct bitmask *__numa_preferred(void)
return bmp;
}
-int numa_preferred(void)
+int numa_preferred_err(void)
{
int first_node = 0;
struct bitmask *bmp;
@@ -1959,6 +1959,16 @@ int numa_preferred(void)
return first_node;
}
+int numa_preferred(void)
+{
+ int first_node = 0;
+
+ first_node = numa_preferred_err();
+ first_node = first_node >= 0 ? first_node : 0;
+
+ return first_node;
+}
+
static void __numa_set_preferred(struct bitmask *bmp)
{
int nodes = numa_bitmask_weight(bmp);
diff --git a/numa.h b/numa.h
index 51a6833..f0b550b 100644
--- a/numa.h
+++ b/numa.h
@@ -140,6 +140,9 @@ int numa_max_node(void);
int numa_max_possible_node(void);
/* Return preferred node */
int numa_preferred(void);
+/* If the preferred node is unavailable, return an error;
+ otherwise, return the preferred node */
+int numa_preferred_err(void);
/* Return node size and free memory */
long long numa_node_size64(int node, long long *freep);
diff --git a/versions.ldscript b/versions.ldscript
index ee48e70..2fd6ebc 100644
--- a/versions.ldscript
+++ b/versions.ldscript
@@ -45,6 +45,7 @@ libnuma_1.1 {
numa_parse_bitmap;
numa_police_memory;
numa_preferred;
+ numa_preferred_err;
numa_run_on_node;
numa_run_on_node_mask;
numa_sched_getaffinity;
--
2.47.0

View File

@ -0,0 +1,37 @@
From 63e02235bdbcf5aa334903be2111a82b27c8c155 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
Date: Fri, 24 Jan 2025 11:33:32 +0800
Subject: [PATCH 2/2] doc: Update man for numa_preferred_err()
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
numa.3 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/numa.3 b/numa.3
index af24f66..e911953 100644
--- a/numa.3
+++ b/numa.3
@@ -64,6 +64,8 @@ numa \- NUMA policy library
.sp
.B int numa_preferred(void);
.br
+.B int numa_preferred_err(void);
+.br
.B int numa_has_preferred_many(void);
.br
.B struct bitmask *numa_preferred_many(void);
@@ -448,6 +450,10 @@ allocates memory, unless some other policy overrides this.
.\" order of the current node's zonelist to return the correct
.\" node. Need to tighten this up with the syscall results.
+.BR numa_preferred_err ()
+Similiar to numa_preferred(), but If the preferred node is unavailable,
+return an error instead of zero.
+
.BR numa_has_preferred_many ()
Returns > 0 if the system supports multiple preferred nodes.
--
2.47.0

View File

@ -0,0 +1,34 @@
From 690a72cabb010d02c910f54782641737bf947e77 Mon Sep 17 00:00:00 2001
From: Seeteena Thoufeek <s1seetee@linux.ibm.com>
Date: Wed, 18 Jun 2025 10:22:23 +0530
Subject: [PATCH] numastat command fails on LPAR which is not having node0
We see the device path hardcoded with node0.
it presumes node0 always exist, and it just counts
the number of rows of information in the file for later
uses where it does process the nodes as expected.
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
---
numastat.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/numastat.c b/numastat.c
index 7683f07..54d201c 100644
--- a/numastat.c
+++ b/numastat.c
@@ -782,8 +782,9 @@ static void show_info_from_system_file(char *file, int tok_offset)
{
char fname[64];
char buf[SMALL_BUF_SIZE];
- // Open /sys/.../node0/<file>
- snprintf(fname, sizeof(fname), "/sys/devices/system/node/node0/%s", file);
+
+ // Use the first available node for initial row counting
+ snprintf(fname, sizeof(fname), "/sys/devices/system/node/node%d/%s", node_ix_map[0], file);
FILE *fs = fopen(fname, "r");
if (!fs) {
sprintf(buf, "cannot open %s", fname);
--
2.49.0

View File

@ -1,7 +1,7 @@
Name: numactl
Summary: Library for tuning for Non Uniform Memory Access machines
Version: 2.0.19
Release: 1%{dist}
Release: 3%{dist}
# libnuma is LGPLv2 and GPLv2
# numactl binaries are GPLv2 only
License: LGPL-2.1-only and GPL-2.0-only
@ -38,6 +38,9 @@ ExcludeArch: s390 %{arm}
# Patches 601 onward are generic patches
#
#Patch601: 0001-fix-typo-in-memhog.8.patch
Patch601: 0001-libnuma.c-Introduce-numa_preferred_err.patch
Patch602: 0002-doc-Update-man-for-numa_preferred_err.patch
Patch603: 0003-numastat-command-fails-on-LPAR-which-is-not-having-n.patch