Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kswapd0 consume most CPU
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
XiaoaiX
n00b
n00b


Joined: 30 May 2015
Posts: 7

PostPosted: Wed Aug 19, 2015 5:41 am    Post subject: Kswapd0 consume most CPU Reply with quote

I am using kernel 4.05. I always keep open some pdf files (about 10) with okular and a lot of webpages in firefox. From time to time, the system become very slow. top shows that kswapd0 consumes 100% CPU and changes slowly down. After a while, always if it is lucky, the kswapd0 disappears and the system come back to usual. But in seldom cases, the system will not response if I just open some resource consuming webpage in firefox, and I have to reboot.

My system have 8G memory, 512G SSD. No swap is on.

Can I avoid such things happening without closing those pdf files and webpages?

Or can I find out which process consumes the memory most?

Thanks
Back to top
View user's profile Send private message
ct85711
Guru
Guru


Joined: 27 Sep 2005
Posts: 537

PostPosted: Wed Aug 19, 2015 3:13 pm    Post subject: Reply with quote

well, it's sounds like you are eating away all of your memory doing all that (specially on only 8GB without swap). The common trend I was seeing for this, is just about the same you was doing, about 8GB of ram and no swap, interestingly enough, the easy fix was adding a swap file (kswapd stopped hogging the CPU)...

Well, best bet to check on memory usage would be firefox (always a hog), though on my system I have one pdf file that makes firefox's worse memory usage look like child's play (in ocular, it usually filled over 12GB of ram easily by it's self).

The 2 prime things to check, is good old top and free -m
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 3918
Location: The Peanut Gallery

PostPosted: Wed Aug 19, 2015 4:42 pm    Post subject: Reply with quote

Just to add a recommendation for sys-process/htop.

Really nice, and allows you to view by-thread, if required.
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 601

PostPosted: Wed Aug 19, 2015 10:14 pm    Post subject: Reply with quote

Sounds like a desktop machine. I have seen kswapd problems only on servers, and most likely along the lines of https://www.centos.org/forums/viewtopic.php?t=29411 (last posting in thread): free memory imbalance on systems with NUMA enabled.
Back to top
View user's profile Send private message
Buffoon
Apprentice
Apprentice


Joined: 17 Jun 2015
Posts: 295
Location: EU or US

PostPosted: Wed Aug 19, 2015 11:46 pm    Post subject: Reply with quote

Have you adjusted swappiness in sysctl.conf.
Back to top
View user's profile Send private message
XiaoaiX
n00b
n00b


Joined: 30 May 2015
Posts: 7

PostPosted: Mon Aug 24, 2015 10:13 am    Post subject: Reply with quote

Buffoon wrote:
Have you adjusted swappiness in sysctl.conf.


haven't done any thing in sysctl.conf. I don't know what swappiness in sysctl.conf means? Could you explain more?
Back to top
View user's profile Send private message
XiaoaiX
n00b
n00b


Joined: 30 May 2015
Posts: 7

PostPosted: Mon Aug 24, 2015 10:17 am    Post subject: Reply with quote

So, it seems that okular is not good at managing memory. I would change to acroread now.

ct85711 wrote:
well, it's sounds like you are eating away all of your memory doing all that (specially on only 8GB without swap). The common trend I was seeing for this, is just about the same you was doing, about 8GB of ram and no swap, interestingly enough, the easy fix was adding a swap file (kswapd stopped hogging the CPU)...

Well, best bet to check on memory usage would be firefox (always a hog), though on my system I have one pdf file that makes firefox's worse memory usage look like child's play (in ocular, it usually filled over 12GB of ram easily by it's self).

The 2 prime things to check, is good old top and free -m
Back to top
View user's profile Send private message
XiaoaiX
n00b
n00b


Joined: 30 May 2015
Posts: 7

PostPosted: Mon Aug 24, 2015 11:13 am    Post subject: Reply with quote

But why should kswapd0 use up all the cpu but not share with others? This seem to be a bug. In my opinion, a good way to do this is when the memory is used to about 90% and this kswapd0 be called to clear the memory. It then can share the cpu with others because the others can use the 10% left without waiting for kswapd0. Why not do like this?
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 3918
Location: The Peanut Gallery

PostPosted: Mon Aug 24, 2015 12:05 pm    Post subject: Reply with quote

XiaoaiX wrote:
haven't done any thing in sysctl.conf. I don't know what swappiness in sysctl.conf means? Could you explain more?

See this tip
Back to top
View user's profile Send private message
ct85711
Guru
Guru


Joined: 27 Sep 2005
Posts: 537

PostPosted: Mon Aug 24, 2015 2:11 pm    Post subject: Reply with quote

Quote:
But why should kswapd0 use up all the cpu but not share with others? This seem to be a bug. In my opinion, a good way to do this is when the memory is used to about 90% and this kswapd0 be called to clear the memory. It then can share the cpu with others because the others can use the 10% left without waiting for kswapd0. Why not do like this?


The issue with that, isn't the CPU usage, it's more of kswapd0 isn't finding any memory to clear out, so other stuff can start up/run. Trying to put more water in a tank that is already full does not work out, regardless of all the pushing you are doing. As it is, your getting close to triggering the kernel's memory killer to forcibly clear out memory (by killing running programs).

I'm not sure how changing the swappiness is going to do anything, when the OP even stated there is no swap to begin with. Now, you know you can easily just put a swap file/partition on a USB drive/external drive.
Back to top
View user's profile Send private message
Buffoon
Apprentice
Apprentice


Joined: 17 Jun 2015
Posts: 295
Location: EU or US

PostPosted: Mon Aug 24, 2015 2:55 pm    Post subject: Reply with quote

ct85711

what you said makes sense. I didn't read the OP thoroughly.

XiaoaiX

there is a known memory leak in QT 4.8.7, I know it because I had QT installed for MythTV and it just ate up all my RAM, downgraded to 4.8.6 and the problem went away.
Back to top
View user's profile Send private message
XiaoaiX
n00b
n00b


Joined: 30 May 2015
Posts: 7

PostPosted: Tue Aug 25, 2015 1:27 am    Post subject: Reply with quote

Buffoon wrote:
ct85711

what you said makes sense. I didn't read the OP thoroughly.

XiaoaiX

there is a known memory leak in QT 4.8.7, I know it because I had QT installed for MythTV and it just ate up all my RAM, downgraded to 4.8.6 and the problem went away.


I am using QT 4.8.6-r2 not QT 4.8.7.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum