Memtoy - a toy [tool] for performing various memory operations [mapping, protection, faulting] for investigating vm behavior. N.B., migrate command depends on Ray Bryant's "Manual Page Migration" patches, atop the Memory Hotplug page migration patches. May be run interactively or from a script [see ./test*]. Use 'help' command interactively, or, e.g., echo help | ./memtoy Supported commands [augmented help]: quit - just what you think EOF on stdin has the same effect help - show this help help - display help for just pid - show process id of this session pause - pause program until signal -- e.g., INT, USR1 numa - display numa info as seen by this program. shows nodes from which program may allocate memory with total and free memory. migrate [] - migrate this process' memory from to . Specify multiple node ids as a comma-separated list. If both to and from nodes are specified, the sets must have the same # of nodes, and must not intersect. If is omitted, must specify a single node. show [] - show info for segment[s]; default all anon [k|m|g|p] [] - define a MAP_ANONYMOUS segment of specified size := private|shared - default = private file [[k|m|g|p] [k|m|g|p]] [] - define a mapped file segment of specified length starting at the specified offset into the file. and may be omitted and specified on the map command. := private|shared - default = private shm [k|m|g|p] - define a shared memory segment of specified size. You may need to increase limits [/proc/sys/kernel/shmmax]. Use map/unmap to attach/detach remove [ ...] - remove the named segment[s] map [[k|m|g|p] [k|m|g|p]] [] - mmap()/shmat() a previously defined, currently unmapped() segment. and apply only to mapped files. Use of '*' or '0' to map to the end of the file. Offset and length specified here override those specified on the file command. unmap - unmap specified segment, but remember name/size/... touch [[k|m|g|p] [k|m|g|p]] [read|write] - read [default] or write the named segment from through +. If and omitted, touches all of mapped segment. mbind [[k|m|g|p] [k|m|g|p]] [] - set the numa policy for the specified range of the name segment to policy -- one of {default, bind, preferred, interleaved}. specifies a node id or a comma separated list of node ids. is ignored for 'default' policy, and only the first node is used for 'preferred' policy where [[k|m|g|p] [k|m|g|p]] - show the node location of pages in the specified range of the specified segment. defaults to start of segment; defaults to 64 pages. Use SIGINT to interrupt a long display. Note: to recognize the optional offset and length args, they must start with a digit. This is required anyway because the strings are converted using strtoul() with a zero 'base' argument. So, hex args must always start with '0x'...