public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] mm/lib: change count_numa() behavior
@ 2012-02-20 10:55 Caspar Zhang
  2012-02-20 12:21 ` [LTP] [PATCH 3/2] mm: fix possible node missing in write_cpusets Caspar Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Caspar Zhang @ 2012-02-20 10:55 UTC (permalink / raw)
  To: Zhouping Liu, LTP List

[-- Attachment #1: Type: text/plain, Size: 772 bytes --]


this patch fixes two problems.

1) avoid using functions from numactl package, so compilation would pass
w/ and w/o numactl development package installed.

2) count_numa() functions now has a parameter, which stores the array of
each nodes on the system. This is because some systems doesn't have
continuous nodes or the node sequence does not start from zero, when we
want to test specific node, we should make sure the node does exist.
Thus, an array for node numbers is necessary. Follow-up patches will
update count_numa() with new parameters accordingly.

Signed-off-by: Caspar Zhang <caspar@casparzhang.com>
---
 testcases/kernel/mem/include/mem.h |    2 +-
 testcases/kernel/mem/lib/mem.c     |   12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mm-lib-change-count_numa-behavior.patch --]
[-- Type: text/x-patch; name="0001-mm-lib-change-count_numa-behavior.patch", Size: 1212 bytes --]

diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index f86efab..d0d2507 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -58,7 +58,7 @@ void umount_mem(char *path, char *path_new);
 void mount_mem(char *name, char *fs, char *options, char *path, char *path_new);
 
 /* general function */
-long count_numa(void);
+long count_numa(long nodes[]);
 int  path_exist(const char *path, ...);
 long read_meminfo(char *item);
 void set_sys_tune(char *sys_file, long tune, int check);
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 6bfe0c1..c7188c2 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -707,16 +707,14 @@ void mount_mem(char *name, char *fs, char *options, char *path, char *path_new)
 
 /* general functions */
 
-long count_numa(void)
+long count_numa(long nodes[])
 {
-	int nnodes = 0;
-	int max_node;
-	int i;
+	long nnodes, i;
 
-	max_node = numa_max_node();
-	for(i = 0; i <= max_node; i++)
+	nnodes = 0;
+	for (i = 0; i <= MAXNODES; i++)
 		if(path_exist(PATH_SYS_SYSTEM "/node/node%d", i))
-			nnodes++;
+			nodes[nnodes++] = i;
 
 	return nnodes;
 }

[-- Attachment #3: Type: text/plain, Size: 377 bytes --]

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2012-02-21  2:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <bb215812-518c-4d08-971d-7ed628347f4b@zmail13.collab.prod.int.phx2.redhat.com>
2012-02-21  2:44 ` [LTP] [PATCH 3/2] mm: fix possible node missing in write_cpusets Caspar Zhang
2012-02-20 10:55 [LTP] [PATCH 1/2] mm/lib: change count_numa() behavior Caspar Zhang
2012-02-20 12:21 ` [LTP] [PATCH 3/2] mm: fix possible node missing in write_cpusets Caspar Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox