K
K
kaktak2552021-07-14 15:12:51
linux
kaktak255, 2021-07-14 15:12:51

The swap file does not respond to swappiness settings, what should I do?

nano /proc/sys/vm/swappiness and there I write 60
the swap file starts working when the RAM is clogged up to 99%, okay
nano /proc/sys/vm/swappiness and there I write 10 the
swap file starts working again only when the RAM is clogged up to 99 % , what?
Why has nothing changed?

RAM 8GB, swap also 8GB I

checked the loading of the RAM and how the swap is loaded into the file like this (I almost don’t know the pros):

#include <iostream>
#include <unistd.h>
using namespace std;

int main()
{
  int len = 1'290'000'000;

  int *a = new int[len];
  //просто заполняю массив чтоб забить оперативку до упора и чучуть больше
  for(int x = 0 ; x < len ; ++x)
  {
    a[x] = 1;
  }
  cout << "pause ...." << endl; 
  
  //тут просто 20 сек жду что бы чекать колво оперативки и когда начинает работать файл подкачки
  for(int j = 0 ;  j < 20 ; ++j)
  {
    
    cout << j << endl;
    sleep(1);
  }

  //тут просто так) 
  cout << "sdasdadsasdasdasdasdasd" << endl;
  return 0;


}


linux debian 10 cinnamon

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2021-07-14
@gbg

And why did you decide that the value of 10 should increase the desire of the kernel to use the swap? This is a common misconception.
The more swapiness, the more the kernel will want to swap the page. This is not the percentage of RAM that the type should take up before the core starts swapping.
The default value is 60, the maximum is 100.

D
Damian Lewis, 2021-07-14
@DamianLewis

Did you restart your computer after completing the operations? For the changes to take effect, you need to reboot or run from under the current system:

sudo swapoff -a
sudo swapon -a

The process from under the included system will be long, it is better to reboot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question