linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Minchan Kim <minchan.kim@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Hugh Dickins <hugh.dickins@tiscali.co.uk>
Subject: Re: [PATCH 2/3 -mmotm-2009-12-10-17-19] Count zero page as file_rss
Date: Mon, 28 Dec 2009 19:24:47 +0900	[thread overview]
Message-ID: <4B38876F.6010204@gmail.com> (raw)
In-Reply-To: <ae2928fe7bb3d94a7ca18d3b3274fdfeb009803a.1258773030.git.minchan.kim@gmail.com>

I missed Hugh. 

Minchan Kim wrote:
> Long time ago, we counted zero page as file_rss.
> But after reinstanted zero page, we don't do it.
> It means rss of process would be smaller than old.
> 
> It could chage OOM victim selection.
> 
> Kame reported following as
> "Before starting zero-page works, I checked "questions" in lkml and
> found some reports that some applications start to go OOM after zero-page
> removal.
> 
> For me, I know one of my customer's application depends on behavior of
> zero page (on RHEL5). So, I tried to add again it before RHEL6 because
> I think removal of zero-page corrupts compatibility."
> 
> So how about adding zero page as file_rss again for compatibility?
> 
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> ---
>  mm/memory.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 3743fb5..a4ba271 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1995,6 +1995,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
>  	int reuse = 0, ret = 0;
>  	int page_mkwrite = 0;
>  	struct page *dirty_page = NULL;
> +	int zero_pfn = 0;
>  
>  	old_page = vm_normal_page(vma, address, orig_pte);
>  	if (!old_page) {
> @@ -2117,7 +2118,8 @@ gotten:
>  	if (unlikely(anon_vma_prepare(vma)))
>  		goto oom;
>  
> -	if (is_zero_pfn(pte_pfn(orig_pte))) {
> +	zero_pfn = is_zero_pfn(pte_pfn(orig_pte));
> +	if (zero_pfn) {
>  		new_page = alloc_zeroed_user_highpage_movable(vma, address);
>  		if (!new_page)
>  			goto oom;
> @@ -2147,7 +2149,7 @@ gotten:
>  	 */
>  	page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
>  	if (likely(pte_same(*page_table, orig_pte))) {
> -		if (old_page) {
> +		if (old_page || zero_pfn) {
>  			if (!PageAnon(old_page)) {
>  				dec_mm_counter(mm, file_rss);
>  				inc_mm_counter(mm, anon_rss);
> @@ -2650,6 +2652,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
>  		spin_lock(ptl);
>  		if (!pte_none(*page_table))
>  			goto unlock;
> +		inc_mm_counter(mm, file_rss);
>  		goto setpte;
>  	}
>  

--
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>

  parent reply	other threads:[~2009-12-28 10:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-21  3:24 [PATCH 1/3 -mmotm-2009-12-10-17-19] Move functions related to zero page Minchan Kim
2009-11-21  3:24 ` [PATCH 2/3 -mmotm-2009-12-10-17-19] Count zero page as file_rss Minchan Kim
2009-11-21  3:24   ` [PATCH 3/3 -mmotm-2009-12-10-17-19] Fix wrong rss counting of smap Minchan Kim
2009-12-28 10:25     ` Minchan Kim
2009-12-28 10:24   ` Minchan Kim [this message]
2009-12-30 16:49     ` [PATCH 2/3 -mmotm-2009-12-10-17-19] Count zero page as file_rss Hugh Dickins
2009-12-31  2:41       ` Minchan Kim
2009-12-31  8:43         ` Hugh Dickins
2010-01-04  0:49           ` Minchan Kim
2010-01-03 23:43       ` KAMEZAWA Hiroyuki
2010-01-04  0:47         ` Minchan Kim
2009-12-28 10:23 ` [PATCH 1/3 -mmotm-2009-12-10-17-19] Move functions related to zero page Minchan Kim

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=4B38876F.6010204@gmail.com \
    --to=minchan.kim@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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).