kswapd0 uses 50% (100% on 1 core of 2) of cpu all the time after waking from sleep

Whenever I wake my laptop from sleep (RAM), kswapd0 always uses 50% of the CPU all the time. It basically uses 100% of one of the 2 cores I have in my laptop. It only happens after I wake my system from sleep. It happens even if swap is not used a lot. When I wake up the system only 2MB of 4093MB of swap was used. I tried switching swap off and on and that did not bring the usage down.

This high usage does not stop even an hour after I wake the system from Sleep. Only solution is to restart my laptop. It makes my system practically unusable, since I have to work on resource intensive programs.

Please help me. I am sick an tired of restarting my laptop everytime I use.

KDE 4.8.3 Release 504
Kernel : 3.4.0-2-desktop #1 SMP PREEMPT Sun May 27 19:46:37 UTC 2012 (8353c9e) x86_64 x86_64 x86_64 GNU/Linux

Opensuse 12.1 64-bit

Seems to be an ongoing kernel bug, related to low RAM + heavy IO + a lot of small files OR transfer of 2GB+ files:

https://bugzilla.redhat.com/show_bug.cgi?id=712019
Citrix Forums : kswapd0 process consumes a guest VM …

Things you could try after reading the links above to better understand if they are applicable or not:


echo 1 > /proc/sys/vm/drop_caches

And virtual memory settings (in /etc/sysctl?):

vm.dirty_background_ratio = 3          (default was 10, had tried 5))
 vm.dirty_expire_centisecs = 500       (default was 3000, had tried 1000)
vm.dirty_ratio = 15                            (default was 40)
vm.dirty_writeback_centisecs = 100  (default was 500)


FWIW in a netbook with oS 12.1 KDE 4.8.3 release 503 kernel 3.1.10-1.9-desktop #1 SMP PREEMPT x86_64 and 2GB RAM (later upgraded to 8GB) I’ve never seen this happen.

and that is the first thing I noticed too: OP reports not the stock KDE, not the stock kernel, and not Tumbleweed (where I don’t have the issue).

@OP: consider downgrading the kernel, since the stock kernel doesn;t seem to produce the erronic behaviour. That’s one. Another thing that we could take a look at is the repo configuration. Please post output of


zypper lr -d

between CODE tags

Thanks for the input guys. Meanwhile I will try to downgrade kernel to stock and see if the problem goes away.

here is the repo list:


#  | Alias                   | Name                       | Enabled | Refresh | Priority | Type   | URI                                                                                | Service
---+-------------------------+----------------------------+---------+---------+----------+--------+------------------------------------------------------------------------------------+--------
 1 | KDE_4.8                 | KDE 4.8                    | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/KDE:/Release:/48/openSUSE_12.1/          |        
 2 | KDE_4.8_EXTRA           | KDE 4.8 EXTRA              | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/KDE:/Extra/KDE_Release_48_openSUSE_12.1/ |        
 3 | Kernel                  | Kernel                     | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/Kernel:/stable/standard/                 |        
 4 | Please_try_again        | Please_try_again           | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_12.1/    |        
 5 | Wifi_update             | Wifi update                | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/driver:/wireless/12.1-update/            |        
 6 | Wildnux                 | Wildnux                    | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/home:/wildnux/openSUSE_12.1/             |        
 7 | fglrx                   | fglrx                      | Yes     | Yes     |   99     | rpm-md | http://geeko.ioda.net/mirror/ati/openSUSE_12.1/                                    |        
 8 | google-chrome           | google-chrome              | Yes     | Yes     |   99     | rpm-md | http://dl.google.com/linux/chrome/rpm/stable/x86_64                                |        
 9 | google-talkplugin       | google-talkplugin          | Yes     | Yes     |   99     | rpm-md | http://dl.google.com/linux/talkplugin/rpm/stable/x86_64                            |        
