使用以下命令找出正在使用大页的进程
原创
©著作权归作者所有:来自51CTO博客作者我有八块腹肌的原创作品,请联系作者获取转载授权,否则将追究法律责任
grep -i AnonHugePages /proc/*/smaps | grep -i '^[^\ ]\+\ \+\([0-9]\+\)' -o | awk '{print $1}' | xargs -I {} basename {}
grep AnonHugePages /proc/*/smaps | grep -v 0 | awk -F'/' '{print $3}' | xargs -I{} sh -c "echo -n {}' '; grep -s AnonHugePages /proc/{}/smaps | awk '{sum+=$2} END{print sum}'" | sort -k2nr | head -n 10
for file in /proc/*/smaps; do awk '/AnonHugePages/ {pid = FILENAME; sub("/proc/"," ",pid); sub("/smaps","",pid); printf "%s %s\n", pid, $2 }' $file; done | sort -k2 -nr | head -n 10
for file in /proc/*/smaps; do awk '/AnonHugePages/ {pid = FILENAME; sub("/proc/"," ",pid); sub("/smaps","",pid); printf "%s %s\n", pid, $2 }' $file; done | sort -k2 -nr | head -n 10