从 13.04 升级后,当 RAM 满了时,响应速度会急剧下降

从 13.04 升级后,当 RAM 满了时,响应速度会急剧下降

自从我从 ubuntu 13.04 升级到 14.04(以及 13.10 之前)后,当内存满了,我的系统就崩溃了,必须开始交换。

当然我知道性能会受到影响,但这太过分了……甚至指针都停止工作了几秒钟,有一次我不得不手动重启笔记本电脑(我无法使用 ALT+Fx 切换到控制台来终止某些进程)。这通常发生在我使用 Google Chrome 时,当我打开过多的标签并且正在运行其他几个应用程序时,我仍然希望 Linux 的表现会比这好得多,我认为这从 13.10 和 14.04 开始发生。

我正在使用“系统负载指示器”(由 Hofmann 开发),当内存已满时,CPU 负载会达到 100%,如果我不立即启动以关闭东西,则混乱是不可避免的。

这是我的笔记本硬件规格:

lenovou310
    description: Laptop
    product: IdeaPad U310 (System SKUNumber)
    vendor: LENOVO
    version: Lenovo U310
    serial: QTF0E423807536
    width: 64 bits
    capabilities: smbios-2.7 dmi-2.7 vsyscall32
    configuration: administrator_password=unknown boot=normal chassis=laptop family=IDEAPAD U310 frontpanel_password=unknown keyboard_password=unknown power-on_password=unknown sku=System SKUNumber uuid=0062E5DD-80C0-047A-BBC8-089E0131C789
  *-core
       description: Motherboard
       product: Lenovo
       vendor: LENOVO
       physical id: 0
       version: Lenovo U310
       serial: QB06137476
       slot: Part Component
     *-firmware
          description: BIOS
          vendor: LENOVO
          physical id: 5
          version: 65CN15WW
          date: 06/05/2012
          size: 128KiB
          capacity: 6592KiB
          capabilities: pci upgrade shadowing cdboot bootselect edd int5printscreen int9keyboard int14serial int17printer int10video pc98 acpi usb biosbootspecification netboot uefi
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
          vendor: Intel Corp.
          physical id: 0
          bus info: cpu@0
          version: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
          serial: To Be Filled By O.E.M.
          slot: CPU Socket - U3E1
          size: 782MHz
          capacity: 782MHz
          width: 64 bits
          clock: 100MHz
          capabilities: x86-64 fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat epb xsaveopt pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms cpufreq
          configuration: cores=2 enabledcores=2 threads=4
        *-cache:0
             description: L1 cache
             physical id: 2
             slot: L1-Cache
             size: 32KiB
             capacity: 32KiB
             capabilities: internal write-through instruction
        *-cache:1
             description: L2 cache
             physical id: 3
             slot: L2-Cache
             size: 256KiB
             capacity: 256KiB
             capabilities: internal write-through unified
        *-cache:2
             description: L3 cache
             physical id: 4
             slot: L3-Cache
             size: 3MiB
             capacity: 3MiB
             capabilities: internal write-back unified
     *-cache
          description: L1 cache
          physical id: 1
          slot: L1-Cache
          size: 32KiB
          capacity: 32KiB
          capabilities: internal write-through data
     *-memory
          description: System Memory
          physical id: 36
          slot: System board or motherboard
          size: 4GiB
        *-bank:0
             description: SODIMM DDR3 Synchronous 1600 MHz (0,6 ns)
             product: SHARETRONIC
             vendor: 0000
             physical id: 0
             serial: EDD60803
             slot: ChannelA-DIMM0
             size: 4GiB
             width: 64 bits
             clock: 1600MHz (0.6ns)
        *-bank:1
             description: DIMM [empty]
             physical id: 1
             slot: ChannelB-DIMM0
     *-pci
          description: Host bridge
          product: 3rd Gen Core processor DRAM Controller
          vendor: Intel Corporation
          physical id: 100
          bus info: pci@0000:00:00.0
          version: 09
          width: 32 bits
          clock: 33MHz
        *-display
             description: VGA compatible controller
             product: 3rd Gen Core processor Graphics Controller
             vendor: Intel Corporation
             physical id: 2
             bus info: pci@0000:00:02.0
             version: 09
             width: 64 bits
             clock: 33MHz
             capabilities: msi pm vga_controller bus_master cap_list rom
             configuration: driver=i915 latency=0
             resources: irq:45 memory:f0000000-f03fffff memory:e0000000-efffffff ioport:3000(size=64)
        *-usb:0
             description: USB controller
             product: 7 Series/C210 Series Chipset Family USB xHCI Host Controller
             vendor: Intel Corporation
             physical id: 14
             bus info: pci@0000:00:14.0
             version: 04
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi xhci bus_master cap_list
             configuration: driver=xhci_hcd latency=0
             resources: irq:40 memory:f0600000-f060ffff
        *-communication
             description: Communication controller
             product: 7 Series/C210 Series Chipset Family MEI Controller #1
             vendor: Intel Corporation
             physical id: 16
             bus info: pci@0000:00:16.0
             version: 04
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi bus_master cap_list
             configuration: driver=mei_me latency=0
             resources: irq:43 memory:f0615000-f061500f
        *-usb:1
             description: USB controller
             product: 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
             vendor: Intel Corporation
             physical id: 1a
             bus info: pci@0000:00:1a.0
             version: 04
             width: 32 bits
             clock: 33MHz
             capabilities: pm debug ehci bus_master cap_list
             configuration: driver=ehci-pci latency=0
             resources: irq:16 memory:f0619000-f06193ff
        *-multimedia
             description: Audio device
             product: 7 Series/C210 Series Chipset Family High Definition Audio Controller
             vendor: Intel Corporation
             physical id: 1b
             bus info: pci@0000:00:1b.0
             version: 04
             width: 64 bits
             clock: 33MHz
             capabilities: pm msi pciexpress bus_master cap_list
             configuration: driver=snd_hda_intel latency=0
             resources: irq:46 memory:f0610000-f0613fff
        *-pci:0
             description: PCI bridge
             product: 7 Series/C210 Series Chipset Family PCI Express Root Port 1
             vendor: Intel Corporation
             physical id: 1c
             bus info: pci@0000:00:1c.0
             version: c4
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:16
        *-pci:1
             description: PCI bridge
             product: 7 Series/C210 Series Chipset Family PCI Express Root Port 2
             vendor: Intel Corporation
             physical id: 1c.1
             bus info: pci@0000:00:1c.1
             version: c4
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:17 ioport:2000(size=4096) ioport:f0400000(size=1048576)
           *-network
                description: Ethernet interface
                product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller
                vendor: Realtek Semiconductor Co., Ltd.
                physical id: 0
                bus info: pci@0000:02:00.0
                logical name: eth0
                version: 05
                serial: 08:9e:01:31:c7:89
                size: 10Mbit/s
                capacity: 100Mbit/s
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl_nic/rtl8105e-1.fw latency=0 link=no multicast=yes port=MII speed=10Mbit/s
                resources: irq:41 ioport:2000(size=256) memory:f0404000-f0404fff memory:f0400000-f0403fff
        *-pci:2
             description: PCI bridge
             product: 7 Series/C210 Series Chipset Family PCI Express Root Port 3
             vendor: Intel Corporation
             physical id: 1c.2
             bus info: pci@0000:00:1c.2
             version: c4
             width: 32 bits
             clock: 33MHz
             capabilities: pci pciexpress msi pm normal_decode bus_master cap_list
             configuration: driver=pcieport
             resources: irq:18 memory:f0500000-f05fffff
           *-network
                description: Wireless interface
                product: Centrino Wireless-N 2200
                vendor: Intel Corporation
                physical id: 0
                bus info: pci@0000:03:00.0
                logical name: wlan0
                version: c4
                serial: 9c:4e:36:74:fc:9c
                width: 64 bits
                clock: 33MHz
                capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
                configuration: broadcast=yes driver=iwlwifi driverversion=3.13.0-29-generic firmware=18.168.6.1 ip=192.168.1.126 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn
                resources: irq:44 memory:f0500000-f0501fff
        *-usb:2
             description: USB controller
             product: 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
             vendor: Intel Corporation
             physical id: 1d
             bus info: pci@0000:00:1d.0
             version: 04
             width: 32 bits
             clock: 33MHz
             capabilities: pm debug ehci bus_master cap_list
             configuration: driver=ehci-pci latency=0
             resources: irq:23 memory:f0618000-f06183ff
        *-isa
             description: ISA bridge
             product: HM77 Express Chipset LPC Controller
             vendor: Intel Corporation
             physical id: 1f
             bus info: pci@0000:00:1f.0
             version: 04
             width: 32 bits
             clock: 33MHz
             capabilities: isa bus_master cap_list
             configuration: driver=lpc_ich latency=0
             resources: irq:0
        *-storage
             description: SATA controller
             product: 7 Series Chipset Family 6-port SATA Controller [AHCI mode]
             vendor: Intel Corporation
             physical id: 1f.2
             bus info: pci@0000:00:1f.2
             version: 04
             width: 32 bits
             clock: 66MHz
             capabilities: storage msi pm ahci_1.0 bus_master cap_list
             configuration: driver=ahci latency=0
             resources: irq:42 ioport:3088(size=8) ioport:3094(size=4) ioport:3080(size=8) ioport:3090(size=4) ioport:3060(size=32) memory:f0617000-f06177ff
        *-serial UNCLAIMED
             description: SMBus
             product: 7 Series/C210 Series Chipset Family SMBus Controller
             vendor: Intel Corporation
             physical id: 1f.3
             bus info: pci@0000:00:1f.3
             version: 04
             width: 64 bits
             clock: 33MHz
             configuration: latency=0
             resources: memory:f0614000-f06140ff ioport:efa0(size=32)
     *-scsi:0
          physical id: 2
          logical name: scsi0
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: SanDisk SSD U100
             physical id: 0.0.0
             bus info: scsi@0:0.0.0
             logical name: /dev/sda
             version: 10.5
             serial: 123703305383
             size: 22GiB (24GB)
             capabilities: partitioned partitioned:dos
             configuration: ansiversion=5 sectorsize=512 signature=a157f07e
           *-volume:0
                description: EXT4 volume
                vendor: Linux
                physical id: 1
                bus info: scsi@0:0.0.0,1
                logical name: /dev/sda1
                logical name: /
                version: 1.0
                serial: 1d689f36-584e-43fa-9913-9fba14388fe6
                size: 18GiB
                capacity: 18GiB
                capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
                configuration: created=2013-10-15 21:14:43 filesystem=ext4 lastmountpoint=/ modified=2014-06-11 19:46:24 mount.fstype=ext4 mount.options=rw,relatime,errors=remount-ro,data=ordered mounted=2014-06-11 19:46:24 state=mounted
           *-volume:1
                description: Linux swap volume
                physical id: 2
                bus info: scsi@0:0.0.0,2
                logical name: /dev/sda2
                version: 1
                serial: 08b19113-2637-4773-bd5a-f29e84f437d9
                size: 3924MiB
                capacity: 3924MiB
                capabilities: primary nofs swap initialized
                configuration: filesystem=swap pagesize=4096
     *-scsi:1
          physical id: 3
          logical name: scsi1
          capabilities: emulated
        *-disk
             description: ATA Disk
             product: ST500LT012-9WS14
             vendor: Seagate
             physical id: 0.0.0
             bus info: scsi@1:0.0.0
             logical name: /dev/sdb
             version: 0001
             serial: W0V201JA
             size: 465GiB (500GB)
             capabilities: partitioned partitioned:dos
             configuration: ansiversion=5 sectorsize=4096 signature=a157f067
           *-volume
                description: EXT4 volume
                vendor: Linux
                physical id: 1
                bus info: scsi@1:0.0.0,1
                logical name: /dev/sdb1
                logical name: /media/hdd2
                version: 1.0
                serial: 277ade7b-18eb-4b1c-9bc5-53c523e71eb1
                size: 465GiB
                capacity: 465GiB
                capabilities: primary journaled extended_attributes large_files huge_files dir_nlink recover extents ext4 ext2 initialized
                configuration: created=2013-10-15 21:14:47 filesystem=ext4 lastmountpoint=/media/hdd2 modified=2014-06-11 19:46:26 mount.fstype=ext4 mount.options=rw,relatime,data=ordered mounted=2014-06-11 19:46:26 state=mounted
  *-battery
       product: Smart Battery
       vendor: Intel Corp.
       physical id: 1
       version: 2008
       serial: 1.0
       slot: Rear
  *-power UNCLAIMED
       description: TBD by ODM
       product: TBD by ODM
       vendor: TBD by ODM
       physical id: 2
       version: 1.0
       serial: TBD by ODM
       capacity: 32768mWh

