LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2018, 04:46 AM   #1
bhosaleabhijeet10@gmail.
LQ Newbie
 
Registered: Aug 2018
Posts: 2

Rep: Reputation: Disabled
How to identify/check that, how much of swap memory is used by a particular process or service?


I want to find out that if a process is using swap memory then hoe to check that how much space is used by particular process. Also if a process has child or parent process process the how to check the swap memory utilization for those processes.
 
Old 12-26-2018, 05:57 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,109

Rep: Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150
man proc:
Code:
 /proc/[pid]/pagemap (since Linux 2.6.25)
              This file shows the mapping of each of the process's virtual
              pages into physical page frames or swap area.  It contains one
              64-bit value for each virtual page
You will have to do that for the children or parent separately.

By the way, by exposing your email address you risk attracting spam.

Last edited by berndbausch; 12-26-2018 at 06:00 AM.
 
Old 12-28-2018, 02:21 PM   #3
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: Currently: openSUSE, Raspbian, Slackware. Formerly: CentOS, MacOS, Red Hat. Other: Solaris, Tru64
Posts: 1,724

Rep: Reputation: 210Reputation: 210Reputation: 210
The OP's question seems like something that "/sbin/swapon -sv" would provide but, sadly, doesn't.

What is actually being displayed in /proc/pid/pagemap? All I see is a bunch of binary data.

Would summing the column 2 values of all the "Swap:" records in /proc/pid/smaps give a user a summary of the process's swap utilization?

Quote:
Originally Posted by berndbausch View Post
By the way, by exposing your email address you risk attracting spam.
I was kicking myself for several years after making that mistake on Usenet years ago with a work email address. :^\
 
Old 12-28-2018, 06:11 PM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 4,109

Rep: Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150Reputation: 1150
Quote:
Originally Posted by rnturn View Post

What is actually being displayed in /proc/pid/pagemap? All I see is a bunch of binary data.
Itís documented in the man page.

smaps and the pmap command might be solutions as well.
 
Old 12-28-2018, 11:23 PM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: Currently: openSUSE, Raspbian, Slackware. Formerly: CentOS, MacOS, Red Hat. Other: Solaris, Tru64
Posts: 1,724

Rep: Reputation: 210Reputation: 210Reputation: 210
Quote:
Originally Posted by berndbausch View Post
Itís documented in the man page.
Well, not really. I just see a vague reference to it in the description of "clear_refs" and what's there doesn't seem to tell you how much swap space is being used.

Quote:
smaps and the pmap command might be solutions as well.
Working with "smaps" seems more straightforward. Also, the "nswap" and "cnswap" values from /proc/*/stat might be useful though the notes in the manpage about "not maintained" are not encouraging.
 
Old 12-28-2018, 11:42 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,477

Rep: Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093Reputation: 3093
I use smaps for this - however, note the caveats I mention in this recent related thread
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How much swap area is enough/too much? Beowulf questions tnandy Linux - Software 4 06-14-2019 04:30 PM
API to identify whether file is opened or closed or used by other process in Linux nagendrar Linux - Newbie 13 07-24-2014 10:01 AM
Get Thread count , Used memory for a particular Process haseit Programming 7 02-26-2009 06:10 AM
How to assign one particular process to particular CPU, in multiprocessor Architeture sudha Linux - General 1 01-23-2005 11:53 AM
swap space used: 0; memory used: 90-95% abs Slackware 9 08-30-2004 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:39 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration