linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: PINTU KUMAR <pintu.k@samsung.com>
Cc: akpm@linux-foundation.org, minchan@kernel.org, dave@stgolabs.net,
	koct9i@gmail.com, rientjes@google.com, hannes@cmpxchg.org,
	penguin-kernel@i-love.sakura.ne.jp, bywxiaobai@163.com,
	mgorman@suse.de, vbabka@suse.cz, js1304@gmail.com,
	kirill.shutemov@linux.intel.com, alexander.h.duyck@redhat.com,
	sasha.levin@oracle.com, cl@linux.com, fengguang.wu@intel.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	cpgs@samsung.com, pintu_agarwal@yahoo.com, pintu.ping@gmail.com,
	vishnu.ps@samsung.com, rohit.kr@samsung.com,
	c.rajkumar@samsung.com, sreenathd@samsung.com
Subject: Re: [PATCH 1/1] mm: vmstat: Add OOM kill count in vmstat counter
Date: Mon, 5 Oct 2015 14:22:58 +0200	[thread overview]
Message-ID: <20151005122258.GA7023@dhcp22.suse.cz> (raw)
In-Reply-To: <010401d0ff34$f48e8eb0$ddabac10$@samsung.com>

On Mon 05-10-15 11:42:49, PINTU KUMAR wrote:
[...]
> > > A snapshot of the result of over night test is shown below:
> > > $ cat /proc/vmstat
> > > oom_stall 610
> > > oom_kill_count 1763
> > >
> > > Here, oom_stall indicates that there are 610 times, kernel entered
> > > into OOM cases. However, there were around 1763 oom killing happens.
> > 
> > This alone looks quite suspicious. Unless you have tasks which share the
> > address
> > space without being in the same thread group this shouldn't happen in such a
> > large scale.
> 
> Yes, this accounts for out_of_memory even from memory cgroups.
> Please check few snapshots of dmesg outputs captured during over-night tests.

OK, that would explain why the second counter is so much larger than
oom_stall. And that alone should have been a red flag IMO. Why should be
memcg OOM killer events accounted together with the global? How do you
distinguish the two?

> ........
> [49479.078033]  [2:      xxxxxxxx:20874] Memory cgroup out of memory: Kill
> process 20880 (xxxxxxx) score 112 or sacrifice child
> [49480.910430]  [2:      xxxxxxxx:20882] Memory cgroup out of memory: Kill
> process 20888 (xxxxxxxx) score 112 or sacrifice child
> [49567.046203]  [0:        yyyyyyy:  548] Out of memory: Kill process 20458
> (zzzzzzzzzz) score 102 or sacrifice child
> [49567.346588]  [0:        yyyyyyy:  548] Out of memory: Kill process 21102
> (zzzzzzzzzz) score 104 or sacrifice child
> .........
> The _out of memory_ count in dmesg dump output exactly matches the number in
> /proc/vmstat -> oom_kill_count
> 
> > </me looks into the patch>
> > And indeed the patch is incorrect. You are only counting OOMs from the page
> > allocator slow path. You are missing all the OOM invocations from the page
> > fault
> > path.
> 
> Sorry, I am not sure what exactly you mean. Please point me out if I am missing
> some places.
> Actually, I tried to add it at generic place that is; oom_kill_process, which is
> called by out_of_memory(...).
> Are you talking about: pagefault_out_of_memory(...) ?
> But, this is already calling: out_of_memory. No?

Sorry, I wasn't clear enough here. I was talking about oom_stall counter
here not oom_kill_count one.

[...]
> > What is it supposed to tell us? How many times the system had to go into
> > emergency OOM steps? How many times the direct reclaim didn't make any
> > progress so we can consider the system OOM?
> > 
> Yes, exactly, oom_stall can tell, how many times OOM is invoked in the system.
> Yes, it can also tell how many times direct_reclaim fails completely.
> Currently, we don't have any counter for direct_reclaim success/fail.

So why don't we add one? Direct reclaim failure is a clearly defined
event and it also can be evaluated reasonably against allocstall.

> Also, oom_kill_process will not be invoked for higher orders
> (PAGE_ALLOC_COSTLY_ORDER).
> But, it will enter OOM and results into straight page allocation failure.

Yes there are other reasons to not invoke OOM killer or to prevent
actual killing if chances are high we can go without it. This is the
reason I am asking about the exact semantic.

> > oom_kill_count has a slightly misleading names because it suggests how many
> > times oom_kill was called but in fact it counts the oom victims.
> > Not sure whether this information is so much useful but the semantic is clear
> > at least.
> > 
> Ok, agree about the semantic of the name: oom_kill_count.
> If possible please suggest a better name.
> How about the following names?
> oom_victim_count ?
> oom_nr_killed ?
> oom_nr_victim ?

nr_oom_victims?

I am still not sure how useful this counter would be, though. Sure the
log ringbuffer might overflow (the risk can be reduced by reducing the
loglevel) but how much it would help to know that we had additional N
OOM victims? From my experience checking the OOM reports which are still
in the logbuffer are sufficient to see whether there is a memory leak,
pinned memory or a continuous memory pressure. Your experience might be
different so it would be nice to mention that in the changelog.
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-10-05 12:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 10:48 [PATCH 1/1] mm: vmstat: Add OOM kill count in vmstat counter Pintu Kumar
2015-10-01 13:29 ` Anshuman Khandual
2015-10-05  6:19   ` PINTU KUMAR
2015-10-01 13:38 ` Michal Hocko
2015-10-05  6:12   ` PINTU KUMAR
2015-10-05 12:22     ` Michal Hocko [this message]
2015-10-06  6:59       ` PINTU KUMAR
2015-10-06 15:41         ` Michal Hocko
2015-10-07 14:48           ` PINTU KUMAR
2015-10-08 14:18             ` Michal Hocko
2015-10-08 16:06               ` PINTU KUMAR
2015-10-08 16:30                 ` Michal Hocko
2015-10-09 12:59                   ` PINTU KUMAR
2015-10-12 13:33 ` [PATCH 1/1] mm: vmstat: Add OOM victims " Pintu Kumar
2015-10-12 14:28   ` [RESEND PATCH " Pintu Kumar
2015-10-14  3:05     ` David Rientjes
2015-10-14 13:41       ` PINTU KUMAR
2015-10-14 22:04         ` David Rientjes
2015-10-15 14:35           ` PINTU KUMAR
2015-10-12 14:44   ` [PATCH " PINTU KUMAR

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151005122258.GA7023@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@redhat.com \
    --cc=bywxiaobai@163.com \
    --cc=c.rajkumar@samsung.com \
    --cc=cl@linux.com \
    --cc=cpgs@samsung.com \
    --cc=dave@stgolabs.net \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=js1304@gmail.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=pintu.k@samsung.com \
    --cc=pintu.ping@gmail.com \
    --cc=pintu_agarwal@yahoo.com \
    --cc=rientjes@google.com \
    --cc=rohit.kr@samsung.com \
    --cc=sasha.levin@oracle.com \
    --cc=sreenathd@samsung.com \
    --cc=vbabka@suse.cz \
    --cc=vishnu.ps@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).