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