linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Fengwei Yin <yfw.kernel@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Dave Hansen <dave.hansen@intel.com>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	"David S. Miller" <davem@davemloft.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH v2] smaps should deal with huge zero page exactly same as normal zero page.
Date: Tue, 28 Oct 2014 15:18:10 +0200	[thread overview]
Message-ID: <20141028131810.GB9768@node.dhcp.inet.fi> (raw)
In-Reply-To: <20141028150944.GA13840@gmail.com>

On Tue, Oct 28, 2014 at 11:18:38PM +0800, Fengwei Yin wrote:
> On Mon, Oct 27, 2014 at 03:17:48PM -0700, Andrew Morton wrote:
> > On Mon, 27 Oct 2014 23:02:13 +0800 Fengwei Yin <yfw.kernel@gmail.com> wrote:
> > 
> > > We could see following memory info in /proc/xxxx/smaps with THP enabled.
> > >   7bea458b3000-7fea458b3000 r--p 00000000 00:13 39989  /dev/zero
> > >   Size:           4294967296 kB
> > >   Rss:            10612736 kB
> > >   Pss:            10612736 kB
> > >   Shared_Clean:          0 kB
> > >   Shared_Dirty:          0 kB
> > >   Private_Clean:  10612736 kB
> > >   Private_Dirty:         0 kB
> > >   Referenced:     10612736 kB
> > >   Anonymous:             0 kB
> > >   AnonHugePages:  10612736 kB
> > >   Swap:                  0 kB
> > >   KernelPageSize:        4 kB
> > >   MMUPageSize:           4 kB
> > >   Locked:                0 kB
> > >   VmFlags: rd mr mw me
> > > which is wrong becuase just huge_zero_page/normal_zero_page is used for
> > > /dev/zero. Most of the value should be 0.
> > > 
> > > This patch detects huge_zero_page (original implementation just detect
> > > normal_zero_page) and avoids to update the wrong value for huge_zero_page.
> > > 
> > > ...
> > >
> > > --- a/mm/memory.c
> > > +++ b/mm/memory.c
> > > @@ -41,6 +41,7 @@
> > >  #include <linux/kernel_stat.h>
> > >  #include <linux/mm.h>
> > >  #include <linux/hugetlb.h>
> > > +#include <linux/huge_mm.h>
> > >  #include <linux/mman.h>
> > >  #include <linux/swap.h>
> > >  #include <linux/highmem.h>
> > > @@ -787,6 +788,9 @@ check_pfn:
> > >  		return NULL;
> > >  	}
> > >  
> > > +	if (is_huge_zero_pfn(pfn))
> > > +		return NULL;
> > > +
> > 
> > Why this change?
> > 
> I suppose the huge zero page should have same behavior as normal zero
> page. vm_normal_page will return NULL if the pte is for normal zero
> page. This change make it return NULL for huge zero page.
> 
> > What effect does it have upon vm_normal_page()'s many existing callers?
> This is good question. I suppose it will not impact existing caller.

vm_normal_page() is designed to handle pte. We only get there due hack
with pmd to pte cast in smaps_pte_range(). Let's try to get rid of it
instead.

Could you test the patch below? I think it's a better fix.

  reply	other threads:[~2014-10-28 13:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 15:02 Fengwei Yin
2014-10-27 22:17 ` Andrew Morton
2014-10-28 15:18   ` Fengwei Yin
2014-10-28 13:18     ` Kirill A. Shutemov [this message]
2014-10-29 16:54       ` Fengwei Yin
2014-10-28 15:44   ` Fengwei Yin
2014-10-28 20:35     ` Andrew Morton
2014-10-28 20:40       ` Andrew Morton
2014-10-30 14:04         ` Fengwei Yin

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=20141028131810.GB9768@node.dhcp.inet.fi \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@intel.com \
    --cc=davem@davemloft.net \
    --cc=fengguang.wu@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=yfw.kernel@gmail.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