0

What is a most convenient way to set affinity mask for init process in linux (debian) on the startup the system?

I know about taskset, but i want set affinity mask for init on it's startup, so all processes will inherit it.

Thank you.

Boris
  • 121
  • 2
  • 6

3 Answers3

4

Try the "isolcpus" kernel boot arg. You can list the CPUs you want the scheduler to ignore; the CPUs not listed will effectively form a mask for init and all its children. You can then place a process on the ignored CPUs by running it via taskset.

1

What are you trying to accomplish by binding init and its child processess to a particular CPU? Is there another application that you wish to run in order to isolate system processes from application CPU resources? If so, you may want to look into establishing CPU shields. THe realtime Linux distributions have utilities available for this, but you could try the CPU Set (cset) utility outlined at:

https://rt.wiki.kernel.org/index.php/Cpuset_management_utility/tutorial

By default, creating a shield will place all of your processes in a single set, allowing you to define which important processes should move into later-defined sets.

Is this close to what you are looking for?

ewwhite
  • 197,159
  • 92
  • 443
  • 809
0

If you just want your machine to boot slower then try pulling some of the RAM out or nobble your hard disks to disable DMA.

Since init is the grand-daddy of every process on your system setting the affiinity at boot will mean that you set the affinity for every process - surely you want to be more selective than that?

Perhaps if you gave a bit more information about what you are trying to achieve by setting the affinity it might be possible to make a sensible answer.

symcbean
  • 21,009
  • 1
  • 31
  • 52
  • Yeah, I do agree — it seems asker doesn't know what he really needs. Also, nothing really makes him unable to set affinity masks for all processes later. – poige Mar 02 '11 at 12:44