LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 12-01-2019, 12:01 PM   #1
ychaouche
Member
 
Registered: Mar 2017
Distribution: Mint, Debian, Q4OS, Mageia, KDE Neon
Posts: 35

Rep: Reputation: 1
Unhappy Early swap usage


Hello.

I'm using Kubuntu 19.10 and noticed that swap was used very early after starting the desktop, even if there's still RAM available (4Gb RAM, KDE Plasma Desktop). How can I troubleshoot what's causing this early use of swap ? isn't swap supposed to be used only if RAM is full ? can I do something about it ?
 
Old 12-01-2019, 08:53 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 15,785
Blog Entries: 27

Rep: Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632Reputation: 4632
What does top or htop tell you about memory usage?
 
1 members found this post helpful.
Old 12-03-2019, 04:33 AM   #3
ychaouche
Member
 
Registered: Mar 2017
Distribution: Mint, Debian, Q4OS, Mageia, KDE Neon
Posts: 35

Original Poster
Rep: Reputation: 1
Please see imgur album here : https://imgur.com/a/ba7FR6j
 
Old 12-03-2019, 04:53 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,393

Rep: Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047Reputation: 3047
Quote:
Originally Posted by ychaouche View Post
isn't swap supposed to be used only if RAM is full ? can I do something about it ?
No and no.
Swap is a resource available to the memory management system to manage and balance as it sees fit. Many man years of effort by a bunch of very smart people have gone into the code.
Go find a real problem to worry about. If it really worries you, issue a swapoff/swapon.
 
2 members found this post helpful.
Old 12-03-2019, 05:02 AM   #5
ychaouche
Member
 
Registered: Mar 2017
Distribution: Mint, Debian, Q4OS, Mageia, KDE Neon
Posts: 35

Original Poster
Rep: Reputation: 1
Ah, this is good to know. The real problem that worries me is the system being slow after some time. I have linked this with swap usage because many times when system becomes unresponsive, I see one or two processes in "disk sleep" state, which means they are waiting for data from disk (could writes also be blocking ? dunno), which is why I thought maybe they are reading from the swap file (since the monitoring tools show swap usage). But after reading your post I assume swap is not an indicator of poor system health.
 
Old 12-03-2019, 05:39 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,501

Rep: Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314
www.linuxatemyram.com will explain some details.
 
Old 12-03-2019, 01:14 PM   #7
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 2,530

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Code:
cat /proc/sys/vm/swappiness
60
You can change that.
https://wiki.archlinux.org/index.php/Swap#Swappiness

Look at your distros docs.
 
1 members found this post helpful.
Old 12-28-2019, 04:30 PM   #8
walker
Member
 
Registered: Nov 2003
Distribution: antiX-17.4.1_x64 base Custom
Posts: 172

Rep: Reputation: 37
Quote:
Originally Posted by ychaouche View Post
Hello.

I'm using Kubuntu 19.10 and noticed that swap was used very early after starting the desktop, even if there's still RAM available (4Gb RAM, KDE Plasma Desktop). How can I troubleshoot what's causing this early use of swap ? isn't swap supposed to be used only if RAM is full ? can I do something about it ?
There's often a misunderstanding about kernel memory paging especially with swap space.

Swap is used always, despite from physical memory in use.
Kernel memory paging put on swap space not often used data despite if ram is full or not.

You aren't anyway using the lightest distro out here, ubuntu and derivatives, since introduction of snapd daemon, waste a bunch of resources doubling already present services and added with the most resources hungry desktop environment.

You have not only to consider the used memory but also the cached memory only the difference between the total memory minus memory reserved for video card+used memory+cached memory is really "in hand" to system i.e. in my system with base 1GB ram right now really free memory is 376MB and it doesn't anyway swap

Quote:
free -m
total used free shared buff/cache available
Mem: 985 427 376 19 181 410
Swap: 2047 0 2047
Maybe your system is to heavy on memory and that's why kernel transfers data to swap.

Eye candies have an high memory price and an high price in system responsiveness too.

I can only suggest you to check with a lighter live i.e. MX Linux which runs smoothly live on my other machine with 2GB ram without swapping.

Let us know.

Last edited by walker; 12-28-2019 at 04:34 PM. Reason: Mistyping
 
2 members found this post helpful.
Old 12-29-2019, 04:44 PM   #9
ludist
Member
 
Registered: Nov 2005
Location: Greece
Distribution: Slackware
Posts: 140

Rep: Reputation: 18
Quote:
Originally Posted by ychaouche View Post
isn't swap supposed to be used only if RAM is full ?
Yes, but this not the default to my knowledge in any distro.

Quote:
swappiness
This control is used to define how aggressive the kernel will swap memory pages. Higher values will increase aggressiveness, lower values decrease the amount of swap. A value of 0 instructs the kernel not to initiate swap until the amount of free and file-backed pages is less than the high water mark in a zone.

The default value is 60.
source, with more RAM details.

Quote:
Originally Posted by ychaouche View Post
can I do something about it ?
Yes. Try swappiness 0 or whatever setting suits to your setup / use case.

