linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/oom: fix pgtables units mismatch in Killed process message
@ 2019-12-11 20:28 Ilya Dryomov
  2019-12-11 21:44 ` David Rientjes
  2019-12-12 10:41 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: Ilya Dryomov @ 2019-12-11 20:28 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, Edward Chron, Michal Hocko, David Rientjes,
	Andrew Morton, Linus Torvalds

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

Fixes: 70cb6d267790 ("mm/oom: add oom_score_adj and pgtables to Killed process message")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
---
 mm/oom_kill.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 71e3acea7817..d58c481b3df8 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -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);
 
 	/*
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/oom: fix pgtables units mismatch in Killed process message
  2019-12-11 20:28 [PATCH] mm/oom: fix pgtables units mismatch in Killed process message Ilya Dryomov
@ 2019-12-11 21:44 ` David Rientjes
  2019-12-12 10:41 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: David Rientjes @ 2019-12-11 21:44 UTC (permalink / raw)
  To: Ilya Dryomov
  Cc: linux-mm, linux-kernel, Edward Chron, Michal Hocko,
	Andrew Morton, Linus Torvalds

On Wed, 11 Dec 2019, Ilya Dryomov wrote:

> 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
> 
> Fixes: 70cb6d267790 ("mm/oom: add oom_score_adj and pgtables to Killed process message")
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>

I'd also suggest a

Cc: stable@vger.kernel.org # 5.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/oom: fix pgtables units mismatch in Killed process message
  2019-12-11 20:28 [PATCH] mm/oom: fix pgtables units mismatch in Killed process message Ilya Dryomov
  2019-12-11 21:44 ` David Rientjes
@ 2019-12-12 10:41 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2019-12-12 10:41 UTC (permalink / raw)
  To: Ilya Dryomov
  Cc: linux-mm, linux-kernel, Edward Chron, David Rientjes,
	Andrew Morton, Linus Torvalds

On Wed 11-12-19 21:28:30, Ilya Dryomov wrote:
> 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
> 
> Fixes: 70cb6d267790 ("mm/oom: add oom_score_adj and pgtables to Killed process message")
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

Ups, I have missed that when reviewing 70cb6d267790.

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!
> ---
>  mm/oom_kill.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 71e3acea7817..d58c481b3df8 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -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);
>  
>  	/*
> -- 
> 2.19.2
> 

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-12 10:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 20:28 [PATCH] mm/oom: fix pgtables units mismatch in Killed process message Ilya Dryomov
2019-12-11 21:44 ` David Rientjes
2019-12-12 10:41 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).