Rng the range of swapness. 0-100 or 0-200

Rng the range of swapness.
I see descriptions of 0-100 and 0-200.egardi

The old CentOS7 is set to 30, and RockyLinux9.3 is set to 60.
If the CentOS range is 0-100, then RockyLinux of 60 would be considered the same value. It’s probably the default value.

It seems that there was a range change in redhat, what do you think?
Is there a note in the source that says you changed 0-100 to 0-200?

The default has been 60 for a long time. You could even go back to RHEL 5 and find the default was 60. There’s even Red Hat documentation dating back to the RHEL 5 days that points out this default.

Here’s the kernel source, straight from github.

$ grep vm_swappiness mm/vmscan.c
int vm_swappiness = 60;

That tells me the default is 60. In fact below shows an initial git repository build commit, that omits just about all history predating this commit, from 2005 (see tag v2.6.12-rc2).

$ git blame mm/vmscan.c | grep vm_swappiness
Blaming lines: 100% (7458/7458), done.
^1da177e4c3f4 (Linus Torvalds          2005-04-16 15:20:36 -0700  188) int vm_swappiness = 60;

Even the systemd sources from CentOS 7, which drops down default sysctl files, doesn’t mention swappiness. So I’m not sure where you got “30” from.

I’m not sure what you mean by “range change”. If there is need a static range (e.g. you cannot go over 100), this is also likely something dictated by the kernel developers. It may have been always possible to set 200, but it may not actually do anything useful beyond 100 in older kernels, hence why documentation has always said 0-100.

CentOS9 Stream is even 60:

[ian@c9s ~]$ cat /proc/sys/vm/swappiness 
60

so I doubt very much that previous versions were anything less unless customised by the person who installed. Either that, or some app installed on it has configured it differently - can be known to happen.

The tuned.service is a possible candidate.

I have configured my el9 hosts with Ansible and can’t find any non-default config for tuned nor swappiness from the play.
On my el9 Gnome desktops tuned has apparently stopped couple seconds after start and swappiness remains 60.
On el9 MATE desktops tuned runs and swappiness is not 60 (profile “throughput-performance”).
All VM’s (el7-el9) seem to have swappiness 30 (profile “virtual-guest”).

The swappiness is 30 on el7 host that has tuned profile “desktop”.

1 Like

@jlehtone is spot on here. Confirmed on my CentOS 9 Stream install, was 60 before install, after it was 30.

[root@c9s ian]# dnf install tuned
Updating Subscription Management repositories.
BaseOS                                           32 kB/s | 3.9 kB     00:00    
AppStream                                        41 kB/s | 4.4 kB     00:00    
Extras-Common                                    26 kB/s | 3.0 kB     00:00    
CRB                                              38 kB/s | 4.3 kB     00:00    
EPEL 9                                           19 kB/s | 2.3 kB     00:00    
Dependencies resolved.
================================================================================
 Package              Arch   Version        Repository                     Size
================================================================================
Installing:
 tuned                noarch 2.21.0-1.el9   UpWare_CentOS_Stream_9_BaseOS 395 k
Installing dependencies:
 hdparm               x86_64 9.62-2.el9     UpWare_CentOS_Stream_9_BaseOS  96 k
 libtraceevent        x86_64 1.5.3-3.el9    UpWare_CentOS_Stream_9_BaseOS 251 k
 polkit               x86_64 0.117-11.el9   UpWare_CentOS_Stream_9_BaseOS 154 k
 polkit-libs          x86_64 0.117-11.el9   UpWare_CentOS_Stream_9_BaseOS 8.3 M
 polkit-pkla-compat   x86_64 0.1-21.el9     UpWare_CentOS_Stream_9_BaseOS  47 k
 python3-linux-procfs noarch 0.7.3-1.el9    UpWare_CentOS_Stream_9_BaseOS  31 k
 python3-perf         x86_64 5.14.0-390.el9 UpWare_CentOS_Stream_9_BaseOS 5.7 M
 python3-pyudev       noarch 0.22.0-6.el9   UpWare_CentOS_Stream_9_BaseOS  90 k

Transaction Summary
================================================================================
Install  9 Packages

