Submit Search
Upload
Memory management in Linux
•
78 likes
•
46,784 views
Raghu Udiyar
Follow
A brief overview of the memory management subsystem in the Linux kernel.
Read less
Read more
Technology
Report
Share
Report
Share
1 of 27
Recommended
Linux Memory Management
Linux Memory Management
Anil Kumar Pugalia
Linux Memory Management
Linux Memory Management
Suvendu Kumar Dash
Linux memory
Linux memory
ericrain911
Linux memory-management-kamal
Linux memory-management-kamal
Kamal Maiti
Linux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
Memory management in Linux kernel
Memory management in Linux kernel
Vadim Nikitin
Linux Memory
Linux Memory
Vitaly Nahshunov
Linux Memory Management
Linux Memory Management
Ni Zo-Ma
Recommended
Linux Memory Management
Linux Memory Management
Anil Kumar Pugalia
Linux Memory Management
Linux Memory Management
Suvendu Kumar Dash
Linux memory
Linux memory
ericrain911
Linux memory-management-kamal
Linux memory-management-kamal
Kamal Maiti
Linux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
Memory management in Linux kernel
Memory management in Linux kernel
Vadim Nikitin
Linux Memory
Linux Memory
Vitaly Nahshunov
Linux Memory Management
Linux Memory Management
Ni Zo-Ma
Physical Memory Models.pdf
Physical Memory Models.pdf
Adrian Huang
Debugging linux kernel tools and techniques
Debugging linux kernel tools and techniques
Satpal Parmar
LISA2019 Linux Systems Performance
LISA2019 Linux Systems Performance
Brendan Gregg
Physical Memory Management.pdf
Physical Memory Management.pdf
Adrian Huang
Unix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
Drishti Bhalla
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Adrian Huang
Memory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux Kernel
Adrian Huang
Memory management in linux
Memory management in linux
Dr. C.V. Suresh Babu
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Adrian Huang
Page cache in Linux kernel
Page cache in Linux kernel
Adrian Huang
spinlock.pdf
spinlock.pdf
Adrian Huang
malloc & vmalloc in Linux
malloc & vmalloc in Linux
Adrian Huang
Linux memory consumption
Linux memory consumption
haish
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
Gene Chang
Linux kernel Architecture and Properties
Linux kernel Architecture and Properties
Saadi Rahman
Notes on NUMA architecture
Notes on NUMA architecture
Intel Software Brasil
cpu scheduling in os
cpu scheduling in os
Kiran Kumar Thota
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Sowmya Jyothi
Reverse Mapping (rmap) in Linux Kernel
Reverse Mapping (rmap) in Linux Kernel
Adrian Huang
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)
Pankaj Suryawanshi
Live memory forensics
Live memory forensics
Mehedi Hasan
Vmfs
Vmfs
Erick Treviño
More Related Content
What's hot
Physical Memory Models.pdf
Physical Memory Models.pdf
Adrian Huang
Debugging linux kernel tools and techniques
Debugging linux kernel tools and techniques
Satpal Parmar
LISA2019 Linux Systems Performance
LISA2019 Linux Systems Performance
Brendan Gregg
Physical Memory Management.pdf
Physical Memory Management.pdf
Adrian Huang
Unix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
Drishti Bhalla
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Adrian Huang
Memory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux Kernel
Adrian Huang
Memory management in linux
Memory management in linux
Dr. C.V. Suresh Babu
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Adrian Huang
Page cache in Linux kernel
Page cache in Linux kernel
Adrian Huang
spinlock.pdf
spinlock.pdf
Adrian Huang
malloc & vmalloc in Linux
malloc & vmalloc in Linux
Adrian Huang
Linux memory consumption
Linux memory consumption
haish
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
Gene Chang
Linux kernel Architecture and Properties
Linux kernel Architecture and Properties
Saadi Rahman
Notes on NUMA architecture
Notes on NUMA architecture
Intel Software Brasil
cpu scheduling in os
cpu scheduling in os
Kiran Kumar Thota
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Sowmya Jyothi
Reverse Mapping (rmap) in Linux Kernel
Reverse Mapping (rmap) in Linux Kernel
Adrian Huang
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)
Pankaj Suryawanshi
What's hot
(20)
Physical Memory Models.pdf
Physical Memory Models.pdf
Debugging linux kernel tools and techniques
Debugging linux kernel tools and techniques
LISA2019 Linux Systems Performance
LISA2019 Linux Systems Performance
Physical Memory Management.pdf
Physical Memory Management.pdf
Unix Memory Management - Operating Systems
Unix Memory Management - Operating Systems
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Memory Mapping Implementation (mmap) in Linux Kernel
Memory Mapping Implementation (mmap) in Linux Kernel
Memory management in linux
Memory management in linux
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
qemu + gdb: The efficient way to understand/debug Linux kernel code/data stru...
Page cache in Linux kernel
Page cache in Linux kernel
spinlock.pdf
spinlock.pdf
malloc & vmalloc in Linux
malloc & vmalloc in Linux
Linux memory consumption
Linux memory consumption
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
Linux kernel Architecture and Properties
Linux kernel Architecture and Properties
Notes on NUMA architecture
Notes on NUMA architecture
cpu scheduling in os
cpu scheduling in os
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Introduction to Unix operating system Chapter 1-PPT Mrs.Sowmya Jyothi
Reverse Mapping (rmap) in Linux Kernel
Reverse Mapping (rmap) in Linux Kernel
Linux Memory Management with CMA (Contiguous Memory Allocator)
Linux Memory Management with CMA (Contiguous Memory Allocator)
Similar to Memory management in Linux
Live memory forensics
Live memory forensics
Mehedi Hasan
Vmfs
Vmfs
Erick Treviño
Refining Linux
Refining Linux
Jason Murray
5.6 Basic computer structure microprocessors
5.6 Basic computer structure microprocessors
lpapadop
제2회난공불락 오픈소스 세미나 커널튜닝
제2회난공불락 오픈소스 세미나 커널튜닝
Tommy Lee
Understanding And Managing Memory
Understanding And Managing Memory
isma ishak
7989-lect 10.pdf
7989-lect 10.pdf
RiazAhmad521284
virtual memory - Computer operating system
virtual memory - Computer operating system
Electronics - Embedded System
What every data programmer needs to know about disks
What every data programmer needs to know about disks
iammutex
Measuring Firebird Disk I/O
Measuring Firebird Disk I/O
Mind The Firebird
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Kyle Hailey
Presentation aix performance tuning
Presentation aix performance tuning
xKinAnx
tuningfor_oracle
tuningfor_oracle
styxyx
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Виталий Стародубцев
Operating Systems - A Primer
Operating Systems - A Primer
Saumil Shah
20080528dublinpt3
20080528dublinpt3
Jeff Hammerbacher
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysis
dreamwidth
virtual memory
virtual memory
Abeer Naskar
Linux Performance Tunning Memory
Linux Performance Tunning Memory
Shay Cohen
Clear cache memory
Clear cache memory
Abdullah Al Muzammi
Similar to Memory management in Linux
(20)
Live memory forensics
Live memory forensics
Vmfs
Vmfs
Refining Linux
Refining Linux
5.6 Basic computer structure microprocessors
5.6 Basic computer structure microprocessors
제2회난공불락 오픈소스 세미나 커널튜닝
제2회난공불락 오픈소스 세미나 커널튜닝
Understanding And Managing Memory
Understanding And Managing Memory
7989-lect 10.pdf
7989-lect 10.pdf
virtual memory - Computer operating system
virtual memory - Computer operating system
What every data programmer needs to know about disks
What every data programmer needs to know about disks
Measuring Firebird Disk I/O
Measuring Firebird Disk I/O
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Oracle Open World 2014: Lies, Damned Lies, and I/O Statistics [ CON3671]
Presentation aix performance tuning
Presentation aix performance tuning
tuningfor_oracle
tuningfor_oracle
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Технологии работы с дисковыми хранилищами и файловыми системами Windows Serve...
Operating Systems - A Primer
Operating Systems - A Primer
20080528dublinpt3
20080528dublinpt3
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysis
virtual memory
virtual memory
Linux Performance Tunning Memory
Linux Performance Tunning Memory
Clear cache memory
Clear cache memory
Recently uploaded
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Memoori
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Padma Pradeep
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Fwdays
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Wonjun Hwang
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Alex Barbosa Coqueiro
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
carlostorres15106
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Pixlogix Infotech
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Mark Simos
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
BookNet Canada
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Florian Wilhelm
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
Dubai Multi Commodity Centre
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
ScyllaDB
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Alfredo García Lavilla
costume and set research powerpoint presentation
costume and set research powerpoint presentation
phoebematthew05
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Fwdays
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
charlottematthew16
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
The Digital Insurer
Recently uploaded
(20)
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
costume and set research powerpoint presentation
costume and set research powerpoint presentation
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
Memory management in Linux
1.
Memory management in
Linux Raghu Udiyar Technical Support Engineer Red Hat
2.
3.
Can a disk
be considered memory? Yes, in a way
4.
5.
Latency
6.
Volatile
7.
8.
CPU cache (L1,
L2..) - 3 – 14 cycles
9.
RAM (main memory)
- ~250 cycles
10.
Disk -
~40 million cycles
11.
12.
These are then
taken and divided into page frames of 4Kb
13.
E.g. 4Gb
= ~1 million pages
14.
15.
Every process has
a virtual view of the memory
16.
A process will
think it is the only task running on the system
17.
This virtual memory
is then mapped to physical memory using page tables
18.
Virtual Memory vi
bash 2GB Physical Memory Virtual memory
19.
Virtual Memory vi
bash 2GB Physical Memory Virtual memory Page Table
20.
21.
User and Kernel
address space Kernel User Kernel User 32bit 64bit 3Gb 1GB 256TB 256TB
22.
23.
malloc(1G) = Ok
24.
memset(1G) = Ok
25.
malloc(4GB) =
Ok
26.
memset(4GB) = -ENOMEM
27.
Kernel almost always
grants Virtual memory
28.
Page fault occurs
only when that memory is used
29.
30.
In such cases
the “OOM killer” is invoked
31.
It will try
to free memory by killing a task based on heuristics
32.
OOM killer message
33.
34.
All i/o in
Linux goes through the page cache Write-back (delayed) Clean/Dirty pages Page cache Process Disk
35.
36.
# dd if=/dev/zero
of=512M-file count=512000 bs=1k
37.
# time cat
512M-file &> /dev/null
38.
# echo 1
> /proc/sys/vm/drop_caches
39.
# time cat
512M-file &> /dev/null
40.
41.
Program text -
read only
42.
File backed -
clean or dirty pages
43.
Anonymous pages –
Not file-backed, e.g stack and heap
44.
Only anonymous
memory is paged out to swap area
45.
46.
Considerably slow
- ~40 million cycles
47.
Swapping is a
misnomer, pages paged out/in is more appropriate
48.
Only anonymous pages
are paged out
49.
50.
Tools - vmstat
51.
Tools - ps
52.
53.
(10mins default)
54.
Check “man sar”
for details on all switches
55.
56.
#sar -f sa05
-tq
57.
#sar -f sa05
-tr
58.
#sar -f sa05
-tW
59.
60.
https://access.redhat.com/kb/docs/DOC-1139
61.
62.
Check :
https://access.redhat.com/kb/docs/DOC-52712
63.
64.
https://access.redhat.com/kb/docs/DOC-3368
65.
Swap usage doesn't
necessarily indicate a problem
66.
Instead, check #sar
-tW for problems
67.
68.
In most case,
this is not advised, and arises from misunderstanding of how the page cache works
69.
Controlling page cache
size : https://access.redhat.com/kb/docs/DOC-41749
70.
71.
Some confuse this
with swap in/out
72.
These are just
the number of sectors read in or written to disk.
73.
See :
https://access.redhat.com/kb/docs/DOC-61288
74.
75.
Check :
https://access.redhat.com/kb/docs/DOC-52474
76.
Thank you
Questions?