⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fake-numa-for-cpusets

📁 linux 内核源代码
💻
字号:
Using numa=fake and CPUSets for Resource ManagementWritten by David Rientjes <rientjes@cs.washington.edu>This document describes how the numa=fake x86_64 command-line option can be usedin conjunction with cpusets for coarse memory management.  Using this feature,you can create fake NUMA nodes that represent contiguous chunks of memory andassign them to cpusets and their attached tasks.  This is a way of limiting theamount of system memory that are available to a certain class of tasks.For more information on the features of cpusets, see Documentation/cpusets.txt.There are a number of different configurations you can use for your needs.  Formore information on the numa=fake command line option and its various ways ofconfiguring fake nodes, see Documentation/x86_64/boot-options.txt.For the purposes of this introduction, we'll assume a very primitive NUMAemulation setup of "numa=fake=4*512,".  This will split our system memory intofour equal chunks of 512M each that we can now use to assign to cpusets.  Asyou become more familiar with using this combination for resource control,you'll determine a better setup to minimize the number of nodes you have to dealwith.A machine may be split as follows with "numa=fake=4*512," as reported by dmesg:	Faking node 0 at 0000000000000000-0000000020000000 (512MB)	Faking node 1 at 0000000020000000-0000000040000000 (512MB)	Faking node 2 at 0000000040000000-0000000060000000 (512MB)	Faking node 3 at 0000000060000000-0000000080000000 (512MB)	...	On node 0 totalpages: 130975	On node 1 totalpages: 131072	On node 2 totalpages: 131072	On node 3 totalpages: 131072Now following the instructions for mounting the cpusets filesystem fromDocumentation/cpusets.txt, you can assign fake nodes (i.e. contiguous memoryaddress spaces) to individual cpusets:	[root@xroads /]# mkdir exampleset	[root@xroads /]# mount -t cpuset none exampleset	[root@xroads /]# mkdir exampleset/ddset	[root@xroads /]# cd exampleset/ddset	[root@xroads /exampleset/ddset]# echo 0-1 > cpus	[root@xroads /exampleset/ddset]# echo 0-1 > memsNow this cpuset, 'ddset', will only allowed access to fake nodes 0 and 1 formemory allocations (1G).You can now assign tasks to these cpusets to limit the memory resourcesavailable to them according to the fake nodes assigned as mems:	[root@xroads /exampleset/ddset]# echo $$ > tasks	[root@xroads /exampleset/ddset]# dd if=/dev/zero of=tmp bs=1024 count=1G	[1] 13425Notice the difference between the system memory usage as reported by/proc/meminfo between the restricted cpuset case above and the unrestrictedcase (i.e. running the same 'dd' command without assigning it to a fake NUMAcpuset):				Unrestricted	Restricted	MemTotal:		3091900 kB	3091900 kB	MemFree:		  42113 kB	1513236 kBThis allows for coarse memory management for the tasks you assign to particularcpusets.  Since cpusets can form a hierarchy, you can create some prettyinteresting combinations of use-cases for various classes of tasks for yourmemory management needs.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -