Allocating all task-/process-/user-specific swapping to a fixed pre-defined swap space

I don't know if this discussion has ever been raised.

Let's say that you have the following swap partitions defined (each on different physical devices of equal performance):

/DB001_S1 	none 		swap 	sw,pri=10 		0 	0
/DB003_S1	none 		swap 	sw,pri=50	 	0 	0
/DB005_S1 	none 		swap 	sw,pri=98	 	0 	0
/DB006_S1 	none 		swap 	sw,pri=99	 	0 	0

Let's also say that you have 4 critical processes, such as:

  • MariaDB service being accessed by query-intensive user-defined "canned procedures",
  • Software IDE for production code compiling,
  • Interactive Document Publishing software, such as Scribus, Inkscape, Sigil, LibreOffice Writer,
  • Interactive 3D-modelling CAD/CAM (Computer-Aided-Design/Computer-Aided-Manufacturing) software (FreeCAD, CATIA, Blender, etc.),

has it ever been considered that it might be advantageous to pre-define an environment variable that would specifically assign all swapping activities associated with each of those to a designated, pre-defined, swap space/partition, thereby hopefully enhancing the overall system's performance optimizations?

My feeble understanding of "cgroups" is such that the "devices" specification would not permit this level of control, since I would have the expectation that all software be installed on the ROOT device, therefore allowing that access to the device opens access to swap on that device as well, which is what I would like to prevent.

Also, the swap priority flag would indirectly control which process group would get serviced first, if access is limited to a designated swap space.

Comments and opinions?

4 Likes

As far as I know and understand, there is no way to configure per process swapping. They say, kernel have never merged per cgroup swapping proposal.

https://unix.stackexchange.com/questions/356202/have-a-private-swap-file-per-process

Nevertheless, it looks like one can configure swappiness ratio per cgroup
https://unix.stackexchange.com/questions/10214/how-to-set-per-process-swapiness-for-linux#10227

4 Likes