User Tools

Site Tools


doc:appunti:linux:sa:linux_virtual_memory

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:linux_virtual_memory [2023/12/18 10:21] niccolodoc:appunti:linux:sa:linux_virtual_memory [2023/12/18 11:42] (current) – [Come rilasciare la cache] niccolo
Line 1: Line 1:
 ====== Linux Virtual Memory ====== ====== Linux Virtual Memory ======
 +
 +===== Diagnosi di Out of Memory Killer =====
 +
 +Come diagnosticare problemi //Out of Memory Killer//? Nel syslog si legge quanto segue:
 +
 +<code>
 +kernel: apache2 invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE),
 +        order=0, oom_score_adj=0
 +...
 +kernel: Mem-Info:
 +kernel: active_anon:31868 inactive_anon:3867772 isolated_anon:0
 +kernel:  active_file:196 inactive_file:169 isolated_file:0
 +kernel:  unevictable:3724 dirty:0 writeback:0
 +kernel:  slab_reclaimable:8784 slab_unreclaimable:23394
 +kernel:  mapped:32570 shmem:33575 pagetables:16400 bounce:0
 +kernel:  free:33008 free_pcp:981 free_cma:0
 +...
 +kernel: Tasks state (memory values in pages):
 +kernel: [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
 +kernel: [    279]       279    54600      891   462848        0          -250 systemd-journal
 +...
 +kernel: [2109336]    33 2109336    77411    14582   282624        0             0 apache2
 +kernel: [2109339]    33 2109339    76387    14063   274432        0             0 apache2
 +kernel: [2109340]    33 2109340    75360    12557   262144        0             0 apache2
 +...
 +kernel: Out of memory: Killed process 1102 (mariadbd) total-vm:2663252kB, anon-rss:429744kB,
 +        file-rss:0kB, shmem-rss:0kB, UID:106 pgtables:1172kB oom_score_adj:0
 +</code>
 +
 +Quindi una richiesta di allocazione memoria da parte del processo **apache2** ha causato il kill del processo **mariadbd**. Anche l'elenco dei processi //Tasks state// evidenzia la presenza di **151 processi** apache2.
 +
  
 <code> <code>
Line 20: Line 51:
 ^ Active(file)  | The amount of file cache memory, in kibibytes, that is in active use, or was in active use since the last time the system reclaimed memory.  | ^ Active(file)  | The amount of file cache memory, in kibibytes, that is in active use, or was in active use since the last time the system reclaimed memory.  |
  
 +===== Come rilasciare la cache =====
 +
 +Per rilasciare le **PageCache** si può usare il comando:
 +
 +<code>
 +sync; echo 1 > /proc/sys/vm/drop_caches
 +</code>
 +
 +Dovrebbero andare a zero diversi contatori, tra cui quello della **Active** memory.
 +
 +Il parametro **1** scritto nello pseudofile può assumere valori diversi, a seconda di cosa si voglia rilasciare:
  
 +^ 1  | Clears only the page cache.  |
 +^ 2  | Clears dentries and inodes.  |
 +^ 3  | Clears page cache, dentries, and inodes.  |
  
 ===== Web References ===== ===== Web References =====
Line 26: Line 71:
   * **[[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-meminfo|/proc/meminfo]]**   * **[[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-meminfo|/proc/meminfo]]**
   * **[[https://access.redhat.com/solutions/406773|Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux]]**   * **[[https://access.redhat.com/solutions/406773|Interpreting /proc/meminfo and free output for Red Hat Enterprise Linux]]**
 +  * **[[https://www.tecmint.com/clear-ram-memory-cache-buffer-and-swap-space-on-linux/|How to Clear RAM Memory Cache, Buffer and Swap Space on Linux]]**
  
doc/appunti/linux/sa/linux_virtual_memory.1702894866.txt.gz · Last modified: 2023/12/18 10:21 by niccolo