LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-06-2021, 02:00 AM   #1
sanjibdas
LQ Newbie
 
Registered: Dec 2020
Location: Bangalore, India
Posts: 8

Rep: Reputation: Disabled
RAM usage by unknown sources not traceable via regular tools (meminfo, smem)


Hi all,

I do see lot of memory (RAM) usage by some unknown source & is not listed by any of these cached, buffer, slab, kernel stack, vmallocUsed, anon or applications. I used smem tool so far & also enabled kmemleak. But not much luck yet.

Total RAM size is 16G & we carve out around 2.3G for a different purpose (not available to linux).

I used these fields to calculate total usage, which typically give closer value to MemTotal in normal cases. Here I see ~6.5G is missing.

MemTotal = MemFree + Buffers + Cached + AnonPages + Slab + KernelStack + PageTables + VmallocUsed


MemTotal: 13535936 kB (16G - 2.3G)
MemFree: 782080 kB
Buffers: 615744 kB
Cached: 2748416 kB
SwapCached: 0 kB
Active: 4932800 kB
Inactive: 845376 kB
Active(anon): 4148928 kB
Inactive(anon): 0 kB
Active(file): 783872 kB
Inactive(file): 845376 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 2621312 kB
SwapFree: 2621312 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 2404544 kB
Mapped: 828288 kB
Shmem: 1739776 kB
Slab: 280768 kB
SReclaimable: 56128 kB
SUnreclaim: 224640 kB
KernelStack: 33792 kB
PageTables: 39296 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 9389248 kB
Committed_AS: 6923008 kB
VmallocTotal: 35184367894528 kB
VmallocUsed: 4480 kB
VmallocChunk: 35184367857920 kB

My linux kernel is 2.6.32.11 (comparatively old) & I am clueless how to track this GAP. It would be a great help if you could share some pointers in this context. Any specific open source tool which could be useful in my case?

Thanks in advance.
Sanjib

Last edited by sanjibdas; 02-06-2021 at 10:40 PM.
 
Old 02-06-2021, 08:36 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
A few examples.

Code:
ps -e | grep xterm
226455 ?        00:00:00 xterm
226570 ?        00:00:00 xterm
 
pmap -x 226570
226570:   xterm -class UXTerm -title uxterm -u8
Address           Kbytes     RSS   Dirty Mode  Mapping
0000557e18f26000     136     136       0 r---- xterm
0000557e18f48000     468     468       0 r-x-- xterm
0000557e18fbd000     192     136       0 r---- xterm
0000557e18fed000      28      28      28 r---- xterm
0000557e18ff4000      36      36      36 rw--- xterm
0000557e18ffd000      76       8       8 rw---   [ anon ]
0000557e197e8000    6208    6072    6072 rw---   [ anon ]
00007f1e9aa5d000     248     224       0 r---- DejaVuSansMono-BoldOblique.ttf
....

cat /proc/226570/status
Name:   xterm
Umask:  0022
State:  S (sleeping)
Tgid:   226570
Ngid:   0
Pid:    226570
...

cat /proc/226570/smaps
Also found this
Code:
ps -eo size,pid,user,command --sort -size | \
    awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\
    cut -d "" -f2 | cut -d "-" -f1
Also:
Valgrind
Exmap
ps_mem
top
htop
 
Old 02-06-2021, 11:20 PM   #3
sanjibdas
LQ Newbie
 
Registered: Dec 2020
Location: Bangalore, India
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for your reply teckk. I did memory usage calculation for all my processes, but nothing adds up to the total usage (at least closer to that).
Other than Slab & VmallocUsed, is there any other parameter which could give some hint about kernel memory leak?

ps_mem seems to be quite useful, I will keep this running at frequent intervals.

Last edited by sanjibdas; 02-07-2021 at 09:48 AM.
 
Old 03-09-2021, 03:19 AM   #4
sanjibdas
LQ Newbie
 
Registered: Dec 2020
Location: Bangalore, India
Posts: 8

Original Poster
Rep: Reputation: Disabled
This link was really helpful (check for Memory black hole).
https://titanwolf.org/Network/Articl...2954#gsc.tab=0

Memory allocation via alloc_pages() without proper book-keeping could lead to such situation where we cannot track
memory usage from /proc/meminfo dump.
 
Old 03-09-2021, 07:59 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,879

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
www.linuxatemyram.com
 
Old 03-09-2021, 04:19 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Sounds scarily similar to this recent thread
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: smem – Linux Memory Reporting/Statistics Tool LXer Syndicated Linux News 0 02-07-2017 11:50 AM
LXer: Linux Terminal: Check who uses all your memory with smem LXer Syndicated Linux News 0 10-21-2013 05:11 PM
smem, sfill, sswap Centos Average_Bear Linux - Newbie 4 09-17-2009 08:10 PM
/proc/meminfo not reporting full 4096M of installed ram (64bit kubuntu) CoffeeKing!!! Linux - Hardware 11 12-25-2008 07:53 PM
Is SQL Injection traceable and is it a serious offence? novkhan Linux - Security 2 05-21-2004 10:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration