LinuxQuestions.org
Register a domain and help support LQ
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 07-19-2013, 08:39 AM   #1
Rohit_4739
Member
 
Registered: Oct 2010
Distribution: Red Hat
Posts: 224

Rep: Reputation: 9
Unhappy Swap confusion from Top and Free Outputs


Hi All,

I am not sure how to put this and i am kind of feeling embarrassed also asking this question because i think i should have known this, anyways here it is.

Code:
# free -m
             total       used       free     shared    buffers     cached
Mem:          5834       4413       1421          0        436       2455
-/+ buffers/cache:       1521       4313
Swap:         2047          0       2047
root@dbsrs0004:/root

***************************************************************
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND
12194 oracle    -2   0 2274m  16m  14m S  0.0  0.3   0:00.40 2.2g oracle
12198 oracle    15   0 2275m  17m  15m S  0.0  0.3   0:00.03 2.2g oracle
12192 oracle    15   0 2274m  17m  14m S  0.0  0.3   0:00.22 2.2g oracle
 4824 oracle    15   0 2275m  19m  16m S  0.0  0.3   0:00.46 2.2g oracle
Why there is a difference in the output, the server's swap usage is 0 so why Top shows the oracle swapping out 2.2g and more over how could that even be possible as the Total swap on the system is 2G.

I am sorry if there is something silly in the question.
 
Old 07-19-2013, 03:49 PM   #2
jonesr
Member
 
Registered: Feb 2008
Location: Sacramento
Distribution: RHEL AS, mostly
Posts: 44

Rep: Reputation: 18
The SWAP column in top shows VIRT minus RES and reflects the amount that might be swapped if the processes were to try to actually occupy all 2274m of the virtual address space. Since there are no pages allocated to the vast majority of that 2274m of mostly-empty virtual space, nothing needs to be swapped, and the free command rightly shows zero swap used.
 
Old 07-19-2013, 05:06 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 2,199

Rep: Reputation: 567Reputation: 567Reputation: 567Reputation: 567Reputation: 567Reputation: 567
Swapping activity is also not limited to the swap file/partition. It is entirely possible for the system to drop pages from memory where the program code hasn't been used, and page in other program code from the disk resident program file. This is an ambiguous report from top, as it defines swap this way (ref manpage on top):

Code:
p: SWAP  --  Swapped size (kb)
          The non-resident portion of a task's address space.
So a large executable is likely not entirely in memory - thus non-resident, and added to "swap size".
 
  


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
[SOLVED] Confusion Between Samba and Swap Partition hitmen Linux - Newbie 7 09-24-2011 06:48 AM
[SOLVED] PHP Outputs Metadata or File Information at the Top of its Output Hi_This_is_Dev Programming 3 09-10-2010 12:55 PM
Why doesnt top or free show swap memory usage ? exceed1 Linux - General 15 08-03-2009 08:38 PM
Swap space used: Why does free and top show different amounts compared to ps doublefrangelico Linux - Newbie 1 06-23-2009 01:50 PM
Swap CRT DVI outputs Kane2002 Linux - General 1 10-15-2006 07:15 AM


All times are GMT -5. The time now is 05:25 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration