• Home
Name Date Size #Lines LOC

..--

Scripts/03-May-2024-239225

Xpm-tests/03-May-2024-380359

.gitignoreD03-May-20248 21

COPYINGD03-May-202417.6 KiB343282

MakefileD03-May-20241.2 KiB378

READMED03-May-20243.4 KiB9266

TODOD03-May-2024588 3016

commands.cD03-May-202428.6 KiB1,244853

debug.hD03-May-20241.5 KiB6226

memtoy.cD03-May-20248.9 KiB504314

memtoy.hD03-May-20242.9 KiB10847

segment.cD03-May-202420.8 KiB972647

segment.hD03-May-20241.7 KiB6527

version.hD03-May-2024898 261

README

1Memtoy  - a toy [tool] for performing various memory
2operations [mapping, protection, faulting] for investigating
3vm behavior.
4
5N.B., migrate command depends on Ray Bryant's "Manual Page Migration"
6      patches, atop the Memory Hotplug page migration patches.
7
8May be run interactively or from a script [see ./test*].
9
10Use 'help' command interactively, or, e.g.,
11
12	echo help | ./memtoy
13
14
15Supported commands [augmented help]:
16
17quit           - just what you think
18	EOF on stdin has the same effect
19
20help           - show this help
21help <command> - display help for just <command>
22
23pid            - show process id of this session
24
25pause          - pause program until signal -- e.g., INT, USR1
26
27numa          - display numa info as seen by this program.
28	shows nodes from which program may allocate memory
29	with total and free memory.
30
31migrate <to-node-id[s]> [<from-node-id[s]>] -
32	migrate this process' memory from <from-node-id[s]>
33	to <to-node-id[s]>.  Specify multiple node ids as a
34	comma-separated list.  If both to and from nodes are
35	specified, the sets must have the same # of nodes,
36	and must not intersect.  If <from-node-id[s]> is
37	omitted, <to-node-id[s]> must specify a single node.
38
39show [<name>]  - show info for segment[s]; default all
40
41anon <seg-name> <seg-size>[k|m|g|p] [<seg-share>] -
42	define a MAP_ANONYMOUS segment of specified size
43	<seg-share> := private|shared - default = private
44
45file <pathname> [<offset>[k|m|g|p] <length>[k|m|g|p]] [<seg-share>] -
46	define a mapped file segment of specified length starting at the
47	specified offset into the file.  <offset> and <length> may be
48	omitted and specified on the map command.
49	<seg-share> := private|shared - default = private
50
51shm <seg-name> <seg-size>[k|m|g|p] -
52	define a shared memory segment of specified size.
53	You may need to increase limits [/proc/sys/kernel/shmmax].
54	Use map/unmap to attach/detach
55
56remove <seg-name> [<seg-name> ...] - remove the named segment[s]
57
58map <seg-name> [<offset>[k|m|g|p] <length>[k|m|g|p]] [<seg-share>] -
59	mmap()/shmat() a previously defined, currently unmapped() segment.
60	<offset> and <length> apply only to mapped files.
61	Use <length> of '*' or '0' to map to the end of the file.
62	Offset and length specified here override those specified on
63	the file command.
64
65unmap <seg-name> - unmap specified segment, but remember name/size/...
66
67touch <seg-name> [<offset>[k|m|g|p] <length>[k|m|g|p]] [read|write] -
68	read [default] or write the named segment from <offset> through
69	<offset>+<length>.  If <offset> and <length> omitted, touches all
70	 of mapped segment.
71
72mbind <seg-name> [<offset>[k|m|g|p] <length>[k|m|g|p]]
73      <policy> [<node/list>] -
74	set the numa policy for the specified range of the name segment
75	to policy --  one of {default, bind, preferred, interleaved}.
76	<node/list> specifies a node id or a comma separated list of
77	node ids.  <node> is ignored for 'default' policy, and only
78	the first node is used for 'preferred' policy
79
80where <seg-name> [<offset>[k|m|g|p] <length>[k|m|g|p]] -
81	show the node location of pages in the specified range
82	of the specified segment.  <offset> defaults to start of
83	segment; <length> defaults to 64 pages.
84	Use SIGINT to interrupt a long display.
85
86Note:  to recognize the optional offset and length args, they must
87start with a digit.  This is required anyway because the strings are
88converted using strtoul() with a zero 'base' argument.  So, hex args
89must always start with '0x'...
90
91
92