{"id":2476,"date":"2022-08-30T15:25:11","date_gmt":"2022-08-30T15:25:11","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/17\/kswapd0-takes-99-to-100-cpu-in-rhel-6-3-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:25:11","modified_gmt":"2022-08-30T15:25:11","slug":"kswapd0-takes-99-to-100-cpu-in-rhel-6-3-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/kswapd0-takes-99-to-100-cpu-in-rhel-6-3-collection-of-common-programming-errors\/","title":{"rendered":"kswapd0 takes 99% to 100% CPU in RHEL 6.3-Collection of common programming errors"},"content":{"rendered":"<p>I have 5 systems on which I have just installed RHEL6. System configuration is<\/p>\n<p>CPU-i7<\/p>\n<p>HDD-500 GB<\/p>\n<p>RAM-2 GB<\/p>\n<p>Swap- 4 GB<\/p>\n<p>I have installed the same software&#8217;s and all the configuration as per old systems.<\/p>\n<p>But my New systems running at low speed!<\/p>\n<p>top command output is as below:<\/p>\n<pre><code>[root@localhost ~]# top\n\ntop - 12:27:56 up 24 min,  3 users,  load average: 1.00, 1.00, 0.82\nTasks: 214 total,   2 running, 212 sleeping,   0 stopped,   0 zombie\nCpu(s):  1.1%us, 13.0%sy,  0.0%ni, 85.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st\n<\/code><\/pre>\n<p>I don&#8217;t have such problem in my old systems which are having less configuration than new systems!<\/p>\n<p><strong>Update 1:<\/strong><\/p>\n<p>I agree with Michael and Vonbrand.. But I still have my system very very slow. Specially when I am compiling something in my QtCreator. Even my mouse movement got slow.<\/p>\n<p>I checked by adding comment before swap partition in <code>\/etc\/fstab<\/code> and rebooting, The swap shows 0.0GB but kswapd0 still using 99% to 100%.<\/p>\n<p>Why other processors are not utilizing full!<\/p>\n<p>My RAM (2GB) is less<\/p>\n<p>OR<\/p>\n<p>Is there any service which m*<em>Update 2:<\/em>*anages CPU is not started?<\/p>\n<p><strong>Update 2:<\/strong> The output of dmesg is<\/p>\n<pre><code>  ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver\n  alloc irq_desc for 16 on node -1\n  alloc kstat_irqs on node -1\nalloc irq_2_iommu on node -1\nehci_hcd 0000:00:1a.0: PCI INT A -&gt; GSI 16 (level, low) -&gt; IRQ 16\nehci_hcd 0000:00:1a.0: setting latency timer to 64\nehci_hcd 0000:00:1a.0: EHCI Host Controller\nehci_hcd 0000:00:1a.0: new USB bus registered, assigned bus number 1\nehci_hcd 0000:00:1a.0: debug port 2\nehci_hcd 0000:00:1a.0: cache line size of 64 is not supported\nehci_hcd 0000:00:1a.0: irq 16, io mem 0xf7c38000\nehci_hcd 0000:00:1a.0: USB 2.0 started, EHCI 1.00\nusb usb1: New USB device found, idVendor=1d6b, idProduct=0002\nusb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1\nusb usb1: Product: EHCI Host Controller\nusb usb1: Manufacturer: Linux 2.6.32-71.el6.x86_64 ehci_hcd\nusb usb1: SerialNumber: 0000:00:1a.0\nusb usb1: configuration #1 chosen from 1 choice\nhub 1-0:1.0: USB hub found\nhub 1-0:1.0: 3 ports detected\n  alloc irq_desc for 23 on node -1\n  alloc kstat_irqs on node -1\nalloc irq_2_iommu on node -1\nehci_hcd 0000:00:1d.0: PCI INT A -&gt; GSI 23 (level, low) -&gt; IRQ 23\nehci_hcd 0000:00:1d.0: setting latency timer to 64\nehci_hcd 0000:00:1d.0: EHCI Host Controller\nehci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2\nehci_hcd 0000:00:1d.0: debug port 2\nehci_hcd 0000:00:1d.0: cache line size of 64 is not supported\nehci_hcd 0000:00:1d.0: irq 23, io mem 0xf7c37000\nehci_hcd 0000:00:1d.0: USB 2.0 started, EHCI 1.00\nusb usb2: New USB device found, idVendor=1d6b, idProduct=0002\nusb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1\nusb usb2: Product: EHCI Host Controller\nusb usb2: Manufacturer: Linux 2.6.32-71.el6.x86_64 ehci_hcd\nusb usb2: SerialNumber: 0000:00:1d.0\nusb usb2: configuration #1 chosen from 1 choice\nhub 2-0:1.0: USB hub found\nhub 2-0:1.0: 3 ports detected\nohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver\nuhci_hcd: USB Universal Host Controller Interface driver\nPNP: PS\/2 Controller [PNP0303:PS2K,PNP0f03:PS2M] at 0x60,0x64 irq 1,12\nserio: i8042 KBD port at 0x60,0x64 irq 1\nserio: i8042 AUX port at 0x60,0x64 irq 12\nmice: PS\/2 mouse device common for all mice\nrtc_cmos 00:06: RTC can wake from S4\nrtc_cmos 00:06: rtc core: registered rtc_cmos as rtc0\nrtc0: alarms up to one month, y3k, 242 bytes nvram, hpet irqs\ncpuidle: using governor ladder\ncpuidle: using governor menu\nusbcore: registered new interface driver hiddev\nusbcore: registered new interface driver usbhid\nusbhid: v2.6:USB HID core driver\nTCP cubic registered\nInitializing XFRM netlink socket\nNET: Registered protocol family 17\nregistered taskstats version 1\nIMA: No TPM chip found, activating TPM-bypass!\nrtc_cmos 00:06: setting system clock to 2013-03-04 14:10:29 UTC (1362406229)\nInitalizing network drop monitor service\nFreeing unused kernel memory: 1220k freed\nWrite protecting the kernel read-only data: 7176k\ndracut: dracut-004-32.el6\ndracut: rd_NO_LUKS: removing cryptoluks activation\ndracut: rd_NO_LVM: removing LVM activation\ndevice-mapper: uevent: version 1.0.3\ndevice-mapper: ioctl: 4.17.0-ioctl (2010-03-05) initialised: dm-devel@redhat.com\nudev: starting version 147\ndracut: Starting plymouth daemon\ndracut: rd_NO_DM: removing DM RAID activation\ndracut: rd_NO_MD: removing MD RAID activation\nahci 0000:00:1f.2: version 3.0\nahci 0000:00:1f.2: PCI INT B -&gt; GSI 19 (level, low) -&gt; IRQ 19\n  alloc irq_desc for 31 on node -1\n  alloc kstat_irqs on node -1\nalloc irq_2_iommu on node -1\nahci 0000:00:1f.2: irq 31 for MSI\/MSI-X\nahci 0000:00:1f.2: AHCI 0001.0300 32 slots 6 ports 6 Gbps 0x5 impl SATA mode\nahci 0000:00:1f.2: flags: 64bit ncq pm led clo pio slum part ems apst \nahci 0000:00:1f.2: setting latency timer to 64\nscsi0 : ahci\nscsi1 : ahci\nscsi2 : ahci\nscsi3 : ahci\nscsi4 : ahci\nscsi5 : ahci\nata1: SATA max UDMA\/133 abar m2048@0xf7c36000 port 0xf7c36100 irq 31\nata2: DUMMY\nata3: SATA max UDMA\/133 abar m2048@0xf7c36000 port 0xf7c36200 irq 31\nata4: DUMMY\nata5: DUMMY\nata6: DUMMY\nusb 1-1: new high speed USB device using ehci_hcd and address 2\nusb 1-1: New USB device found, idVendor=8087, idProduct=0024\nusb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0\nusb 1-1: configuration #1 chosen from 1 choice\nhub 1-1:1.0: USB hub found\nhub 1-1:1.0: 6 ports detected\nata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)\nata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)\nata1.00: ACPI _SDD failed (AE 0x5)\nata3.00: ACPI _SDD failed (AE 0x5)\nusb 2-1: new high speed USB device using ehci_hcd and address 2\nusb 2-1: New USB device found, idVendor=8087, idProduct=0024\nusb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0\nusb 2-1: configuration #1 chosen from 1 choice\nhub 2-1:1.0: USB hub found\nhub 2-1:1.0: 8 ports detected\nusb 2-1.3: new low speed USB device using ehci_hcd and address 3\nusb 2-1.3: New USB device found, idVendor=04ca, idProduct=0062\nusb 2-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0\nusb 2-1.3: Product: USB Optical Mouse\nusb 2-1.3: configuration #1 chosen from 1 choice\ninput: USB Optical Mouse as \/devices\/pci0000:00\/0000:00:1d.0\/usb2\/2-1\/2-1.3\/2-1.3:1.0\/input\/input3\ngeneric-usb 0003:04CA:0062.0001: input,hidraw0: USB HID v1.11 Mouse [USB Optical Mouse] on usb-0000:00:1d.0-1.3\/input0\nusb 2-1.4: new low speed USB device using ehci_hcd and address 4\nusb 2-1.4: New USB device found, idVendor=03f0, idProduct=0024\nusb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0\nusb 2-1.4: Product: HP Basic USB Keyboard\nusb 2-1.4: Manufacturer: CHICONY\nusb 2-1.4: configuration #1 chosen from 1 choice\ninput: CHICONY HP Basic USB Keyboard as \/devices\/pci0000:00\/0000:00:1d.0\/usb2\/2-1\/2-1.4\/2-1.4:1.0\/input\/input4\ngeneric-usb 0003:03F0:0024.0002: input,hidraw1: USB HID v1.11 Keyboard [CHICONY HP Basic USB Keyboard] on usb-0000:00:1d.0-1.4\/input0\nata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)\nata3.00: ACPI _SDD failed (AE 0x5)\nata3.00: ACPI: failed the second time, disabled\nata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)\nata3.00: ATAPI: hp      DVD-RAM GH82N, R204, max UDMA\/100, ATAPI AN\nata1.00: ACPI _SDD failed (AE 0x5)\nata1.00: ACPI: failed the second time, disabled\nata1.00: ATA-8: ST500DM002-1BD142, HP73, max UDMA\/100\nata1.00: 976773168 sectors, multi 16: LBA48 NCQ (depth 31\/32)\nata1.00: configured for UDMA\/100\nata3.00: configured for UDMA\/100\nscsi 0:0:0:0: Direct-Access     ATA      ST500DM002-1BD14 HP73 PQ: 0 ANSI: 5\nscsi 2:0:0:0: CD-ROM            hp       DVD-RAM GH82N    R204 PQ: 0 ANSI: 5\nsd 0:0:0:0: [sda] 976773168 512-byte logical blocks: (500 GB\/465 GiB)\nsd 0:0:0:0: [sda] 4096-byte physical blocks\nsd 0:0:0:0: [sda] Write Protect is off\nsd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00\nsd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA\n sda: sda1 sda2 sda3 sda4 &lt; sda5 sda6 sda7 &gt;\nsd 0:0:0:0: [sda] Attached SCSI disk\nsr0: scsi3-mmc drive: 40x\/40x writer dvd-ram cd\/rw xa\/form2 cdda tray\nUniform CD-ROM driver Revision: 3.20\nsr 2:0:0:0: Attached scsi CD-ROM sr0\nEXT4-fs (sda7): INFO: recovery required on readonly filesystem\nEXT4-fs (sda7): write access will be enabled during recovery\nEXT4-fs (sda7): orphan cleanup on readonly fs\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 15341115\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835089\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835088\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835087\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835085\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835081\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835080\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835079\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835076\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835075\nEXT4-fs (sda7): ext4_orphan_cleanup: deleting unreferenced inode 1835067\nEXT4-fs (sda7): 11 orphan inodes deleted\nEXT4-fs (sda7): recovery complete\nEXT4-fs (sda7): mounted filesystem with ordered data mode\ndracut: Mounted root filesystem \/dev\/sda7\ndracut: Loading SELinux policy\nSELinux:  Disabled at runtime.\nSELinux:  Unregistering netfilter hooks\ntype=1404 audit(1362406240.622:2): selinux=0 auid=4294967295 ses=4294967295\ndracut: \/sbin\/load_policy: Can't load policy: No such file or directory\ndracut: Switching root\nudev: starting version 147\ne1000e: Intel(R) PRO\/1000 Network Driver - 1.2.7-k2\ne1000e: Copyright (c) 1999 - 2009 Intel Corporation.\n  alloc irq_desc for 20 on node -1\n  alloc kstat_irqs on node -1\nalloc irq_2_iommu on node -1\ne1000e 0000:00:19.0: PCI INT A -&gt; GSI 20 (level, low) -&gt; IRQ 20\ne1000e 0000:00:19.0: setting latency timer to 64\n  alloc irq_desc for 32 on node -1\n  alloc kstat_irqs on node -1\nalloc irq_2_iommu on node -1\ne1000e 0000:00:19.0: irq 32 for MSI\/MSI-X\n0000:00:19.0: eth0: (PCI Express:2.5GB\/s:Width x1) 6c:3b:e5:13:26:21\n0000:00:19.0: eth0: Intel(R) PRO\/1000 Network Connection\n0000:00:19.0: eth0: MAC: 10, PHY: 11, PBA No: 0100ff-0ff\nsd 0:0:0:0: Attached scsi generic sg0 type 0\nsr 2:0:0:0: Attached scsi generic sg1 type 5\nACPI: WMI: Mapper loaded\nEXT4-fs (sda5): mounted filesystem with ordered data mode\nmicrocode: CPU0 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU1 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU2 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU3 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU4 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU5 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU6 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nmicrocode: CPU7 sig=0x306a9, pf=0x2, revision=0x12\nplatform microcode: firmware: requesting intel-ucode\/06-3a-09\nMicrocode Update Driver: v2.00 , Peter Oruba\nMicrocode Update Driver: v2.00 removed.\nip_tables: (C) 2000-2006 Netfilter Core Team\nNET: Registered protocol family 10\nlo: Disabled Privacy Extensions\ne1000e 0000:00:19.0: irq 32 for MSI\/MSI-X\ne1000e 0000:00:19.0: irq 32 for MSI\/MSI-X\nADDRCONF(NETDEV_UP): eth0: link is not ready\ne1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None\nADDRCONF(NETDEV_CHANGE): eth0: link becomes ready\neth0: no IPv6 routers present\nRPC: Registered udp transport module.\nRPC: Registered tcp transport module.\nRPC: Registered tcp NFSv4.1 backchannel transport module.\nBridge firewalling registered\nvirbr0: starting userspace STP failed, starting kernel STP\nnf_conntrack version 0.5.0 (16384 buckets, 65536 max)\nEbtables v2.0 registered\nfuse init (API version 7.13)\nip6_tables: (C) 2000-2006 Netfilter Core Team\nlo: Disabled Privacy Extensions\ntun: Universal TUN\/TAP device driver, 1.6\ntun: (C) 1999-2004 Max Krasnyansky \ndevice vnet0 entered promiscuous mode\nvirbr0: topology change detected, propagating\nvirbr0: port 1(vnet0) entering forwarding state\nvnet0: no IPv6 routers present\nkvm: 3639: cpu0 unimplemented perfctr wrmsr: 0xc1 data 0x0\nkvm: 3639: cpu0 unimplemented perfctr wrmsr: 0x186 data 0x130079\nkvm: 3639: cpu0 unimplemented perfctr wrmsr: 0xc1 data 0xffcc3e1a\nkvm: 3639: cpu0 unimplemented perfctr wrmsr: 0x186 data 0x530079\nkvm: 3639: cpu1 unimplemented perfctr wrmsr: 0xc1 data 0x0\nkvm: 3639: cpu1 unimplemented perfctr wrmsr: 0x186 data 0x130079\nkvm: 3639: cpu1 unimplemented perfctr wrmsr: 0xc1 data 0xffcc3e1a\nkvm: 3639: cpu1 unimplemented perfctr wrmsr: 0x186 data 0x530079\nkvm: 3639: cpu2 unimplemented perfctr wrmsr: 0xc1 data 0x0\nvirbr0: port 1(vnet0) entering disabled state\ndevice vnet0 left promiscuous mode\nvirbr0: port 1(vnet0) entering disabled state\n<\/code><\/pre>\n<p>I didn&#8217;t noticed anything related to swap here.<\/p>\n<p><strong>Update 3:<\/strong> See my Answer Below:<\/p>\n<ol>\n<li>\n<p><strong>Kernel Bug:<\/strong> I think my problem is with kernel as noticed by goldilocks. As I increased my RAM to 4GB all processes are stable, even with core 2 intel processor box with 2GB RAM is also working fine.<\/p>\n<\/li>\n<li>\n<p>Like @vonbrand points out, the CPU usage percentage is by default based on a single CPU. So if a process has multiple threads, on a multi-core or multi-CPU system this number can very easily exceed 100%.<\/p>\n<p>Take a look at the totals found in the <code>Cpu(s)<\/code> line near the top; it says that your system was spending 1.1% of its time in userspace, 13.0% in system code (basically the kernel), and 85.9% idle. This aligns well with a multi-core CPU where one core is operating at 100%.<\/p>\n<p>You can switch <code>top<\/code> between so-called Irix mode and Solaris mode by pressing I. With Irix mode <em>off<\/em>, the CPU usage displayed will be across all CPUs and\/or cores, whereas with Irix mode <em>on<\/em>, one fully utilized core will display as 100% even on a fully-equipped multiprocessor system. Hence, with Irix mode off, on a hypothetical 10-core system with two cores fully utilized and the others fully idle, CPU usage will be shown as the expected 20% rather than 200%.<\/p>\n<\/li>\n<li>\n<p>The % CPU is on basis of <em>one<\/em> CPU, so it can very well be several times 100%. And load averages (the mean number of processes waiting for CPU) is low, the machine is almost 90% idle. No reason to worry.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-01-17 07:10:12. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have 5 systems on which I have just installed RHEL6. System configuration is CPU-i7 HDD-500 GB RAM-2 GB Swap- 4 GB I have installed the same software&#8217;s and all the configuration as per old systems. But my New systems running at low speed! top command output is as below: [root@localhost ~]# top top &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2476","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2476"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2476\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}