2. Who am I?Who am I?
●
Chief System Architect - SiteGroundChief System Architect - SiteGround
●
Linux System Administrator since 1996Linux System Administrator since 1996
●
Teaching LSA and NetSec at FMI SofiaTeaching LSA and NetSec at FMI Sofia
●
Organizing OpenFest and othersOrganizing OpenFest and others
9. ● login (on tty, via PAM)
● KDM, GDM, XDM & etc. (locally via PAM)
● ssh (remotely, via PAM and shell)
● pam_limits
– /etc/security/limits.conf
– /etc/security/limits.d/
● shell (sh, bash, zsh, csh, tcsh)
– /etc/profile.d/limits.[tcz]sh
ulimitsulimits how-tohow-to
10. $ cat /proc/self/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 200 200 processes
Max open files 1024 4096 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 200 200 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
ulimitsulimits how-tohow-to
11. $ cat /proc/self/limits
on older kernels:
$ echo -n "Max open files=2000:6000"
> /proc/self/limits
$ prlimit
ulimitsulimits how-tohow-to
12. Other kernel limits
● fs.file-max - max fd for the machine
● fs.nr_open - max fd per process
● fs.mount-max - max mounted filesystems
● kernel.threads-max
13. ● Dedicate a CPU to HW device
● Dedicate a CPU to a process
● taskset mask cmd
● /proc/interrupts
– /proc/irq/NUM/smp_affinity
– /proc/irq/NUM/smp_affinity_list
– /proc/irq/NUM/affinity_hint
CPU AffinityCPU Affinity
14. ● Dedicate a CPU to HW device
● Dedicate a CPU to a process
core0 core1
core2 core3
eth0 1Gbps
eth4 10Gbps
megaraid 6Gbps
CPU AffinityCPU Affinity
15. ● Dedicate a CPU to HW device
● Dedicate a CPU to a process
core0 core1
core2 core3
eth0 1Gbps
eth1 10Gbps
eth2 10Gbps
megaraid 6Gbps
core0 - eth1 10Gbps
core1 - eth2 10Gbps
core3 - megaraid 6Gbps
core4 - eth0 & processes
CPU AffinityCPU Affinity
16. taskset example
root@terion:~# taskset -p 2727
pid 2727's current affinity mask: ff
root@terion:~# taskset -pc 3 2727
pid 2727's current affinity list: 0-7
pid 2727's new affinity list: 3
root@terion:~# taskset -p 2727
pid 2727's current affinity mask: 8
root@terion:~# ps axf|grep 2727
2727 ? Ss 2:06 /usr/sbin/acpid
root@terion:~#