Home | History | Annotate | Download | only in memory_hotplug
      1 Memtoy  - a toy [tool] for performing various memory
      2 operations [mapping, protection, faulting] for investigating
      3 vm behavior.
      4 
      5 N.B., migrate command depends on Ray Bryant's "Manual Page Migration"
      6       patches, atop the Memory Hotplug page migration patches.
      7 
      8 May be run interactively or from a script [see ./test*].
      9 
     10 Use 'help' command interactively, or, e.g.,
     11 
     12 	echo help | ./memtoy
     13 
     14 
     15 Supported commands [augmented help]:
     16 
     17 quit           - just what you think
     18 	EOF on stdin has the same effect
     19 
     20 help           - show this help
     21 help <command> - display help for just <command>
     22 
     23 pid            - show process id of this session
     24 
     25 pause          - pause program until signal -- e.g., INT, USR1
     26 
     27 numa          - display numa info as seen by this program.
     28 	shows nodes from which program may allocate memory
     29 	with total and free memory.
     30 
     31 migrate <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 
     39 show [<name>]  - show info for segment[s]; default all
     40 
     41 anon <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 
     45 file <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 
     51 shm <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 
     56 remove <seg-name> [<seg-name> ...] - remove the named segment[s]
     57 
     58 map <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 
     65 unmap <seg-name> - unmap specified segment, but remember name/size/...
     66 
     67 touch <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 
     72 mbind <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 
     80 where <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 
     86 Note:  to recognize the optional offset and length args, they must
     87 start with a digit.  This is required anyway because the strings are
     88 converted using strtoul() with a zero 'base' argument.  So, hex args
     89 must always start with '0x'...
     90 
     91 
     92