File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
benchmark/basic_performance/build/cache_test/misc/numa_info Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ obj-m += numa_info.o
2+
3+ all :
4+ @echo " Building kernel module..."
5+ make -C /lib/modules/$(shell uname -r) /build M=$(PWD ) modules
6+ @echo " Checking if numa_info module is loaded..."
7+ @if lsmod | grep -q numa_info; then \
8+ echo " Unloading existing numa_info module..." ; \
9+ sudo rmmod numa_info; \
10+ fi
11+ @echo " Loading numa_info module..."
12+ sudo insmod numa_info.ko
13+ @echo " Checking kernel logs for numa_info_init..."
14+ sudo dmesg | grep numa_info_init
15+
16+ clean :
17+ @echo " Cleaning up..."
18+ make -C /lib/modules/$(shell uname -r) /build M=$(PWD ) clean
19+ @echo " Checking if numa_info module is loaded..."
20+ @if lsmod | grep -q numa_info; then \
21+ echo " Unloading numa_info module..." ; \
22+ sudo rmmod numa_info; \
23+ fi
Original file line number Diff line number Diff line change 1+ #include <linux/module.h>
2+ #include <linux/kernel.h>
3+ #include <linux/init.h>
4+ #include <linux/numa.h>
5+
6+ static int __init numa_info_init (void )
7+ {
8+ int i , online_numa_node_count ;
9+ unsigned long long node_start_t , node_end_t ;
10+
11+ online_numa_node_count = num_online_nodes ();
12+ pr_info ("%s: Total online NUMA nodes: %d\n" , __func__ , online_numa_node_count );
13+
14+ for (i = 0 ; i < online_numa_node_count ; i ++ ) {
15+ node_start_t = (unsigned long long )node_start_pfn (i ) << PAGE_SHIFT ;
16+ node_end_t = (unsigned long long )node_end_pfn (i ) << PAGE_SHIFT ;
17+ pr_info ("%s: NUMA node [%d] start [0x%llx] end [0x%llx]\n" ,
18+ __func__ , i , node_start_t , node_end_t );
19+ }
20+
21+ return 0 ;
22+ }
23+
24+ static void __exit numa_info_exit (void )
25+ {
26+ pr_info ("%s: Module unloaded\n" , __func__ );
27+ }
28+
29+ module_init (numa_info_init );
30+ module_exit (numa_info_exit );
31+
32+ MODULE_LICENSE ("GPL" );
33+ MODULE_AUTHOR ("CXL_Perf" );
34+ MODULE_DESCRIPTION ("Print NUMA node physical address ranges" );
You can’t perform that action at this time.
0 commit comments