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