LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to identify/check that, how much of swap memory is used by a particular process or service? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-identify-check-that-how-much-of-swap-memory-is-used-by-a-particular-process-or-service-4175644976/)

bhosaleabhijeet10@gmail. 12-26-2018 03:46 AM

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.

berndbausch 12-26-2018 04:57 AM

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.

rnturn 12-28-2018 01:21 PM

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 (Post 5941359)
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. :^\

berndbausch 12-28-2018 05:11 PM

Quote:

Originally Posted by rnturn (Post 5942192)

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.

rnturn 12-28-2018 10:23 PM

Quote:

Originally Posted by berndbausch (Post 5942276)
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.

syg00 12-28-2018 10:42 PM

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


All times are GMT -5. The time now is 10:48 AM.