Skip to contentSkip to conversation

add libnuma_helper

PATCH Superseded Jan Stancek 2 participants 2 messages May 28, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 add libnuma_helper

A library to share NUMA helper functions shared by multiple testcases.

---
 testcases/kernel/syscalls/numa/Makefile          |   22 ++++
 testcases/kernel/syscalls/numa/Makefile.inc      |   27 +++++
 testcases/kernel/syscalls/numa/lib/Makefile      |   26 ++++
 testcases/kernel/syscalls/numa/lib/numa_helper.c |  135 ++++++++++++++++++++++
 testcases/kernel/syscalls/numa/lib/numa_helper.h |   34 ++++++
 5 files changed, 244 insertions(+), 0 deletions(-)
 create mode 100644 testcases/kernel/syscalls/numa/Makefile
 create mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
 create mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
 create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
 create mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
testcases/kernel/syscalls/numa/Makefile new file +22 -0
new file mode 100644
index 0000000..b38c5b2
@@ -0,0 +1,22 @@
+#
+#  Copyright (C) 2012 Linux Test Project, Inc.
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/syscalls/numa/Makefile.inc new file +27 -0
new file mode 100644
index 0000000..59c2f9e
@@ -0,0 +1,27 @@
+#
+#  Copyright (C) 2012 Linux Test Project, Inc.
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+CPPFLAGS		+= $(NUMA_CPPFLAGS) -I../numa/lib/
+LIBDIR			:= ../numa/lib
+LIB			:= $(LIBDIR)/libnuma_helper.a
+MAKE_DEPS		+= $(LIB)
+LDLIBS			+= $(NUMA_LIBS) -lnuma_helper -lltp
+LDFLAGS			+= -L$(LIBDIR)
+
+$(LIB): $(LIBDIR)
+		$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
testcases/kernel/syscalls/numa/lib/Makefile new file +26 -0
new file mode 100644
index 0000000..d4a6f41
@@ -0,0 +1,26 @@
+#
+#  Copyright (C) 2012 Linux Test Project, Inc.
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+top_srcdir		?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+CPPFLAGS		+= -I../../../include
+LIB			:= libnuma_helper.a
+
+include $(top_srcdir)/include/mk/lib.mk
testcases/kernel/syscalls/numa/lib/numa_helper.c new file +135 -0

135 lines not on this page · raw message

testcases/kernel/syscalls/numa/lib/numa_helper.h new file +34 -0
new file mode 100644
index 0000000..73b6513
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Linux Test Project, Inc.
+ *
+ * This program is free software;  you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program;  if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef NUMA_HELPER_H
+#define NUMA_HELPER_H
+
+#include "config.h"
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+#if HAVE_NUMAIF_H
+#include <numaif.h>
+#endif
+
+int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes);
+int get_allowed_nodes(int count, ...);
+
+#endif
+

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 5 lines · Jan Stancek

A library to share NUMA helper functions shared by multiple testcases.

One comment...

+ tst_resm(TFAIL, "get_allowed_nodes, i >= num_allowed_nodes: "
+ "%d > %d", i, num_nodes);

1. I would just remove this because it's obvious from the API definition what's going on when it sets ret to -3.
2. I would add a break there so it doesn't iterate through the loop more than necessary.

Cheers,
-Garrett

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list