Code:
echo 10 > /proc/sys/vm/swappiness 
root@x2:~# cat /proc/sys/vm/swappiness 
10
I have one machine with half RAM than expected (heavy load on ram) and after many failures is working properly with swappiness 10
Code:
sysctl -a | grep swap
vm.swappiness = 10
total       used       free     shared    buffers     cached
Mem:           481        475          6         13          0         68
-/+ buffers/cache:        406         75
Swap:         1023        316        707
After restart, the swap is always used, because the ram is very small.

my light machine is like that
Code:
sysctl -a | grep swap
vm.swappiness = 60
root@x2:~# free -m
              total        used        free      shared  buff/cache   available
Mem:           1504         458         619          83         426         780
Swap:           494         209         285
So, although I have 60 swappiness, since I have plenty of RAM (and light usage) I have less swapped memory.

And my main machine with 6G of ram
Code:
vm.swappiness = 0
23:24:54|503|root@x:~# free -m
              total        used        free      shared  buff/cache   available
Mem:           5883         631        2668         156        2583        4821
Swap:          4479         464        4014
So you can see that the machine with more ram uses more swap, although the setting is to zero. (My main machine operates with many different programs and hibernates to swap).

So probably kubuntu is too heavy and needs swap. You can try 0 setting, but in my stressed machine 10 was the right choice.

I think KDE is a disaster for memory. Only XFCE here for many years. I never worked with KDE the last 10 years.

Quote:
Originally Posted by walker View Post
Swap is used always.
To my knowledge this true for Windows, but not for Linux. You can even remove swap with swapoff. This is impossible in windows.
 
1 members found this post helpful.
Old 12-30-2019, 07:02 AM   #10
walker
Member
 
Registered: Nov 2003
Distribution: antiX-17.4.1_x64 base Custom
Posts: 172

Rep: Reputation: 37
Quote:
Originally Posted by ludist View Post
So probably kubuntu is too heavy and needs swap. You can try 0 setting, but in my stressed machine 10 was the right choice.
Didn't I write the same?
Giving also a link to a comparison which demonstrates this.

Quote:
Originally Posted by ludist View Post
I think KDE is a disaster for memory. Only XFCE here for many years. I never worked with KDE the last 10 years.
I too from a little more. I switched to the true Gnome (2) and when Gnome 3 came switched to XFCE.
Now I use Icewm on my daily driver and JWM for my rescue system installed on a 16GB usb key built upon Devuan minimal live and it run witn fancy transparency too with less than 100MB ram.

I think that reinventing the wheel (Pantheon, Cinammon aso) is a waste of time, and not so smart, when you could instead help to improve what already exists and works.

It seems, too, that the Big Corps. take over of GNU/Linux keep using but formerly getting rid of GNU is also a try to increase hardware requirements hoping to help manufacturers to sell not needed new hardware cause sales are plunging year after year.

My machine with more ram is an eeePC with 2GB ram and with the right OS it works flawlessly also with a 32bit Atom Z520 and I don't use only a browser to surf the net as the large majority do.
My daily driver is an eeePC with 1GB ram and an Atom N455 64bit and my media center used also to watch TV with a DVB/T-T2 usb decoder and watch DVD's is a 2006 IBM T41 32bit 1,4GHZ CPU with 1,5GB ram coupled with a BenQ 32" display.

The will to learn let you save a bunch of money so you haven't to work 24/7 cause money is never enough and in the spare time you can help others, free of charge, to acquire knowledge so they won't be forced to do the beta tester for easy big corps Linux like Canonical IBM\RedHat Suse letting them make money on users' free of charge work.

Quote:
Originally Posted by ludist View Post
Quote:
Originally Posted by walker View Post
Swap is used always.
To my knowledge this true for Windows, but not for Linux. You can even remove swap with swapoff.
Yes, you can!
swapoff -a will disable every swap space found and mounted on boot but I think we were talking about normal use of an out of the box distro.
But take care that this is no longer true for Ubuntu since 17.04 cause a big corp (Canonical) has decided to replace the swap partition with a swap file resembling Windows.

That's why I avoid fake free software coming from Big Corps and also their, even if community developed (i.e. Mint) derivatives.

Sorry for the, sometimes, OT but it seems that a majority confuse a kernel (Linux is only a kernel useless by itself) with an OS so a little history is sometimes needed.

If you don't like to read cause history is boring... watch it!
 
2 members found this post helpful.
Old 12-30-2019, 11:09 AM   #11
Basslord1124
Member
 
Registered: Jun 2004
Location: Ashland, KY
Distribution: Debian, Mint, Puppy
Posts: 418

Rep: Reputation: 37
As others have said, it's probably KDE. KDE is probably one of the resource hungry of user interfaces. I used to use way back, but haven't used it in many many years. I say change your GUI or if you want to keep using it, I'd recommend upgrading your RAM.
 
Old 12-31-2019, 04:11 AM   #12
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE, Debian, Knoppix, Mageia, Fedora, others
Posts: 2,093

