centos7 修改 max locked memory

centos7 修改 max locked memory

环境; centos7.6, linux 内核 3.10

可以修改 /etc/security/limits.conf,2.6版本的内核默认是在/etc/security/limits.d/90-nproc.conf 里的配置会覆盖 /etc/security/limits.conf 的配置。所以直接修改 /etc/security/limits.d/90-nproc.conf

添加 * hard memlock unlimited * hard memlock unlimite 到 /etc/security/limits.d/90-nproc.conf
然后重启服务器即可

[root@mapleaves ~]# cat /etc/security/limits.d/20-nproc.conf 
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

#*          soft    nproc     4096
*     soft   nofile    100000
*     hard   nofile    100000
*     soft   nproc     100000
*     hard   nproc     100000
*     soft   core      100000
*     hard   core      100000
#root  soft   nproc     unlimited
*     hard   memlock           unlimited
*     soft   memlock           unlimited

soft 表示默认配置,不能超过 hard 设置的值
hard 表示设置的最大值
nproc 表示进程数
memlock 表示 max locked memory,对于应用程序来说,可以将内存中一些对程序性能影响较大的数据lock起来,避免非预期的页面回收或者换入/换出引起性能波动
nofile 表示 max open file
core 表示 core file size

使用 ulimit -a 查看配置

[260@map ~]$ ulimit -a
core file size          (blocks, -c) 100000
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 127633
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 100000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 100000
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

参考文章:https://software.intel.com/en-us/blogs/2014/12/16/best-known-methods-for-setting-locked-memory-size

你可能感兴趣的:(运维,linux)