有没有什么方法可以诊断或解决这个问题?谢谢!

----- 编辑1 ------

好的,我会根据要求进行扩展,我设置了一个简单的批处理文件,每 2 秒记录一次系统使用情况:

#!/bin/bash

STAMP=$(date +"%H_%M_%S")

echo -e "** memory usage **\n" >> $STAMP

free -mh >> $STAMP

echo -e "\n** top 20 process by memory usage **\n" >> $STAMP

ps aux --sort -rss | cut -c-120  | head -n 20 >> $STAMP

echo -e "\n** top 10 process by cpu usage **\n" >> $STAMP

ps aux --sort -c | cut -c-110  | head -n 10 >> $STAMP

echo $STAMP

然后我每 2 秒运行一次并开始摆弄它..

这是我的系统在零时刻的快照,我打开了许多应用程序,但一切都很顺利:

** memory usage **

             total       used       free     shared    buffers     cached
Mem:          3,7G       3,5G       221M       458M        49M       914M
-/+ buffers/cache:       2,6G       1,2G
Swap:         3,8G       321M       3,5G

** top 20 process by memory usage **

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
pablo     6649  0.0  7.7 885004 303968 ?       Sl   jun12   0:29 zeus command: server                 
pablo    12849  0.4  5.6 1143948 221364 ?      Sl   jun12   3:23 /usr/lib/thunderbird/thunderbird
pablo     6219  0.4  5.0 1320524 196468 ?      Sl   jun12   7:33 /opt/google/chrome/chrome --type=gpu-process --channel=
pablo     6606  0.0  4.2 448240 166980 pts/24  Sl+  jun12   0:00 zeus slave: test_helper              
pablo     6578  0.0  4.0 430084 159872 pts/24  Sl+  jun12   0:02 zeus slave: test_environment         
pablo     6581  0.0  3.8 478248 149860 pts/24  Sl+  jun12   0:02 zeus slave: development_environment  
pablo     6599  0.0  3.8 479336 148716 pts/24  Sl+  jun12   0:00 zeus slave: prerake                  
pablo     6646  0.0  3.7 478248 148372 ?       Ssl  jun12   0:03 zeus runner: server                  
pablo     6183  0.7  3.7 1110824 148172 ?      SLl  jun12  12:44 /opt/google/chrome/chrome    
pablo     2467  1.3  3.1 1747564 122460 ?      Sl   jun11  25:31 compiz
pablo     6573  0.0  3.0 361908 119024 pts/24  Sl+  jun12   0:01 zeus slave: default_bundle           
pablo     6497  0.0  2.7 341316 106412 pts/24  Sl+  jun12   0:00 zeus slave: boot                     
pablo    21267  0.5  2.3 1065768 89972 ?       Sl   02:34   0:06 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21500  1.5  2.1 1057900 82376 ?       Sl   02:46   0:06 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21337  0.4  1.9 1053920 77052 ?       Sl   02:38   0:04 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21620  1.9  1.9 1049320 76592 ?       Sl   02:50   0:03 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21404  0.6  1.9 1051528 74452 ?       Sl   02:41   0:04 /opt/google/chrome/chrome --type=renderer --lang=en-US 
root      1330  0.8  1.8 441088 72656 tty7     Ssl+ jun11  16:03 /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/
pablo    19127  0.0  1.7 1036788 70244 ?       Sl   jun12   0:07 /opt/google/chrome/chrome --type=renderer --lang=en-US 

