linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	nickpiggin@yahoo.com.au, tonyb@cybernetics.com,
	mika.penttila@kolumbus.fi
Subject: Re: [PATCH] more ZERO_PAGE handling in follow_page()
Date: Wed, 7 May 2008 14:25:39 -0700	[thread overview]
Message-ID: <20080507142539.758d30f6.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080507163643.d4da0ed0.kamezawa.hiroyu@jp.fujitsu.com>

On Wed, 7 May 2008 16:36:43 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Rewrote the description of patch. (no changes in the logic.)
> 
> Thank you for all help.
> -Kame
> ==
> follow_page() is called from get_user_pages(), which returns specified user page.
> follow_page() can return 1) a page or 2) NULL or 3)ZERO_PAGE.
> If NULL, handle_mm_fault() is called.
> 
> Now, follow_page() to unused pte returns NULL if page table exists. As a result
> get_user_pages() calls handle_mm_fault() and allocate new memory.
> This behavior increases memory consumption at coredump, which does
> read-once-but-never-written page fault.
> By returning ZERO_PAGE() against READ/ANON request, we can avoid it.
> 
> (Because exec's arguments copy needs to call handle_mm_fault at WRITE/ANON
>  request, we just handle READ/ANON case here.)
> 
> Change log:
>   - Rewrote patch description and Added comments.
>   - fixed to check pte_present()/pte_none() in proper way.

So... how serious is the problem which we're fixing here?

I can see that if one is core-dumping large sparse address spaces this
could improve things a lot, but please help us understand the implications
so we can decide whether we need this in 2.6.26, thanks.


> Index: linux-2.6.25/mm/memory.c
> ===================================================================
> --- linux-2.6.25.orig/mm/memory.c
> +++ linux-2.6.25/mm/memory.c
> @@ -926,15 +926,15 @@ struct page *follow_page(struct vm_area_
>  	page = NULL;
>  	pgd = pgd_offset(mm, address);
>  	if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
> -		goto no_page_table;
> +		goto null_or_zeropage;
>  
>  	pud = pud_offset(pgd, address);
>  	if (pud_none(*pud) || unlikely(pud_bad(*pud)))
> -		goto no_page_table;
> +		goto null_or_zeropage;
>  	
>  	pmd = pmd_offset(pud, address);
>  	if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))

The mainline kernel does not have " || unlikely(pmd_bad(*pmd))" here. 
That got changed yesterday by

commit aeed5fce37196e09b4dac3a1c00d8b7122e040ce
Author: Hugh Dickins <hugh@veritas.com>
Date:   Tue May 6 20:49:23 2008 +0100

    x86: fix PAE pmd_bad bootup warning

So please confirm that the patch which I merged is still OK (I'd be
surprised if it isn't...)

--
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:[~2008-05-07 21:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-07  7:36 KAMEZAWA Hiroyuki
2008-05-07 21:25 ` Andrew Morton [this message]
2008-05-08  0:40   ` KAMEZAWA Hiroyuki
2008-05-08  9:56     ` [PATCH] more ZERO_PAGE handling in follow_page() v2 KAMEZAWA Hiroyuki

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=20080507142539.758d30f6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mika.penttila@kolumbus.fi \
    --cc=nickpiggin@yahoo.com.au \
    --cc=tonyb@cybernetics.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