10 | home:enzokiel           | home:enzokiel              | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/repositories/home:/enzokiel/openSUSE_12.1_Update/     |        
11 | openSUSE:12.1           | openSUSE:12.1              | Yes     | Yes     |   99     | yast2  | http://download.opensuse.org/distribution/12.1/repo/oss/                           |        
12 | opensuse-guide.org-repo | libdvdcss repository       | Yes     | Yes     |   99     | rpm-md | http://opensuse-guide.org/repo/12.1/                                               |        
13 | packman.inode.at-suse   | Packman Repository         | Yes     | Yes     |   99     | rpm-md | http://packman.inode.at/suse/12.1/                                                 |        
14 | repo-debug              | openSUSE-12.1-Debug        | No      | Yes     |   99     | NONE   | http://download.opensuse.org/debug/distribution/12.1/repo/oss/                     |        
15 | repo-debug-update       | openSUSE-12.1-Update-Debug | No      | Yes     |   99     | NONE   | http://download.opensuse.org/debug/update/12.1/                                    |        
16 | repo-non-oss            | openSUSE-12.1-Non-Oss      | Yes     | Yes     |   99     | yast2  | http://download.opensuse.org/distribution/12.1/repo/non-oss/                       |        
17 | repo-oss                | openSUSE-12.1-Oss          | Yes     | Yes     |   99     | yast2  | http://download.opensuse.org/distribution/12.1/repo/oss/                           |        
18 | repo-source             | openSUSE-12.1-Source       | No      | Yes     |   99     | NONE   | http://download.opensuse.org/source/distribution/12.1/repo/oss/                    |        
19 | repo-update             | openSUSE-12.1-Update       | Yes     | Yes     |   99     | rpm-md | http://download.opensuse.org/update/12.1/                                          |        


I am sorry to say but this is a bug of OpenSUSE!

I visited today a friend, he has a mini ITX (i5-2500, 4GB RAM, intel HD 2000 gfx ) and asked me to install a “light” Linux to play mp4 videos.
so far so good I installed the OpenSUSE 12.2 x64 (XFCE desktop) + packman repo, to say the truth the system WAS crawled like hell when he
tried to play those videos.

Then I decided to install Linux Mint (well not my cup of tea as I prefer RPM based distros), so far so good the guy enjoys those videos without any problem! Can’t believe that OpenSUSE failed on this…

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This has, exactly, what to do with the five-month old issue that was
identified as a general kernel bug specific to resuming from sleep?

Good luck.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJQuTOnAAoJEF+XTK08PnB5eacP/3PDL8WWl09v3EdiOkCfMXm+
oAU1T+obD1dsnaZqo0c5cCncFK3zhvjiuyIZv0FBHrp2nwxLHzr+HyBLxJz9oBN+
z2omi1XDI+W9uWSu9xR1kwewFVtZMfuo720lyZPULgOxgYP+/hNBYORYwDCcgS6I
aZAiNsJ68Xi5/hQTpVowJx3wwdNupuE4gvFGxQgiiwCgzv03+qxvpL2rHF5vbsV3
eu+p8WhDMb5iiZJyBlR8EHGywMu2rKV2ejuWojlnNb1R0i2BL2oBpz4ETH9opjwb
F5yTtm9HqLO3FnqR6psrfsHvKwrBgxA3SOBom0rAriw20eGAy7+lW9J0F/5RXMxP
Jj7Q9UtZt+F69QD8EQmEbj9btfD8PxAvy9DSKXn0z0jBd7J81CzV6C38rREo3YdO
oH6qgMW23t1Gm43oknIWmofskmQmdgIfGCJcTXGtg/z9zCygzo4zl1GEZDUUrCTN
PaHiwRv0+rg1qVfvlrz/h7r2xA22qkO8yIntBJdfj/y73jI1erfp3iY5MgKtZLmq
Z4c9xI53Tqr7QppUmVcibuxclXeYzmmHZA7samoYcSiF04ubUNcv8T2yjOA3hX6G
vNRzoueiiX1ez5hRlEvrzF4estR7lTFVHAldura7X/Ohin6VzU/jH3qlGA8lOsXN
5NHVSXkDkKjNymJ++A+O
=JL6M
-----END PGP SIGNATURE-----

Its so sad that I still have this problem with opensuse 12.2 (3.4.11-2.16-desktop) with KDE (Platform Version 4.9.3 “release 520”).

