aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-29 22:12:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-29 22:12:44 -0500
commita0908a1b7d68706ee52ed4a039756e70c8e956e9 (patch)
treece23d955c37b04d816fc7d551db71d4ff86630f7 /scripts
parentb9151761021e25c024a6670df4e7c43ffbab0e1d (diff)
parent72639e6df4128dfde8fee7638a35be7db8114000 (diff)
Merge branch 'akpm' (patches from Andrew)
Mergr misc fixes from Andrew Morton: "28 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (28 commits) fs/hugetlbfs/inode.c: change put_page/unlock_page order in hugetlbfs_fallocate() mm/hugetlb: fix NULL-pointer dereference on 5-level paging machine autofs: revert "autofs: fix AT_NO_AUTOMOUNT not being honored" autofs: revert "autofs: take more care to not update last_used on path walk" fs/fat/inode.c: fix sb_rdonly() change mm, memcg: fix mem_cgroup_swapout() for THPs mm: migrate: fix an incorrect call of prep_transhuge_page() kmemleak: add scheduling point to kmemleak_scan() scripts/bloat-o-meter: don't fail with division by 0 fs/mbcache.c: make count_objects() more robust Revert "mm/page-writeback.c: print a warning if the vm dirtiness settings are illogical" mm/madvise.c: fix madvise() infinite loop under special circumstances exec: avoid RLIMIT_STACK races with prlimit() IB/core: disable memory registration of filesystem-dax vmas v4l2: disable filesystem-dax mapping support mm: fail get_vaddr_frames() for filesystem-dax mappings mm: introduce get_user_pages_longterm device-dax: implement ->split() to catch invalid munmap attempts mm, hugetlbfs: introduce ->split() to vm_operations_struct scripts/faddr2line: extend usage on generic arch ...
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bloat-o-meter7
-rwxr-xr-xscripts/faddr2line21
2 files changed, 19 insertions, 9 deletions
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 6f099f915dcf..94b664817ad9 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -83,8 +83,11 @@ def print_result(symboltype, symbolformat, argc):
83 for d, n in delta: 83 for d, n in delta:
84 if d: print("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)) 84 if d: print("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d))
85 85
86 print("Total: Before=%d, After=%d, chg %+.2f%%" % \ 86 if otot:
87 (otot, ntot, (ntot - otot)*100.0/otot)) 87 percent = (ntot - otot) * 100.0 / otot
88 else:
89 percent = 0
90 print("Total: Before=%d, After=%d, chg %+.2f%%" % (otot, ntot, percent))
88 91
89if sys.argv[1] == "-c": 92if sys.argv[1] == "-c":
90 print_result("Function", "tT", 3) 93 print_result("Function", "tT", 3)
diff --git a/scripts/faddr2line b/scripts/faddr2line
index 1f5ce959f596..39e07d8574dd 100755
--- a/scripts/faddr2line
+++ b/scripts/faddr2line
@@ -44,9 +44,16 @@
44set -o errexit 44set -o errexit
45set -o nounset 45set -o nounset
46 46
47READELF="${CROSS_COMPILE}readelf"
48ADDR2LINE="${CROSS_COMPILE}addr2line"
49SIZE="${CROSS_COMPILE}size"
50NM="${CROSS_COMPILE}nm"
51
47command -v awk >/dev/null 2>&1 || die "awk isn't installed" 52command -v awk >/dev/null 2>&1 || die "awk isn't installed"
48command -v readelf >/dev/null 2>&1 || die "readelf isn't installed" 53command -v ${READELF} >/dev/null 2>&1 || die "readelf isn't installed"
49command -v addr2line >/dev/null 2>&1 || die "addr2line isn't installed" 54command -v ${ADDR2LINE} >/dev/null 2>&1 || die "addr2line isn't installed"
55command -v ${SIZE} >/dev/null 2>&1 || die "size isn't installed"
56command -v ${NM} >/dev/null 2>&1 || die "nm isn't installed"
50 57
51usage() { 58usage() {
52 echo "usage: faddr2line <object file> <func+offset> <func+offset>..." >&2 59 echo "usage: faddr2line <object file> <func+offset> <func+offset>..." >&2
@@ -69,10 +76,10 @@ die() {
69find_dir_prefix() { 76find_dir_prefix() {
70 local objfile=$1 77 local objfile=$1
71 78
72 local start_kernel_addr=$(readelf -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}') 79 local start_kernel_addr=$(${READELF} -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}')
73 [[ -z $start_kernel_addr ]] && return 80 [[ -z $start_kernel_addr ]] && return
74 81
75 local file_line=$(addr2line -e $objfile $start_kernel_addr) 82 local file_line=$(${ADDR2LINE} -e $objfile $start_kernel_addr)
76 [[ -z $file_line ]] && return 83 [[ -z $file_line ]] && return
77 84
78 local prefix=${file_line%init/main.c:*} 85 local prefix=${file_line%init/main.c:*}
@@ -104,7 +111,7 @@ __faddr2line() {
104 111
105 # Go through each of the object's symbols which match the func name. 112 # Go through each of the object's symbols which match the func name.
106 # In rare cases there might be duplicates. 113 # In rare cases there might be duplicates.
107 file_end=$(size -Ax $objfile | awk '$1 == ".text" {print $2}') 114 file_end=$(${SIZE} -Ax $objfile | awk '$1 == ".text" {print $2}')
108 while read symbol; do 115 while read symbol; do
109 local fields=($symbol) 116 local fields=($symbol)
110 local sym_base=0x${fields[0]} 117 local sym_base=0x${fields[0]}
@@ -156,10 +163,10 @@ __faddr2line() {
156 163
157 # pass real address to addr2line 164 # pass real address to addr2line
158 echo "$func+$offset/$sym_size:" 165 echo "$func+$offset/$sym_size:"
159 addr2line -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;" 166 ${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;"
160 DONE=1 167 DONE=1
161 168
162 done < <(nm -n $objfile | awk -v fn=$func -v end=$file_end '$3 == fn { found=1; line=$0; start=$1; next } found == 1 { found=0; print line, "0x"$1 } END {if (found == 1) print line, end; }') 169 done < <(${NM} -n $objfile | awk -v fn=$func -v end=$file_end '$3 == fn { found=1; line=$0; start=$1; next } found == 1 { found=0; print line, "0x"$1 } END {if (found == 1) print line, end; }')
163} 170}
164 171
165[[ $# -lt 2 ]] && usage 172[[ $# -lt 2 ]] && usage