** top 10 process by cpu usage **

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
pablo    21620  1.9  1.9 1049320 76592 ?       Sl   02:50   0:03 /opt/google/chrome/chrome --type=renderer --l
pablo    21500  1.5  2.1 1057900 82376 ?       Sl   02:46   0:06 /opt/google/chrome/chrome --type=renderer --l
pablo     2467  1.3  3.1 1747564 122460 ?      Sl   jun11  25:31 compiz
pablo    21211  1.1  1.5 1022532 59316 ?       Sl   02:30   0:15 /opt/google/chrome/chrome --type=renderer --l
pablo    21379  1.0  0.6 802196 26116 ?        Ssl  02:40   0:08 gvim snapshot
pablo    21285  0.9  0.6 969072 24564 ?        Sl   02:34   0:10 /opt/google/chrome/chrome --type=ppapi --chan
pablo    21482  0.9  1.7 1039728 68976 ?       Sl   02:45   0:04 /opt/google/chrome/chrome --type=renderer --l
root      1330  0.8  1.8 441088 72656 tty7     Ssl+ jun11  16:03 /usr/bin/X -core :0 -seat seat0 -auth /var/ru
pablo     6183  0.7  3.7 1110824 148172 ?      SLl  jun12  12:44 /opt/google/chrome/chrome    