Rep: Reputation: 659Reputation: 659Reputation: 659Reputation: 659Reputation: 659Reputation: 659
Quote:
Originally Posted by walker View Post
with the most resources hungry desktop environment.
That characterization apparently may have become obsolete with KDE versions newer than that in Kubuntu 19.10: https://www.forbes.com/sites/jasonev...crown-in-2020/

OP is maybe a candidate to switch to KDE neon.

Last edited by mrmazda; 12-31-2019 at 04:21 AM.
 
Old 12-31-2019, 05:28 AM   #13
walker
Member
 
Registered: Nov 2003
Distribution: antiX-17.4.1_x64 base Custom
Posts: 172

Rep: Reputation: 37
Quote:
Originally Posted by mrmazda View Post
That characterization apparently may have become obsolete with KDE versions newer than that in Kubuntu 19.10: https://www.forbes.com/sites/jasonev...crown-in-2020/

OP is maybe a candidate to switch to KDE neon.
I don't trust too much in Forbes & Co. I prefer true amateur site like distrowatch itsfoss aso.

Anyway I've downloaded the latest current (development) Slackware on which is possible to install KDE Plasma 5 so we will see if it's really a KDE trouble or Big Corps Linux without GNU, as I suspect, is defective by design developed with addition of useless daemons and init system injected with binary to follow the road opened by #M$ to bootlick hardware manufacturers to convince them to install their OS's cause they will ensure them a quicker, not needed by normal user, hardware turnover and consequently new hardware sales they won't never had.
i.e. Dell supplies PC with Ubuntu Brought to you by Canonical with Headquarter in the Isle of Man to pay less taxes.

I prefer the true GNU/Linux phylosophy which was recycle instead to toss thanks to GNU/Linux also cause toss still functioning hardware to me it's a crime against environment and it worsen #ClimateChange.

Today I will do some tries.
 
1 members found this post helpful.
Old 12-31-2019, 05:23 PM   #14
walker
Member
 
Registered: Nov 2003
Distribution: antiX-17.4.1_x64 base Custom
Posts: 172

Rep: Reputation: 37
Quote:
Originally Posted by Basslord1124 View Post
As others have said, it's probably KDE. KDE is probably one of the resource hungry of user interfaces. I used to use way back, but haven't used it in many many years. I say change your GUI or if you want to keep using it, I'd recommend upgrading your RAM.
Yes!
You, and me, are right.

A 4GB machine is nowadays too weak for Big Corps. Linux maybe they did agreement with hardware vendors, as I suspect, to help them in selling not needed new hardware cause sales are plunging.

A crazy friend give me some days ago a 4 years old 17" HP Laptop with a Core I5 4210U 8GB ram and a 256GB SDD (I keep it as last resort cause I need portability that's why I use old netbooks).
On it he installed Makulu Linux Core derived from Debian so without snapd and all other Ubuntu candies and anyway the bare system as soon as switched on has a memory consumption of 586MB.

On the same machine I had run live AUSTRUMI a Slackware derivative without systemd and Canonical eye candies it runs with 184MB.

It's impossibile to find Kubuntu system requirement and this is not so polite but looking at standard Ubuntu (with Gnome 3) requirements....

Ubuntu Desktop System Requirements

ychaouche is forced to upgrade the ram or switch to a true GNU/Linux distro not bloated with useless services and which wastes ram to load more than once and maybe more than twice the same library only in different version to install with a click statically linked executable.

Sad to say but this is the truth, a machine with 4GB ram which I could use still for years for a newbie or for who follows the herd is an ewaste.

Hope this helped.

I'm here to help eventually in choosing and using other to avoid to give away money for a not needed memory upgrade or ever worse to toss a still perfect functioning PC only cause a Big Corp has decided so.

Btw. @ychaouche if you want a KDE out of the box suitable for newcomers give a spin to PCLinuxOS
It has KDE but a minimum memory requirement which is an half of Ubuntu Desktop 2GB minimum instead of 4GB

Let us know!

Last edited by walker; 12-31-2019 at 06:28 PM.
 
2 members found this post helpful.
Old 01-01-2020, 09:07 AM   #15
greencedar
Member
 
Registered: Sep 2018
Location: Missouri
Distribution: Ubuntu 18.04 Bionic Beaver & Linux Mint 19.1 Tessa
Posts: 798
Blog Entries: 1

Rep: Reputation: 78
I found the information concerning swap in this website helpful in what is going on with swap.

https://www.linuxatemyram.com/play.html
 
2 members found this post helpful.
  


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
Does a swap usage of 100% indicates swapping despite low memory usage? redhatwannabe Linux - Hardware 9 12-09-2018 08:42 AM
'Cognitive performance may peak in late summer and early fall and decline in late winter and early spring - at least in the Northern hemisp RandomTroll General 2 11-16-2018 04:12 AM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 05:45 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 08:58 PM
Activating swap partition early in install Septus Linux - Newbie 3 09-10-2003 11:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

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