mm/oom: fix pgtables units mismatch in Killed process message
Subsystems (2)
PATCH 1/1 mm/oom: fix pgtables units mismatch in Killed process message
pr_err() expects kB, but mm_pgtables_bytes() returns the number of bytes. As everything else is printed in kB, I chose to fix the value rather than the string.
Before:
[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
...
[ 1878] 1000 1878 217253 151144 1269760 0 0 python
...
Out of memory: Killed process 1878 (python) total-vm:869012kB, anon-rss:604572kB, file-rss:4kB, shmem-rss:0kB, UID:1000 pgtables:1269760kB oom_score_adj:0
After:
[ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
...
[ 1436] 1000 1436 217253 151890 1294336 0 0 python
...
Out of memory: Killed process 1436 (python) total-vm:869012kB, anon-rss:607516kB, file-rss:44kB, shmem-rss:0kB, UID:1000 pgtables:1264kB oom_score_adj:0
--- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/oom_kill.c +1 -1
@@ -890,7 +890,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)K (get_mm_counter (mm,MM_FILEPAGES )),K (get_mm_counter (mm,MM_SHMEMPAGES )),from_kuid (&init_user_ns,task_uid (victim)), - mm_pgtables_bytes(mm), victim->signal->oom_score_adj); + mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_adj);task_unlock (victim);/*
Signature · 1 line
2.19.2
Quoted 14 lines · Ilya Dryomov
pr_err()expects kB, butmm_pgtables_bytes()returns the number of bytes. As everything else is printed in kB, I chose to fix the value rather than the string.Before:
[ pid ] uid tgid
total_vmrsspgtables_bytesswapentsoom_score_adjname
...
[ 1878] 1000 1878 217253 151144 1269760 0 0 python
...
Out of memory: Killed process 1878 (python) total-vm:869012kB, anon-rss:604572kB, file-rss:4kB, shmem-rss:0kB, UID:1000 pgtables:1269760kB oom_score_adj:0After:
Quoted 8 lines
[ pid ] uid tgid
total_vmrsspgtables_bytesswapentsoom_score_adjname
...
[ 1436] 1000 1436 217253 151890 1294336 0 0 python
...
Out of memory: Killed process 1436 (python) total-vm:869012kB, anon-rss:607516kB, file-rss:44kB, shmem-rss:0kB, UID:1000 pgtables:1264kB oom_score_adj:0Fixes 70cb6d267790 ("mm/oom: add oom_score_adj and pgtables to Killed process message")Signed-off-by Ilya Dryomov <[email protected]>
I'd also suggest a
Quoted 14 lines · Ilya Dryomov
pr_err()expects kB, butmm_pgtables_bytes()returns the number of bytes. As everything else is printed in kB, I chose to fix the value rather than the string.Before:
[ pid ] uid tgid
total_vmrsspgtables_bytesswapentsoom_score_adjname
...
[ 1878] 1000 1878 217253 151144 1269760 0 0 python
...
Out of memory: Killed process 1878 (python) total-vm:869012kB, anon-rss:604572kB, file-rss:4kB, shmem-rss:0kB, UID:1000 pgtables:1269760kB oom_score_adj:0After:
Quoted 8 lines
[ pid ] uid tgid
total_vmrsspgtables_bytesswapentsoom_score_adjname
...
[ 1436] 1000 1436 217253 151890 1294336 0 0 python
...
Out of memory: Killed process 1436 (python) total-vm:869012kB, anon-rss:607516kB, file-rss:44kB, shmem-rss:0kB, UID:1000 pgtables:1264kB oom_score_adj:0Fixes 70cb6d267790 ("mm/oom: add oom_score_adj and pgtables to Killed process message")Signed-off-by Ilya Dryomov <[email protected]>
Ups, I have missed that when reviewing 70cb6d267790.
Thanks!
Quoted 20 lines
--- mm/oom_kill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/oom_kill.c +1
-1@@ -890,7 +890,7 @@ static void __oom_kill_process(struct task_struct *victim, const char *message)K (get_mm_counter (mm,MM_FILEPAGES )),K (get_mm_counter (mm,MM_SHMEMPAGES )),from_kuid (&init_user_ns,task_uid (victim)), - mm_pgtables_bytes(mm), victim->signal->oom_score_adj); + mm_pgtables_bytes(mm) >> 10, victim->signal->oom_score_adj);task_unlock (victim);/* Signature · 1 line
2.19.2
Signature · 2 lines
Michal Hocko SUSE Labs