这是我的系统在高负载下的快照,实际上打开了多个 chrome 标签,几乎没有响应:

** memory usage **

             total       used       free     shared    buffers     cached
Mem:          3,7G       3,6G       155M       455M        17M       693M
-/+ buffers/cache:       2,9G       866M
Swap:         3,8G       347M       3,5G

** top 20 process by memory usage **

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
pablo     6649  0.0  7.6 885004 299060 ?       Sl   jun12   0:29 zeus command: server                 
pablo    21816 49.3  7.3 1215860 285332 ?      Sl   02:53   0:13 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo     6219  0.4  5.8 1336344 229096 ?      Rl   jun12   7:37 /opt/google/chrome/chrome --type=gpu-process --channel=
pablo    12849  0.4  5.6 1143948 221360 ?      Sl   jun12   3:23 /usr/lib/thunderbird/thunderbird
pablo     6606  0.0  4.2 448240 166936 pts/24  Sl+  jun12   0:00 zeus slave: test_helper              
pablo     6578  0.0  4.0 430084 159872 pts/24  Sl+  jun12   0:02 zeus slave: test_environment         
pablo     6581  0.0  3.8 478248 149860 pts/24  Sl+  jun12   0:02 zeus slave: development_environment  
pablo     6183  0.8  3.8 1244608 148912 ?      SLl  jun12  12:54 /opt/google/chrome/chrome    
pablo     6599  0.0  3.8 479336 148716 pts/24  Sl+  jun12   0:00 zeus slave: prerake                  
pablo     6646  0.0  3.7 478248 148372 ?       Ssl  jun12   0:03 zeus runner: server                  
pablo     2467  1.3  3.0 1747256 119924 ?      Sl   jun11  25:34 compiz
pablo     6573  0.0  3.0 361908 119024 pts/24  Sl+  jun12   0:01 zeus slave: default_bundle           
pablo     6497  0.0  2.7 341316 106412 pts/24  Sl+  jun12   0:00 zeus slave: boot                     
pablo    21267  0.5  2.3 1065768 89972 ?       Sl   02:34   0:06 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21958 44.0  2.1 1051856 83236 ?       Sl   02:53   0:02 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21500  1.4  2.1 1057900 82364 ?       Sl   02:46   0:06 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21620  1.6  1.9 1049320 76504 ?       Sl   02:50   0:03 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21337  0.4  1.9 1049824 75236 ?       Sl   02:38   0:04 /opt/google/chrome/chrome --type=renderer --lang=en-US 
pablo    21404  0.6  1.9 1051528 74320 ?       Sl   02:41   0:04 /opt/google/chrome/chrome --type=renderer --lang=en-US 

