move file to correct loc

This commit is contained in:
Kaiwan N Billimoria
2023-12-23 13:17:15 +05:30
parent 9a66a56069
commit 3fdc43c6bc
2 changed files with 1 additions and 50 deletions

View File

@@ -1,49 +0,0 @@
#!/bin/bash
# query_process_oom.sh
# ***************************************************************
# This program is part of the source code released for the book
# "Linux Kernel Programming" 2E
# (c) Author: Kaiwan N Billimoria
# Publisher: Packt
# GitHub repository:
# https://github.com/PacktPublishing/Linux-Kernel-Programming_2E
# ****************************************************************
# Brief Description:
#
# Query the OOM score of all processes currently alive on the system.
# Just a simple wrapper around choom(1).
# Tip: One can always arrange to sort the output by OOM score; f.e.:
# /query_task_oom.sh |sed '1d' |sort -k3n
# Details: refer to the LKP book, Ch 9
# Turn on unofficial Bash 'strict mode'! V useful
# "Convert many kinds of hidden, intermittent, or subtle bugs into immediate, glaringly obvious errors"
# ref: http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
i=1
printf " PID Name OOM Score\n"
IFS=$'\n'
for rec in $(ps -A)
do
[ $i -eq 1 ] && { # skip ps's header
let i=i+1
continue
}
# 'grok' & extract it, and ...
pid=$(echo "${rec}" |awk '{print $1}')
comm=$(echo "${rec}" |awk '{print $4}')
rec2=$(choom -p ${pid} 2>/dev/null)
oom_score=$(echo "${rec2}" |head -n1|cut -d":" -f2)
# ... print it!
[ ${pid} -ne 0 ] && {
printf "%9d %28s" ${pid} ${comm}
printf " %6d" ${oom_score}
}
printf "\n"
let i=i+1
done
exit 0

View File

@@ -29,7 +29,7 @@
static int use_ctor = 1;
module_param(use_ctor, uint, 0);
MODULE_PARM_DESC(use_ctor, "If set to 1 (default), our custom ctor routine"
" will initialize slabmem; when 0, no custom constructor will run");
" will initialize slabmem; when 0, no custom constructor will run");
MODULE_AUTHOR("Kaiwan N Billimoria");
MODULE_DESCRIPTION("LKP 2E book:ch9/slab_custom: simple demo of creating a custom slab cache");