public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
Date: Fri, 8 Jan 2016 02:42:18 -0500 (EST)	[thread overview]
Message-ID: <494674280.5705346.1452238938120.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160108065941.GA2966@localhost.localdomain>





----- Original Message -----
> From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Friday, 8 January, 2016 7:59:41 AM
> Subject: Re: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom()
> 
> On Thu, Jan 07, 2016 at 06:57:20AM -0500, Jan Stancek wrote:
> > 
> > 
> > ----- Original Message -----
> > > From: "Han Pingtian" <hanpt@linux.vnet.ibm.com>
> > > To: ltp@lists.linux.it
> > > Sent: Monday, 28 December, 2015 8:49:19 AM
> > > Subject: [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from
> > > 	oom()
> > > 
> > > Looks like there is no such a case "OVERCOMMIT" in oom(), so we can just
> > > remove it.
> > > 
> > > Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
> > 
> > Reviewed-by: Jan Stancek <jstancek@redhat.com>
> > 
> > Looks good to me, regards,
> > Jan
> > 
> Hi Jan,
> 
> Thanks for reviewing! I have another question: I think when
> "overcommit_memory" being set to 1, mmap() will always succeed. It's
> that correct? I read the code of kernel, looks like in
> __vm_enough_memory(), if sysctl_overcommit_memory == OVERCOMMIT_ALWAYS,
> it will always return 0. So I think in oom01.c, we should call the
> testoom() as testoom(0, 0, 0, 1).

It can also fail if you reach max_map_count (or if map size is too big, but
that shouldn't be the case in this test).

This is current call in oom01:
  testoom(0, 0, ENOMEM, 1);

Third parameter (retcode) does not apply only to mmap().
If you look at testoom(), it makes 3 tests:
  oom(NORMAL, lite, retcode, allow_sigkill);
  oom(MLOCK, lite, retcode, allow_sigkill);
  oom(KSM, lite, retcode, allow_sigkill);

oom() compares that retcode to exit code of alloc_mem(),
which will exit when either of these 3 fails: mmap, mlock or madvise.

Regards,
Jan

> 
> 
> Thanks.
> 
> 

  reply	other threads:[~2016-01-08  7:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28  7:49 [LTP] [PATCH] mem/oom: remove non-existent case OVERCOMMIT from oom() Han Pingtian
2016-01-07 11:57 ` Jan Stancek
2016-01-07 14:54   ` Cyril Hrubis
2016-01-08  6:59   ` Han Pingtian
2016-01-08  7:42     ` Jan Stancek [this message]
2016-01-11  6:08       ` Han Pingtian
2016-01-26 14:14 ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2015-12-28  7:20 Han Pingtian

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=494674280.5705346.1452238938120.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /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