From: Dave Hansen <haveblue@us.ibm.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: linux-mm <linux-mm@kvack.org>,
"BRADLEY CHRISTIANSEN [imap]" <bradc1@us.ibm.com>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH] fix page->count discrepancy for zero page
Date: Mon, 28 Jun 2004 15:05:53 -0700 [thread overview]
Message-ID: <1088460353.5471.406.camel@nighthawk> (raw)
[-- Attachment #1: Type: text/plain, Size: 992 bytes --]
While writing some analysis tools for memory hot-remove, we came across
a single page which had a ->count that always increased, without bound.
It ended up always being the zero page, and it was caused by a leaked
reference in some do_wp_page() code that ends up avoiding PG_reserved
pages.
Basically what happens is that page_cache_release()/put_page() ignore
PG_reserved pages, while page_cache_get()/get_page() go ahead and take
the reference. So, each time there's a COW fault on the zero-page, you
get a leaked page->count increment.
It's pretty rare to have a COW fault on anything that's PG_reserved, in
fact, I can't think of anything else that this applies to other than the
zero page.
In any case, it the bug doesn't cause any real problems, but it is a bit
of an annoyance and is obviously incorrect. We've been running with
this patch for about 3 months now, and haven't run into any problems
with it.
Attached patch is against 2.6.7 and applies to -mm3 properly.
-- Dave
[-- Attachment #2: patch-2.6.7-zpage --]
[-- Type: text/x-patch, Size: 453 bytes --]
diff -urp linux-2.6.7/mm/memory.c linux-2.6.7-zpage/mm/memory.c
--- linux-2.6.7/mm/memory.c Tue Jun 15 22:19:22 2004
+++ linux-2.6.7-zpage/mm/memory.c Thu Jun 24 12:08:42 2004
@@ -1064,7 +1064,8 @@ static int do_wp_page(struct mm_struct *
/*
* Ok, we need to copy. Oh, well..
*/
- page_cache_get(old_page);
+ if (!PageReserved(old_page))
+ page_cache_get(old_page);
spin_unlock(&mm->page_table_lock);
if (unlikely(anon_vma_prepare(vma)))
reply other threads:[~2004-06-28 22:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1088460353.5471.406.camel@nighthawk \
--to=haveblue@us.ibm.com \
--cc=akpm@osdl.org \
--cc=bradc1@us.ibm.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 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.