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

**URL:** <https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121>\
**Category:** Rocky Linux Help & Support\
**Created:** [December 11, 2023, 5:22am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121 "2023-12-11T05:22:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![az1minami](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@az1minami](https://forums.rockylinux.org/u/az1minami)\
**Post date:** [December 11, 2023, 5:22am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/1 "2023-12-11T05:22:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![label](https://avatars.discourse-cdn.com/v4/letter/l/c5a1d2/32.png) [@label](https://forums.rockylinux.org/u/label)\
**Post date:** [December 11, 2023, 6:42am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/2 "2023-12-11T06:42:01Z")

</div>

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.

```auto
$ 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).

```auto
$ 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.

---

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [December 11, 2023, 8:18am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/3 "2023-12-11T08:18:07Z")

</div>

CentOS9 Stream is even 60:

```auto
[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.

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 11, 2023, 8:31am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/4 "2023-12-11T08:31:41Z")

</div>

> [@label](#):
>
> 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.

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”.

---

<div class="post-metadata">

**Author:** ![iwalker](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/iwalker/32/2599_2.png) [@iwalker](https://forums.rockylinux.org/u/iwalker)\
**Post date:** [December 11, 2023, 8:59am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/5 "2023-12-11T08:59:04Z")

</div>

> [@jlehtone](#):
>
> The `tuned.service` is a possible candidate.

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

```auto
[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.

---

<div class="post-metadata">

**Author:** ![az1minami](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@az1minami](https://forums.rockylinux.org/u/az1minami)\
**Post date:** [December 13, 2023, 9:10am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/6 "2023-12-13T09:10:02Z")

</div>

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&nbsp;Hat Enterprise&nbsp;Linux 8 | Red Hat Customer Portal](https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/virtual-memory-parameters_configuring-an-operating-system-to-optimize-memory-access))

---

<div class="post-metadata">

**Author:** ![jlehtone](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@jlehtone](https://forums.rockylinux.org/u/jlehtone)\
**Post date:** [December 13, 2023, 11:38am UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/7 "2023-12-13T11:38:23Z")

</div>

Same page in english:

> **[Chapter 35. Configuring an operating system to optimize memory...](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/configuring-an-operating-system-to-optimize-memory-access_monitoring-and-managing-system-status-and-performance#virtual-memory-parameters_configuring-an-operating-system-to-optimize-memory-access)**
>
> Access Red Hat’s knowledge, guidance, and support through your subscription.

> 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](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html-single/performance_tuning_guide/index#sect-Red_Hat_Enterprise_Linux-Performance_Tuning_Guide-Configuring_system_memory_capacity-Virtual_Memory_parameters)

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

RHEL 9 [Chapter&nbsp;37.&nbsp;Configuring an operating system to optimize memory access Red Hat Enterprise Linux 9 | Red Hat Customer Portal](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/monitoring_and_managing_system_status_and_performance/configuring-an-operating-system-to-optimize-memory-access_monitoring-and-managing-system-status-and-performance#virtual-memory-parameters_configuring-an-operating-system-to-optimize-memory-access)

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

* * *

RHEL 8 TuneD: [Chapter&nbsp;2.&nbsp;Getting started with TuneD Red Hat Enterprise Linux 8 | Red Hat Customer Portal](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/monitoring_and_managing_system_status_and_performance/getting-started-with-tuned_monitoring-and-managing-system-status-and-performance)

* * *

Red Hat explains swappiness in:

> **[What does swappiness do and how does it affect swap\_tendency? - Red Hat...](https://access.redhat.com/solutions/103833)**
>
> What does swappiness do and how does it affect swap\_tendency?

---

<div class="post-metadata">

**Author:** ![az1minami](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@az1minami](https://forums.rockylinux.org/u/az1minami)\
**Post date:** [December 13, 2023, 1:23pm UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/8 "2023-12-13T13:23:38Z")

</div>

lots of Thanks! to Jlehtone  
/minami

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [February 11, 2024, 1:23pm UTC](https://forums.rockylinux.org/t/rng-the-range-of-swapness-0-100-or-0-200/12121/9 "2024-02-11T13:23:57Z")

</div>

Closed on February 11, 2024, 1:23pm UTC

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