LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-08-2020, 09:16 PM   #1
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Rep: Reputation: 253Reputation: 253Reputation: 253
kswapd0 freezing the system for a few seconds once a while


Hello, everyone.

This started happening since I moved to a different laptop with the same Slackware on an SSD. The hardware configuration is very different from what I have been using before (/home is on and SSD now, intel video card).

I still have a swap partition on sdb2.

So what started happening on the new laptop: the system periodically freezes for a few seconds, with iotop showing high IO (>95%); READ and WRITE stay small, an order of kilobytes. This happens regardless of memory consumption, it may be that there is still >4Gb memory free.


Freezes disappear if swap is turned off, but I do use swap extensively, both for running a lot of software at the boot time (restoring from swap is faster than launching) and for hibernation.

How to debug this?

UPDATE:

I found part of the cause. My /tmp is on tmpfs, and the FS was constantly swapping out.
The problem is that it is slowing the system! weird. I'd expect the least used files in tmpfs to be swapped out.

Last edited by Lockywolf; 12-08-2020 at 10:49 PM.
 
Old 12-09-2020, 09:00 AM   #2
walecha
Member
 
Registered: Jan 2010
Location: Malang, +62
Distribution: slackware
Posts: 174

Rep: Reputation: 42
Maybe you had some sysctl tuning for swapping?

I'm also using tmpfs for /tmp. I have 16 GB of RAM and my slackware almost never touching swap except when I had to hibernate. I'm using this sysctl tuning:
Code:
# cat /etc/sysctl.d/vm.conf
vm.swappiness=10
vm.overcommit_memory=1
 
Old 12-09-2020, 07:36 PM   #3
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Original Poster
Rep: Reputation: 253Reputation: 253Reputation: 253
Code:
echo none > /sys/block/sdb/queue/scheduler
echo none > /sys/block/sda/queue/scheduler

echo 1 > /proc/sys/vm/vfs_cache_pressure
echo 50 > /proc/sys/vm/dirty_ratio # default is 20. Potential data loss.
echo 25 > /proc/sys/vm/dirty_background_ratio # default is 10. Potential data loss.
That's it, basically.

I actually wouldn't mind offloading tmpfs to swap. It shouldn't be slow. Say, you're building a lot of stuff from SBo, and build directories take about ~10-20 Gb of space. It should be fine to offload almost all of that into swap, as only a single package's data is used at the moment.
 
Old 12-10-2020, 08:06 PM   #4
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Original Poster
Rep: Reputation: 253Reputation: 253Reputation: 253
Hm... everything is still slow for unknown reasons... both HDDs are fast, I don't know what's going on.
 
Old 12-20-2020, 11:09 PM   #5
Lockywolf
Member
 
Registered: Jul 2007
Posts: 683

Original Poster
Rep: Reputation: 253Reputation: 253Reputation: 253
Okay, the freezes almost disappeared with two tricks:

Turning off NCQ completely: add libata.force=noncq to the kernel boot string.
And turn on hdd caching in /etc/rc.d/rc.local: hdparm -W1 /dev/sda


I guess, NCQ could be tuned instead of being turned off, by setting the queue length, but I didn't bother.
I saw some improvements with using the mq-deadline scheduler and tuning the knobs, but at the moment the system is working fine with none scheduler, so I didn't bother tuning it again.

That's basically it.
 
  


Reply

Tags
hibernation, memory, slackware, swap



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
kswapd0 eats 100% CPU, drives up system load ravindert Linux - Newbie 8 07-25-2012 08:49 PM
[SOLVED] kswapd0 - smbd - Very high use of hard-drive thus very bad system response qlands Linux - Software 1 10-06-2010 08:53 AM
[SOLVED] Experiencing freezing up to 5 seconds every 10 seconds, could these be the problem? Switch7 Slackware 10 11-16-2009 04:36 PM
kswapd0, why must you cripple me so? f0rmula Linux - Software 3 01-13-2005 12:45 PM
SUSE 9.1 freezing every few seconds. rayasam005 Linux - Newbie 2 06-10-2004 12:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:03 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