Total download size: 15 M
Installed size: 32 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): libtraceevent-1.5.3-3.el9.x86_64.rpm     2.5 MB/s | 251 kB     00:00    
(2/9): polkit-0.117-11.el9.x86_64.rpm           1.3 MB/s | 154 kB     00:00    
(3/9): hdparm-9.62-2.el9.x86_64.rpm             707 kB/s |  96 kB     00:00    
(4/9): polkit-pkla-compat-0.1-21.el9.x86_64.rpm 670 kB/s |  47 kB     00:00    
(5/9): python3-linux-procfs-0.7.3-1.el9.noarch. 546 kB/s |  31 kB     00:00    
(6/9): polkit-libs-0.117-11.el9.x86_64.rpm       37 MB/s | 8.3 MB     00:00    
(7/9): python3-pyudev-0.22.0-6.el9.noarch.rpm   671 kB/s |  90 kB     00:00    
(8/9): python3-perf-5.14.0-390.el9.x86_64.rpm    25 MB/s | 5.7 MB     00:00    
(9/9): tuned-2.21.0-1.el9.noarch.rpm            4.3 MB/s | 395 kB     00:00    
--------------------------------------------------------------------------------
Total                                            35 MB/s |  15 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : polkit-libs-0.117-11.el9.x86_64                        1/9 
  Running scriptlet: polkit-0.117-11.el9.x86_64                             2/9 
  Installing       : polkit-0.117-11.el9.x86_64                             2/9 
  Running scriptlet: polkit-0.117-11.el9.x86_64                             2/9 
  Installing       : polkit-pkla-compat-0.1-21.el9.x86_64                   3/9 
  Installing       : python3-pyudev-0.22.0-6.el9.noarch                     4/9 
  Installing       : python3-linux-procfs-0.7.3-1.el9.noarch                5/9 
  Installing       : libtraceevent-1.5.3-3.el9.x86_64                       6/9 
  Installing       : python3-perf-5.14.0-390.el9.x86_64                     7/9 
  Installing       : hdparm-9.62-2.el9.x86_64                               8/9 
  Installing       : tuned-2.21.0-1.el9.noarch                              9/9 
  Running scriptlet: tuned-2.21.0-1.el9.noarch                              9/9 
Created symlink /etc/systemd/system/multi-user.target.wants/tuned.service → /usr/lib/systemd/system/tuned.service.

  Verifying        : hdparm-9.62-2.el9.x86_64                               1/9 
  Verifying        : libtraceevent-1.5.3-3.el9.x86_64                       2/9 
  Verifying        : polkit-0.117-11.el9.x86_64                             3/9 
  Verifying        : polkit-libs-0.117-11.el9.x86_64                        4/9 
  Verifying        : polkit-pkla-compat-0.1-21.el9.x86_64                   5/9 
  Verifying        : python3-linux-procfs-0.7.3-1.el9.noarch                6/9 
  Verifying        : python3-perf-5.14.0-390.el9.x86_64                     7/9 
  Verifying        : python3-pyudev-0.22.0-6.el9.noarch                     8/9 
  Verifying        : tuned-2.21.0-1.el9.noarch                              9/9 
Installed products updated.

Installed:
  hdparm-9.62-2.el9.x86_64              libtraceevent-1.5.3-3.el9.x86_64        
  polkit-0.117-11.el9.x86_64            polkit-libs-0.117-11.el9.x86_64         
  polkit-pkla-compat-0.1-21.el9.x86_64  python3-linux-procfs-0.7.3-1.el9.noarch 
  python3-perf-5.14.0-390.el9.x86_64    python3-pyudev-0.22.0-6.el9.noarch      
  tuned-2.21.0-1.el9.noarch            

Complete!

[root@c9s ian]# systemctl restart tuned

[root@c9s ian]# tuned-adm active
Current active profile: virtual-guest

[root@c9s ian]# cat /proc/sys/vm/swappiness 
30

without tuned, the default is 60.

Thanks information .
my post swapness renge 0-200 is this web page , i looked .
Sorry japanese. but same as Red hat english page? " swappiness 値 (0 から 200 まで) は、"

regrds!
/minami

[35.3. 仮想メモリーパラメーター Red Hat Enterprise Linux 8 | Red Hat Customer Portal]

(35.3. 仮想メモリーパラメーター Red Hat Enterprise Linux 8 | Red Hat Customer Portal)

Same page in english:

The swappiness value, ranging from 0 to 200, controls the degree to which the system favors reclaiming memory from the anonymous memory pool, or the page cache memory pool.

Setting the swappiness parameter’s value:

Higher values favor file-mapped driven workloads while swapping out the less actively accessed processes’ anonymous mapped memory of RAM. This is useful for file-servers or streaming applications that depend on data, from files in the storage, to reside on memory to reduce I/O latency for the service requests.

Low values favor anonymous-mapped driven workloads while reclaiming the page cache (file mapped memory). This setting is useful for applications that do not depend heavily on the file system information, and heavily utilize dynamically allocated and private memory, such as mathematical and number crunching applications, and few hardware virtualization supervisors like QEMU.

The default value of the vm.swappiness parameter is 60.

There is also note that swappiness could be set per cgroup i.e. not same for all processes.


RHEL 7 Performance Tuning Guide Red Hat Enterprise Linux 7 | Red Hat Customer Portal

The swappiness value, ranging from 0 to 100 … default is 60.

RHEL 9 Chapter 37. Configuring an operating system to optimize memory access Red Hat Enterprise Linux 9 | Red Hat Customer Portal

The swappiness value, ranging from 0 to 200 … default is 60.


RHEL 8 TuneD: Chapter 2. Getting started with TuneD Red Hat Enterprise Linux 8 | Red Hat Customer Portal


Red Hat explains swappiness in:

lots of Thanks! to Jlehtone
/minami

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.