tech:memoire_linux
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:memoire_linux [2026/06/23 00:45] – Jean-Baptiste | tech: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:// | * https:// | ||
| * https:// | * https:// | ||
| + | * https:// | ||
| * / | * / | ||
| * procmap | * procmap | ||
| * pmap | * pmap | ||
| - | * smem | ||
| * lsmem / chmem | * lsmem / chmem | ||
| * https:// | * https:// | ||
| * slabtop | * slabtop | ||
| * memstrack | * memstrack | ||
| + | * smem - memory reporting tool | ||
| + | * smemcap - data collection tool for memory reporting | ||
| + | * smemstat - memory usage monitoring tool | ||
| + | * SLAB / SLUB / SLOB | ||
| + | |||
| + | |||
| + | Linux Memory Management : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * [Vidéo - The Linux Foundation - Introduction à la gestion de la mémoire sous Linux ](https:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Exemples : | ||
| + | * http:// | ||
| Ligne 158: | 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 172: | Ligne 196: | ||
| ps -eo comm, | ps -eo comm, | ||
| ~~~ | ~~~ | ||
| + | |||
| + | |||
| ~~~bash | ~~~bash | ||
| Ligne 244: | Ligne 270: | ||
| + | |||
| + | ----------------- | ||
| + | |||
| + | * https:// | ||
| + | Overcommit Memory | ||
| + | Overcommit Accounting | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | |||
| + | 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 / | ||
| + | |||
| + | A la place de overcommit_ratio | ||
| + | Il est possible d' | ||
| + | |||
| + | |||
| + | OOM | ||
| + | ~~~bash | ||
| + | echo -1000 > / | ||
| + | |||
| + | cat / | ||
| + | echo -1000 > / | ||
| + | ~~~ | ||
| + | |||
| + | Or in a specific cgroup, set oom_kill_disable to 1. | ||
| + | ~~~bash | ||
| + | echo 1000 > / | ||
| + | ~~~ | ||
| + | |||
| + | For systemd services, use `OOMScoreAdjust=-1000` in the unit file to protect critical processes. | ||
| + | `cgroup_enable=memory swapaccount=1` | ||
| + | |||
| + | ~~~ | ||
| + | $ echo $(($(cat / | ||
| + | 11389 MB | ||
| + | $ cat / | ||
| + | ~~~ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | 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, | ||
| + | |||
| + | 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:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * [Change in swap behavior between RHEL 7 and RHEL 8 kernels](https:// | ||
tech/memoire_linux.1782168308.txt.gz · Dernière modification : de Jean-Baptiste
