From: David Gibson <david@gibson.dropbear.id.au>
To: Andrew Morton <akpm@osdl.org>
Cc: apw@shadowen.org, agl@us.ibm.com, mbligh@us.ibm.com,
linux-kernel@vger.kernel.org, linuxppc64-dev@lists.linuxppc.org
Subject: Re: put_page() tries to handle hugepages but fails
Date: Tue, 27 Apr 2004 15:05:03 +1000 [thread overview]
Message-ID: <20040427050503.GH514@zax> (raw)
In-Reply-To: <20040426214757.2c7d8ed5.akpm@osdl.org>
On Mon, Apr 26, 2004 at 09:47:57PM -0700, Andrew Morton wrote:
> David Gibson <david@gibson.dropbear.id.au> wrote:
> >
> > + if (put_page_testzero(page))
> > + free_huge_page(page);
>
> Well yes, but this is assuming that compound pages are always hugetlb pages.
>
> It's true at present, but it doesn't have to always be true. The cost of
> the destructor is zilch, so why not?
True enough, I guess I was just following the "don't build it till you
need it" philosophy.
> Please review the changes which went into 2.6.6-rc2-mm2.
Sorry, should have done that earlier. Looks reasonable with two small
exceptions: 1) put_page() can still theoretically call
__page_cache_release() which is wrong (and makes the code misleading)
- patch below replaces this with a BUG() if there is no destructor. 2)
what about wli's concern that mapping may be accessed without first
checking for a PageCompound?
Index: working-2.6/mm/swap.c
===================================================================
--- working-2.6.orig/mm/swap.c 2004-04-14 12:22:49.000000000 +1000
+++ working-2.6/mm/swap.c 2004-04-27 15:02:30.046342392 +1000
@@ -41,11 +41,9 @@
if (unlikely(PageCompound(page))) {
page = (struct page *)page->private;
if (put_page_testzero(page)) {
- if (page[1].mapping) { /* destructor? */
- (*(void (*)(struct page *))page[1].mapping)(page);
- } else {
- __page_cache_release(page);
- }
+ BUG_ON(! page[1].mapping);
+
+ (*(void (*)(struct page *))page[1].mapping)(page);
}
return;
}
--
David Gibson | For every complex problem there is a
david AT gibson.dropbear.id.au | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
next prev parent reply other threads:[~2004-04-27 5:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-23 8:18 put_page() tries to handle hugepages but fails David Gibson
2004-04-23 8:34 ` Andrew Morton
2004-04-23 10:28 ` William Lee Irwin III
2004-04-23 10:35 ` Andrew Morton
2004-04-23 10:47 ` William Lee Irwin III
2004-04-23 11:28 ` William Lee Irwin III
2004-04-27 4:36 ` David Gibson
2004-04-27 4:41 ` David Gibson
2004-04-27 4:47 ` Andrew Morton
2004-04-27 5:05 ` David Gibson [this message]
2004-04-27 5:15 ` Andrew Morton
2004-04-27 5:16 ` David Gibson
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=20040427050503.GH514@zax \
--to=david@gibson.dropbear.id.au \
--cc=agl@us.ibm.com \
--cc=akpm@osdl.org \
--cc=apw@shadowen.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc64-dev@lists.linuxppc.org \
--cc=mbligh@us.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