linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Peng Haitao <penght@cn.fujitsu.com>
Cc: cgroups@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: how to make memory.memsw.failcnt is nonzero
Date: Mon, 30 Jan 2012 09:46:21 +0100	[thread overview]
Message-ID: <20120130084621.GA31570@tiehlicka.suse.cz> (raw)
In-Reply-To: <4F2601C9.6000606@cn.fujitsu.com>

On Mon 30-01-12 10:34:49, Peng Haitao wrote:
> 
> Michal Hocko said the following on 2012-1-4 0:04:
> > On Wed 28-12-11 17:23:04, Peng Haitao wrote:
> >>
> >> memory.memsw.failcnt shows the number of memory+Swap hits limits.
> >> So I think when memory+swap usage is equal to limit, memsw.failcnt should be nonzero.
> >>
> >> I test as follows:
> >>
> >> # uname -a
> >> Linux K-test 3.2.0-rc7-17-g371de6e #2 SMP Wed Dec 28 12:02:52 CST 2011 x86_64 x86_64 x86_64 GNU/Linux
> >> # mkdir /cgroup/memory/group
> >> # cd /cgroup/memory/group/
> >> # echo 10M > memory.limit_in_bytes
> >> # echo 10M > memory.memsw.limit_in_bytes
> >> # echo $$ > tasks
> >> # dd if=/dev/zero of=/tmp/temp_file count=20 bs=1M
> >> Killed
> >> # cat memory.memsw.failcnt
> >> 0
> >> # grep "failcnt" /var/log/messages | tail -2
> >> Dec 28 17:05:52 K-test kernel: memory: usage 10240kB, limit 10240kB, failcnt 21
> >> Dec 28 17:05:52 K-test kernel: memory+swap: usage 10240kB, limit 10240kB, failcnt 0
> >>
> >> memory+swap usage is equal to limit, but memsw.failcnt is zero.
> >>
> > Please note that memsw.limit_in_bytes is triggered only if we have
> > consumed some swap space already (and the feature is primarily intended
> > to stop extensive swap usage in fact).
> > It goes like this: If we trigger hard limit (memory.limit_in_bytes) then
> > we start the direct reclaim (with swap available). If we trigger memsw
> > limit then we try to reclaim without swap available. We will OOM if we
> > cannot reclaim enough to satisfy the respective limit.
> > 
> > The other part of the answer is, yes there is something wrong going
> > on her because we definitely shouldn't OOM. The workload is a single
> > threaded and we have a plenty of page cache that could be reclaimed
> > easily. On the other hand we end up with:
> > # echo $$ > tasks 
> > /dev/memctl/a# echo 10M > memory.limit_in_bytes 
> > /dev/memctl/a# echo 10M > memory.memsw.limit_in_bytes 
> > /dev/memctl/a# dd if=/dev/zero of=/tmp/temp_file count=20 bs=1M
> > Killed
> > /dev/memctl/a# cat memory.stat 
> > cache 9265152
> > [...]
> > 
> > So there is almost 10M of page cache that we can simply reclaim. If we
> > use 40M limit then we are OK. So this looks like the small limit somehow
> > tricks our math in the reclaim path and we think there is nothing to
> > reclaim.
> > I will look into this.
> 
> Have any conclusion for this?

I am sorry, but I didn't get to this. The last two months were really
busy and I am leaving for a long vacation next week. It's still on my
todo list...

> Thanks.

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

      reply	other threads:[~2012-01-30  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4EFADFF8.5020703@cn.fujitsu.com>
2012-01-03 16:04 ` how to make memory.memsw.failcnt is nonzero Michal Hocko
2012-01-06  9:47   ` Peng Haitao
2012-01-06 10:12     ` Michal Hocko
2012-01-30  2:47       ` Peng Haitao
2012-01-30  7:24         ` KAMEZAWA Hiroyuki
2012-01-30  2:34   ` Peng Haitao
2012-01-30  8:46     ` Michal Hocko [this message]

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=20120130084621.GA31570@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penght@cn.fujitsu.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).