Outils pour utilisateurs

Outils du site


tech:memoire_linux

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:memoire_linux [2026/08/01 23:15] Jean-Baptistetech:memoire_linux [2026/09/18 10:19] (Version actuelle) Jean-Baptiste
Ligne 6: Ligne 6:
 Voir : Voir :
 * [[Supervision - sonde Nagios - Memoire Linux]] * [[Supervision - sonde Nagios - Memoire Linux]]
 +* psacct [[Suivre la conso CPU par utilisateurs]]
 * https://linuxblog.io/free-vs-available-memory-in-linux/ * https://linuxblog.io/free-vs-available-memory-in-linux/
 * https://en.pingcap.com/blog/linux-kernel-vs-memory-fragmentation-2/ * https://en.pingcap.com/blog/linux-kernel-vs-memory-fragmentation-2/
Ligne 23: Ligne 24:
  
 Linux Memory Management : Linux Memory Management :
 +* https://fr.wikipedia.org/wiki/Gestionnaire_de_m%C3%A9moire_virtuelle
 * https://lambdafunc.medium.com/linux-memory-management-2c13b5e386f1 * https://lambdafunc.medium.com/linux-memory-management-2c13b5e386f1
 * https://zedas.fr/posts/linux-explained-7-memory-management/ * https://zedas.fr/posts/linux-explained-7-memory-management/
Ligne 30: Ligne 32:
 * https://www.youtube.com/watch?v=Gpm2-ktMLWs * https://www.youtube.com/watch?v=Gpm2-ktMLWs
 * https://www.youtube.com/watch?v=A9WLYbE0p-I * https://www.youtube.com/watch?v=A9WLYbE0p-I
 +* https://docs.kernel.org/mm/page_tables.html
  
 +Exemples : 
 +* http://shtroumbiniouf.free.fr/CoursInfo/Systeme2/Cours/GestionMemoire/PageFault/PageFault.html#DebutPage
  
  
Ligne 174: Ligne 178:
             - memCached // free = total - used             - memCached // free = total - used
 ~~~ ~~~
 +
 +
  
 ## Exemple ## Exemple
  
 +Voir psacct [[Suivre la conso CPU par utilisateurs]]
  
 ~~~bash ~~~bash
 free -mt free -mt
 +ps aux --sort=-%mem | head -n 11
 vmstat -SM 45 10 vmstat -SM 45 10
 vmstat -SM -a 45 10 vmstat -SM -a 45 10
Ligne 188: Ligne 196:
 ps -eo comm,pcpu,pmem,rss --sort rss | tail -n 30 | tac ps -eo comm,pcpu,pmem,rss --sort rss | tail -n 30 | tac
 ~~~ ~~~
 +
 +
  
 ~~~bash ~~~bash
Ligne 260: Ligne 270:
  
  
 +
 +-----------------
 +
 +* https://www.postgresql.org/docs/current/kernel-resources.html
 +Overcommit Memory
 +Overcommit Accounting
 +
 +Voir :
 +* https://clickhouse.com/blog/strict-memory-overcommit-for-postgres
 +
 +vm.overcommit_memory=0 
 +Default
 +Heuristic overcommit handling
 +
 +vm.overcommit_memory=1
 +Always overcommit. Appropriate for some scientific applications. Classic example is code using sparse arrays and just relying on the virtual memory consisting almost entirely of zero pages.
 +
 +vm.overcommit_memory=2
 +Strict
 +setting vm.overcommit_memory=2 
 +DOES allow overcommit. If you set overcommit_ratio to (say) 200, then memory can be committed to the extent of swap +(RAM * 200/100).
 +
 +The current overcommit limit and amount committed are viewable in /proc/meminfo as CommitLimit and Committed_AS 
 +
 +A la place de overcommit_ratio
 +Il est possible d'utiliser vm.overcommit_kbytes
 +
 +
 +OOM
 +~~~bash
 +echo -1000 > /proc/self/oom_score_adj
 +
 +cat /proc/<pid>/oom_score
 +echo -1000 > /proc/<pid>/oom_score_adj # protect from OOM kill
 +~~~
 +
 +Or in a specific cgroup, set oom_kill_disable to 1.
 +~~~bash
 +echo 1000 > /proc/<pid>/oom_score_adj # mark as first target
 +~~~
 +
 +For systemd services, use `OOMScoreAdjust=-1000` in the unit file to protect critical processes.
 +`cgroup_enable=memory swapaccount=1`
 +
 +~~~
 +$ echo $(($(cat /sys/fs/cgroup/memory/memory.max_usage_in_bytes) / 2**20)) MB
 +11389 MB
 +$ cat /sys/fs/cgroup/memory/memory.stat
 +~~~
 +
 +----
 +
 +OOM is not invoked when memory.high is reached.
 +However, if cgroup memory.max is reached then OOM is invoked.
 +TLB hit TLB miss
 +
 +~~~bash
 +sudo perf stat -e dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses -a sleep 60
 +
 +perf list | grep -i tlb
 +~~~
 +
 +Slub
 +~~~bash
 +slabtop --sort=1
 +~~~
 +
 +~~~bash
 +slabinfo -v
 +~~~
 +
 +access.redhat.com/
 +page_owner=on
 +
 +
 +## Premature swapping while there is still plenty of pagecache to be reclaimed 
 +
 +Cgroup v1
 +
 +  * https://access.redhat.com/solutions/6785021
 +  * https://fatdba.com/2025/12/12/when-linux-swaps-away-my-sleep-mysql-rhel8-and-the-curious-case-of-high-swap-usage/
 +  * https://docs.couchbase.com/server/current/install/install-swap-space.html
 +  * https://support.axway.com/kb/192440/language/en
 +  * https://communities.sas.com/t5/Administration-and-Deployment/Red-Hat-RHEL-8-Release-Swappiness-Algorithm-Setting-Requires/td-p/921008
 +  * https://docs.acceldata.io/odp/documentation/troubleshooting-premature-swapping
 +  * [Change in swap behavior between RHEL 7 and RHEL 8 kernels](https://access.redhat.com/solutions/7042476)
  
  
tech/memoire_linux.1785618915.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki