linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: konrad@darnok.org, Konrad Wilk <konrad.wilk@oracle.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: RE: [PATCH v2 1/4] introduce zero filled pages handler
Date: Mon, 25 Mar 2013 12:07:38 -0700 (PDT)	[thread overview]
Message-ID: <80f208d0-c0e9-4d38-9085-99866f7ee5d7@default> (raw)
In-Reply-To: <CAPbh3rvOW2hh0bMTY_FyYJPiyqS4a76pHgDYLGYvLKjEzfJoig@mail.gmail.com>

> From: Konrad Rzeszutek Wilk [mailto:konrad@darnok.org]
> Sent: Tuesday, March 19, 2013 10:44 AM
> To: Dan Magenheimer
> Cc: Wanpeng Li; Greg Kroah-Hartman; Andrew Morton; Seth Jennings; Minchan Kim; linux-mm@kvack.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 1/4] introduce zero filled pages handler
> 
> On Sat, Mar 16, 2013 at 2:24 PM, Dan Magenheimer
> <dan.magenheimer@oracle.com> wrote:
> >> From: Konrad Rzeszutek Wilk [mailto:konrad@darnok.org]
> >> Subject: Re: [PATCH v2 1/4] introduce zero filled pages handler
> >>
> >> > +
> >> > +   for (pos = 0; pos < PAGE_SIZE / sizeof(*page); pos++) {
> >> > +           if (page[pos])
> >> > +                   return false;
> >>
> >> Perhaps allocate a static page filled with zeros and just do memcmp?
> >
> > That seems like a bad idea.  Why compare two different
> > memory locations when comparing one memory location
> > to a register will do?
> 
> Good point. I was hoping there was an fast memcmp that would
> do fancy SSE registers. But it is memory against memory instead of
> registers.
> 
> Perhaps a cunning trick would be to check (as a shortcircuit)
> check against 'empty_zero_page' and if that check fails, then try
> to do the check for each byte in the code?

Curious about this, I added some code to check for this case.
In my test run, the conditional "if (page == ZERO_PAGE(0))"
was never true, for >200000 pages passed through frontswap that
were zero-filled.  My test run is certainly not conclusive,
but perhaps some other code in the swap subsystem disqualifies
ZERO_PAGE as a candidate for swapping?  Or maybe it is accessed
frequently enough that it never falls out of the active-anonymous
page queue?

Dan

P.S. In arch/x86/include/asm/pgtable.h:

#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))

--
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:[~2013-03-25 19:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 10:08 [PATCH v2 0/4] zcache: Support zero-filled pages more efficiently Wanpeng Li
2013-03-14 10:08 ` [PATCH v2 1/4] introduce zero filled pages handler Wanpeng Li
2013-03-16 13:03   ` Konrad Rzeszutek Wilk
2013-03-16 18:24     ` Dan Magenheimer
2013-03-19 16:44       ` Konrad Rzeszutek Wilk
2013-03-25 19:07         ` Dan Magenheimer [this message]
2013-03-17  0:11     ` Wanpeng Li
2013-03-17  0:11     ` Wanpeng Li
2013-03-14 10:08 ` [PATCH v2 2/4] zero-filled pages awareness Wanpeng Li
2013-03-16 13:07   ` Konrad Rzeszutek Wilk
2013-03-14 10:08 ` [PATCH v2 3/4] introduce zero-filled page stat count Wanpeng Li
2013-03-16 13:06   ` Konrad Rzeszutek Wilk
2013-03-17  0:13     ` Wanpeng Li
2013-03-17  0:13     ` Wanpeng Li
2013-03-17 12:58     ` Ric Mason
2013-03-19 16:41       ` Konrad Rzeszutek Wilk
2013-03-19 23:31         ` Ric Mason
2013-03-20 10:22         ` Wanpeng Li
2013-03-20 10:22         ` Wanpeng Li
2013-03-14 10:08 ` [PATCH v2 4/4] clean TODO list Wanpeng Li

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=80f208d0-c0e9-4d38-9085-99866f7ee5d7@default \
    --to=dan.magenheimer@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.wilk@oracle.com \
    --cc=konrad@darnok.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liwanp@linux.vnet.ibm.com \
    --cc=minchan@kernel.org \
    --cc=sjenning@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).