According to the following script (I found it from stackoverflow), total swap used = 0kb. but still kswapd0 is trying to bring my cpu to its knees. :frowning:

#!/bin/bash

    # find-out-what-is-using-your-swap.sh
    # -- Get current swap usage for all running processes
    # --
    # -- rev.0.3, 2012-09-03, Jan Smid          - alignment and intendation, sorting
    # -- rev.0.2, 2012-08-09, Mikko Rantalainen - pipe the output to "sort -nk3" to get sorted output
    # -- rev.0.1, 2011-05-27, Erik Ljungstrom   - initial version


SCRIPT_NAME=`basename $0`;
SORT="kb";                 # {pid|kB|name} as first parameter, [default: kb]
 "$1" != "" ] && { SORT="$1"; }

 ! -x `which mktemp` ] && { echo "ERROR: mktemp is not available!"; exit; }
MKTEMP=`which mktemp`;
TMP=`${MKTEMP} -d`;
 ! -d "${TMP}" ] && { echo "ERROR: unable to create temp dir!"; exit; }

>${TMP}/${SCRIPT_NAME}.pid;
>${TMP}/${SCRIPT_NAME}.kb;
>${TMP}/${SCRIPT_NAME}.name;

SUM=0;
OVERALL=0;
    echo "${OVERALL}" > ${TMP}/${SCRIPT_NAME}.overal;

for DIR in `find /proc/ -maxdepth 1 -type d -regex "^/proc/[0-9]+"`;
do
    PID=`echo $DIR | cut -d / -f 3`
    PROGNAME=`ps -p $PID -o comm --no-headers`

    for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
    do
        let SUM=$SUM+$SWAP
    done

    if (( $SUM > 0 ));
    then
        echo -n ".";
        echo -e "${PID}	${SUM}	${PROGNAME}" >> ${TMP}/${SCRIPT_NAME}.pid;
        echo -e "${SUM}	${PID}	${PROGNAME}" >> ${TMP}/${SCRIPT_NAME}.kb;
        echo -e "${PROGNAME}	${SUM}	${PID}" >> ${TMP}/${SCRIPT_NAME}.name;
    fi
    let OVERALL=$OVERALL+$SUM
    SUM=0
done
echo "${OVERALL}" > ${TMP}/${SCRIPT_NAME}.overal;
echo;
echo "Overall swap used: ${OVERALL} kB";
echo "========================================";
case "${SORT}" in
    name )
        echo -e "name	kB	pid";
        echo "========================================";
        cat ${TMP}/${SCRIPT_NAME}.name|sort -r;
        ;;

    kb )
        echo -e "kB	pid	name";
        echo "========================================";
        cat ${TMP}/${SCRIPT_NAME}.kb|sort -rh;
        ;;

    pid | * )
        echo -e "pid	kB	name";
        echo "========================================";
        cat ${TMP}/${SCRIPT_NAME}.pid|sort -rh;
        ;;
esac
rm -fR "${TMP}/"; 


Did you try killing the process? I’d try to do this with “top” in a terminal as root. Or perhaps there’s a start/stop script to do this, as with other services. Just guessing.

found a workaround:

kswapd0 calms down after running the following as root:

echo 3 > /proc/sys/vm/drop_caches

Source: https://bbs.archlinux.org/viewtopic.php?id=144702

On 2012-12-05 02:46, brunomcl wrote:
>
> Did you try killing the process?

You can not kill kswapd0. The k is for kernel, not for kde.


Cheers / Saludos,

Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)

Its kind of weird, but there is a problem with kswapd in kernel 3.7 it would appear: Gmane Loom, if we are talking about the same thing.

Thank You,

The problem is gone with Kernel 3.7.1-1 from Index of /repositories/Kernel:/stable/standard

Welcome.I add to the topic, because I have a similar situation as I leave the computer without using kilkagodzin and then run. dim the screen.I have a Linux kernel xxxxxxxl 3.7.7-1-desktop # 1 SMP PREEMPT Mon Feb 11 10:47:39 p.m. UTC 2013 (aeb2714) x86_64 x86_64 x86_64 GNU / LinuxWhat could be the reason?