** top 10 process by cpu usage **

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
pablo    21816 49.3  7.3 1215860 285332 ?      Sl   02:53   0:13 /opt/google/chrome/chrome --type=renderer --l
pablo    21958 44.0  2.1 1051860 83236 ?       Sl   02:53   0:02 /opt/google/chrome/chrome --type=renderer --l
pablo    22012 25.0  1.0 988364 42900 ?        Sl   02:53   0:00 /opt/google/chrome/chrome --type=renderer --l
pablo    21620  1.6  1.9 1049320 76504 ?       Sl   02:50   0:03 /opt/google/chrome/chrome --type=renderer --l
pablo    21500  1.4  2.1 1057900 82364 ?       Sl   02:46   0:06 /opt/google/chrome/chrome --type=renderer --l
pablo     2467  1.3  3.0 1747256 119924 ?      Sl   jun11  25:34 compiz
pablo    21211  1.0  1.5 1022532 59316 ?       Sl   02:30   0:15 /opt/google/chrome/chrome --type=renderer --l
pablo    21379  1.0  0.6 802196 26116 ?        Ssl  02:40   0:08 gvim snapshot
pablo    21285  0.9  0.7 979840 30956 ?        Sl   02:34   0:11 /opt/google/chrome/chrome --type=ppapi --chan

为什么当内存开始变满时,chrome 会占用那么多 CPU?即使 chrome 是“罪魁祸首”,操作系统难道不应该在高负载下保持正常运行吗?

答案1

如果可能的话,添加更多内存。

有关内存不足的一般信息:预防内存不足问题(特定于 Windows,但概念类似)

Linux 内核提供了一个可调整的设置来控制交换文件的使用频率,称为“互换性”

相关内容