加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 为什么Ubuntu 12.04上的内核共享内存为0

发布时间:2020-12-14 02:28:45 所属栏目:Linux 来源:网络整理
导读:任何人都可以向我解释为什么KSM不起作用这意味着目前我的内核没有利用KSM来减少RAM的使用. grep KSM /boot/config-3.2.0-23-generic CONFIG_KSM=y cat /sys/kernel/mm/ksm/pages_shared 0 cat /sys/kernel/mm/ksm/pages_sharing 0 cat /sys/kernel/mm/ksm/pa
任何人都可以向我解释为什么KSM不起作用这意味着目前我的内核没有利用KSM来减少RAM的使用.
grep KSM /boot/config-3.2.0-23-generic 
 CONFIG_KSM=y

 cat /sys/kernel/mm/ksm/pages_shared 
 0
 cat /sys/kernel/mm/ksm/pages_sharing
 0
 cat /sys/kernel/mm/ksm/pages_unshared
 0

内核:3.2.0-23泛型

Ubuntu 12.04 LTS 64位桌面

免费-m

total       used       free     shared    buffers     cached
Mem:      1964       1883         81          0         11        228
-/+ buffers/cache:       1644        320
Swap:         2008        485       1523

ipcs -m

------ Shared Memory Segments --------
 key        shmid      owner      perms      bytes      nattch     status      
0x00000000 0          myexperiments   600        393216     2          dest         
0x00000000 2490369    myexperiments   600        393216     2          dest         
0x00000000 98306      myexperiments   600        393216     2          dest         
0x00000000 2523139    myexperiments   600        393216     2          dest         
0x00000000 13008900   myexperiments   666        262080     1          dest         
0x00000000 1245189    myexperiments   666        4          2          dest         
0x00000000 1277958    myexperiments   666        4          1          dest         
0x00000000 6520839    myexperiments   600        393216     2          dest         
0x00000000 14811144   myexperiments   666        1277760    3          dest         
0x00000000 12648458   myexperiments   666        300000     1          dest         
0x00000000 8060939    myexperiments   666        300000     1          dest         
0x00000000 12943373   myexperiments   666        300000     2          dest         
0x00000000 12976142   myexperiments   666        262080     2          dest         
0x00000000 13271055   myexperiments   666        300000     2          dest

解决方法

除非应用软件通过调用madvise(MAD??V_MERGEABLE)告诉它,否则KSMD将不会做任何事情.最有可能的是,您没有使用任何使用KSMD服务的应用程序软件.

MADV_MERGEABLE (since Linux 2.6.32):

Enable Kernel Samepage Merging (KSM) for the pages in the range specified by addr and length. The kernel regularly scans those areas of user memory that have been marked as mergeable,looking for pages with identical content. These are replaced by a single write-protected page (which is automatically copied if a process later wants to update the content of the page). KSM only merges private anonymous pages (see mmap(2)).

The KSM feature is intended for applications that generate many instances of the same data (e.g.,virtualization systems such as KVM). It can consume a lot of processing power; use with care. See the kernel source file Documentation/vm/ksm.txt for more details. The MADV_MERGEABLE and MADV_UNMERGEABLE operations are only available if the kernel was configured with CONFIG_KSM.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读