All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Christoph Lameter <clameter@engr.sgi.com>
Cc: Andrew Morton <akpm@osdl.org>,
	ak@suse.de, agl@us.ibm.com, wli@holomorphy.com,
	linux-kernel@vger.kernel.org
Subject: Re: OOM behavior in constrained memory situations
Date: Fri, 10 Feb 2006 10:08:03 +1100	[thread overview]
Message-ID: <20060209230803.GA25740@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.62.0602061558290.19350@schroedinger.engr.sgi.com>

On Mon, Feb 06, 2006 at 04:03:53PM -0800, Christoph Lameter wrote:
> On Mon, 6 Feb 2006, Andrew Morton wrote:
> 
> > The oom-killer is invoked from the page allocator.  A hugetlb pagefault
> > won't use the page allocator.  So there shouldn't be an oom-killing on
> > hugepage exhaustion.
> 
> Right..... and the arch specific fault code (at least ia64) does not call 
> the OOM killer.
> 
> > I think this comment is just wrong:
> > 
> > 		/* Logically this is OOM, not a SIGBUS, but an OOM
> > 		 * could cause the kernel to go killing other
> > 		 * processes which won't help the hugepage situation
> > 		 * at all (?) */
> > 
> > A VM_FAULT_OOM from there won't cause the oom-killer to do anything.  We
> > should return VM_FAULT_OOM and let do_page_fault() commit suicide with
> > SIGKILL.
> 
> Drop my patch that adds the comments explaining the bus error and add this 
> fix instead. This will terminate an application with out of memory instead 
> of bus error and remove the comment that you mentioned.

Looks good, except I think a comment should go in there so the next
person to look at it doesn't make the same wrong assumption I did,
that returning VM_FAULT_OOM will trigger the OOM killer.

> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> 
> Index: linux-2.6.16-rc2/mm/hugetlb.c
> ===================================================================
> --- linux-2.6.16-rc2.orig/mm/hugetlb.c	2006-02-02 22:03:08.000000000 -0800
> +++ linux-2.6.16-rc2/mm/hugetlb.c	2006-02-06 16:02:53.000000000 -0800
> @@ -391,12 +391,7 @@ static int hugetlb_cow(struct mm_struct 
>  
>  	if (!new_page) {
>  		page_cache_release(old_page);
> -
> -		/* Logically this is OOM, not a SIGBUS, but an OOM
> -		 * could cause the kernel to go killing other
> -		 * processes which won't help the hugepage situation
> -		 * at all (?) */
> -		return VM_FAULT_SIGBUS;
> +		return VM_FAULT_OOM;
>  	}
>  
>  	spin_unlock(&mm->page_table_lock);
> @@ -444,6 +439,7 @@ retry:
>  		page = alloc_huge_page(vma, address);
>  		if (!page) {
>  			hugetlb_put_quota(mapping);
> +			ret = VM_FAULT_OOM;
>  			goto out;
>  		}
>  
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2006-02-09 23:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-06 20:59 OOM behavior in constrained memory situations Christoph Lameter
2006-02-06 21:10 ` Andrew Morton
2006-02-06 21:22   ` Andi Kleen
2006-02-06 22:16     ` Christoph Lameter
2006-02-06 22:25       ` Andi Kleen
2006-02-06 22:30       ` Andrew Morton
2006-02-07  0:03         ` Christoph Lameter
2006-02-09 23:08           ` David Gibson [this message]
2006-02-06 22:11   ` Christoph Lameter
2006-02-06 22:26     ` Andrew Morton
2006-02-06 22:59 ` Paul Jackson
2006-02-07  0:39   ` Christoph Lameter
2006-02-07  1:55   ` Christoph Lameter
2006-02-07  9:23     ` Andi Kleen
2006-02-07 17:29       ` Christoph Lameter
2006-02-07 17:45         ` Andi Kleen
2006-02-07 17:51           ` Christoph Lameter
2006-02-07 17:58             ` Andi Kleen
2006-02-07 18:10               ` Christoph Lameter
2006-02-07 18:19               ` Christoph Lameter
2006-02-07 18:31                 ` Andi Kleen
2006-02-07 19:00                   ` Christoph Lameter

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=20060209230803.GA25740@localhost.localdomain \
    --to=david@gibson.dropbear.id.au \
    --cc=agl@us.ibm.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=clameter@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wli@holomorphy.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.