LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-22-2016, 03:10 AM   #1
shubham debnath
LQ Newbie
 
Registered: May 2016
Posts: 1

Rep: Reputation: Disabled
top is showing too much swap usage


top command showing too much swap usage by several processes but the system hasn't such swap memory installed in it. So why it is showing such huge usage in top?
 
Old 06-22-2016, 03:30 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Evidence.
Then show your analysis - maybe someone can point out the error.
 
Old 06-23-2016, 08:19 PM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
depends on your definition of "too much".

Page fault handling ALWAYS goes on. When memory pressure gets high enough code pages will get dropped, and reloaded as neccessary. The code pages come from the binary executable file but are nearly always loaded via page faults, and this can/will show up as "swapping" activity.
 
Old 06-24-2016, 07:41 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
It is possible that you have some (maybe, relatively inactive ...) processes which have memory leaks. Since all user-land memory is virtual, this becomes occupied space in swap. The application is no longer referencing the "leaked" memory, so it eventually gets swapped out, but the application's total virtual-memory allocation continues to grow.

If an application's total VM-space continues to grow, but its so-called "working-set size" (the number of pages that must be in-RAM for the process to run efficiently) generally does not, "you probably have a 'leaker' on your hands."

This is a bug in the program. Or, in the case of a server, it might be a bug in one of the client programs.

Since most programs these days are written using languages which provide a "mark-and-sweep garbage collector," the most common cause of leaks is "circular storage references." A block of memory won't be deallocated until there are no remaining references to it. But, consider the case where there are two objects, A and B, and each contains a ("strong ...") reference to the other. Even if no one else is still referring to either object, the two objects continue to refer to each other and therefore keep either of them from being reaped.

And to complete the thought: what you can do about it, in designing a program, is to use "weakened" references, which tells (the software's, not Linux's ...) memory manager that "you can break this link, if you need to." If, say, the reference from A to B is designated as "weak," the garbage collector might decide to break it. Now, B (say ...) has no remaining "strong" references to it, so B can be reaped, and since that (say) means that A now has no remaining "strong" reference to it, A is reaped also, and the leak does not occur.

Mind you, these are programming language issues ... they are bugs. Linux isn't doing the wrong thing. The programs need to be fixed.

Last edited by sundialsvcs; 06-24-2016 at 07:49 AM.
 
Old 07-07-2016, 10:18 PM   #5
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
Just to add something that may help.

Remember Linux is not Windows. It normally loads much into memory, using that resource to its advantage.
It will then quickly swap out or just clear space if there is no place to swap the memory resident code,
on demand, when another process needs that space.

If there is no swap configured as you seem to indicate, no wonder,right?
Why run without any swap? Swap does not need to be a dedicated partition. You can have a swap file.

Hope that helps,
Tim

Last edited by Tim Abracadabra; 07-07-2016 at 10:28 PM. Reason: edit to add alternatives
 
Old 07-07-2016, 10:33 PM   #6
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
It is showing kilobytes, right?
 
Old 07-07-2016, 10:38 PM   #7
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
We might know if the OP ever responds with the data to support their analysis/conclusion.

So far, All I hear is crickets !?!
(From the OP)

Last edited by Tim Abracadabra; 07-07-2016 at 10:45 PM. Reason: Clarify crickets only regarding the OP
 
Old 07-08-2016, 11:51 AM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Well, Linux is very aggressive in its use of buffers, but the accumulation of data in swap implies, to me, the presence of memory that has been allocated by an application program, but then never again referenced. Eventually, the data gets pushed out to the swap file, never to be called-back again because it was "caused by a leak."

The "amount of virtual memory used" by the suspect process will also be "steadily increasing," although the working-set size may not be large at all.

Last edited by sundialsvcs; 07-08-2016 at 11:52 AM.
 
Old 07-08-2016, 02:54 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by Tim Abracadabra View Post
Just to add something that may help.

Remember Linux is not Windows. It normally loads much into memory, using that resource to its advantage.
It will then quickly swap out or just clear space if there is no place to swap the memory resident code,
on demand, when another process needs that space.

If there is no swap configured as you seem to indicate, no wonder,right?
Why run without any swap? Swap does not need to be a dedicated partition. You can have a swap file.

Hope that helps,
Tim
Not exactly.

Linux uses swap to load executable code. If the code is sleeping, it will release those pages for other use, and when they DO become active, the pages are recalled via swap activity.
 
1 members found this post helpful.
Old 07-08-2016, 05:12 PM   #10
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
The OP stated this " but the system hasn't such swap memory installed in it".

I'd start by finding out if indeed some swap file or partition is really being used and how much of it is available.

Various distro's use different tools to manage. One example. https://access.redhat.com/documentat...and_Usage.html

Last edited by jefro; 07-08-2016 at 05:14 PM.
 
Old 07-09-2016, 02:48 AM   #11
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: debian 9.8 w/GNOME and KDE dual boot w/Win 10.| debian 7.11 w/Xfce, LFS 7.9, + Multi-boot w/Windows7
Posts: 122

Rep: Reputation: Disabled
@jpollard,

Thanks for the correction/clarification

Last edited by Tim Abracadabra; 07-09-2016 at 02:52 AM. Reason: Correct referenced nick
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] top showing up to 160% CPU usage trhodgkinson Linux - Newbie 3 08-23-2011 08:17 PM
Top showing 9999% CPU usage on Ubuntu Lucid 10.04 ajayan Linux - Newbie 3 06-19-2011 08:27 PM
Why doesnt top or free show swap memory usage ? exceed1 Linux - General 15 08-03-2009 08:38 PM
no swap showing in top rustyz82 Slackware 2 03-31-2006 06:28 PM
Individual CPU usage not showing in ps/top hulli Linux - General 2 08-24-2004 02:44 AM

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

All times are GMT -5. The time now is 06:54 PM.

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