linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libnuma: supress warnings for non-existing node
@ 2015-12-07 14:32 Petr Holasek
  2015-12-11 15:48 ` Filipe Brandenburger
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Holasek @ 2015-12-07 14:32 UTC (permalink / raw)
  To: linux-numa; +Cc: Filipe Brandenburger, Cliff Wickman, Petr Holasek

When calling numa_node_to_cpus on non-existing node number (e.g. for
non-contiguous node numbers), a bit confusing warning is supressed. Since
warnings are implemented as weak functions they cannot be overriden when
using dlsym interface.

Signed-off-by: Petr Holasek <pholasek@redhat.com>
---
 libnuma.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/libnuma.c b/libnuma.c
index 3717d5b..549525c 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -1276,11 +1276,13 @@ numa_node_to_cpus_v1(int node, unsigned long *buffer, int bufferlen)
 	sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
 	f = fopen(fn, "r");
 	if (!f || getdelim(&line, &len, '\n', f) < 1) {
-		numa_warn(W_nosysfs2,
-		   "/sys not mounted or invalid. Assuming one node: %s",
-			  strerror(errno));
-		numa_warn(W_nosysfs2,
-		   "(cannot open or correctly parse %s)", fn);
+		if (numa_bitmask_isbitset(numa_nodes_ptr, node)) {
+			numa_warn(W_nosysfs2,
+			   "/sys not mounted or invalid. Assuming one node: %s",
+				  strerror(errno));
+			numa_warn(W_nosysfs2,
+			   "(cannot open or correctly parse %s)", fn);
+		}
 		bitmask.maskp = (unsigned long *)mask;
 		bitmask.size  = buflen_needed * 8;
 		numa_bitmask_setall(&bitmask);
@@ -1355,11 +1357,13 @@ numa_node_to_cpus_v2(int node, struct bitmask *buffer)
 	sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node); 
 	f = fopen(fn, "r"); 
 	if (!f || getdelim(&line, &len, '\n', f) < 1) { 
-		numa_warn(W_nosysfs2,
-		   "/sys not mounted or invalid. Assuming one node: %s",
-			  strerror(errno)); 
-		numa_warn(W_nosysfs2,
-		   "(cannot open or correctly parse %s)", fn);
+		if (numa_bitmask_isbitset(numa_nodes_ptr, node)) {
+			numa_warn(W_nosysfs2,
+			   "/sys not mounted or invalid. Assuming one node: %s",
+				  strerror(errno)); 
+			numa_warn(W_nosysfs2,
+			   "(cannot open or correctly parse %s)", fn);
+		}
 		numa_bitmask_setall(mask);
 		err = -1;
 	} 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libnuma: supress warnings for non-existing node
  2015-12-07 14:32 [PATCH] libnuma: supress warnings for non-existing node Petr Holasek
@ 2015-12-11 15:48 ` Filipe Brandenburger
  0 siblings, 0 replies; 2+ messages in thread
From: Filipe Brandenburger @ 2015-12-11 15:48 UTC (permalink / raw)
  To: Petr Holasek; +Cc: linux-numa, Cliff Wickman

On Mon, Dec 7, 2015 at 6:32 AM, Petr Holasek <pholasek@redhat.com> wrote:
> When calling numa_node_to_cpus on non-existing node number (e.g. for
> non-contiguous node numbers), a bit confusing warning is supressed. Since
> warnings are implemented as weak functions they cannot be overriden when
> using dlsym interface.
>
> Signed-off-by: Petr Holasek <pholasek@redhat.com>

Applied in 2.0.11

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-11 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07 14:32 [PATCH] libnuma: supress warnings for non-existing node Petr Holasek
2015-12-11 15:48 ` Filipe Brandenburger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).