All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>
Cc: david@gibson.dropbear.id.au, linux-kernel@vger.kernel.org,
	linuxppc64-dev@lists.linuxppc.org
Subject: Re: put_page() tries to handle hugepages but fails
Date: Fri, 23 Apr 2004 03:47:44 -0700	[thread overview]
Message-ID: <20040423104744.GG743@holomorphy.com> (raw)
In-Reply-To: <20040423033522.03ab14fc.akpm@osdl.org>

On Fri, Apr 23, 2004 at 03:35:22AM -0700, Andrew Morton wrote:
> Sure.
> This of course duplicates huge_page_release(), which can be killed off.

Ah, but mm/hugetlb.c is putting the destructor in head->lru.prev not
head[1].mapping; fix below along with nuking  huge_page_release().


-- wli


Index: wli-2.6.6-rc2-mm1/include/linux/hugetlb.h
===================================================================
--- wli-2.6.6-rc2-mm1.orig/include/linux/hugetlb.h	2004-04-21 05:20:33.000000000 -0700
+++ wli-2.6.6-rc2-mm1/include/linux/hugetlb.h	2004-04-23 03:40:24.000000000 -0700
@@ -18,7 +18,6 @@
 void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
 void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
 int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
-void huge_page_release(struct page *);
 int hugetlb_report_meminfo(char *);
 int is_hugepage_mem_enough(size_t);
 unsigned long hugetlb_total_pages(void);
@@ -70,7 +69,6 @@
 #define hugetlb_prefault(mapping, vma)		({ BUG(); 0; })
 #define zap_hugepage_range(vma, start, len)	BUG()
 #define unmap_hugepage_range(vma, start, end)	BUG()
-#define huge_page_release(page)			BUG()
 #define is_hugepage_mem_enough(size)		0
 #define hugetlb_report_meminfo(buf)		0
 #define mark_mm_hugetlb(mm, vma)		do { } while (0)
Index: wli-2.6.6-rc2-mm1/mm/swap.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/mm/swap.c	2004-04-21 05:19:58.000000000 -0700
+++ wli-2.6.6-rc2-mm1/mm/swap.c	2004-04-23 03:21:22.000000000 -0700
@@ -41,15 +41,12 @@
 	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);
-			}
+			void (*destructor)(struct page *);
+			destructor = (void (*)(struct page *))page[1].mapping;
+			BUG_ON(!destructor);
+			(*destructor)(page);
 		}
-		return;
-	}
-	if (!PageReserved(page) && put_page_testzero(page))
+	} else if (!PageReserved(page) && put_page_testzero(page))
 		__page_cache_release(page);
 }
 EXPORT_SYMBOL(put_page);
Index: wli-2.6.6-rc2-mm1/mm/hugetlb.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/mm/hugetlb.c	2004-04-21 05:19:58.000000000 -0700
+++ wli-2.6.6-rc2-mm1/mm/hugetlb.c	2004-04-23 03:45:41.000000000 -0700
@@ -78,20 +78,12 @@
 	free_huge_pages--;
 	spin_unlock(&hugetlb_lock);
 	set_page_count(page, 1);
-	page->lru.prev = (void *)free_huge_page;
+	page[1].mapping = (void *)free_huge_page;
 	for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
 		clear_highpage(&page[i]);
 	return page;
 }
 
-void huge_page_release(struct page *page)
-{
-	if (!put_page_testzero(page))
-		return;
-
-	free_huge_page(page);
-}
-
 static int __init hugetlb_init(void)
 {
 	unsigned long i;
Index: wli-2.6.6-rc2-mm1/arch/i386/mm/hugetlbpage.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/arch/i386/mm/hugetlbpage.c	2004-04-21 05:20:29.000000000 -0700
+++ wli-2.6.6-rc2-mm1/arch/i386/mm/hugetlbpage.c	2004-04-23 03:40:04.000000000 -0700
@@ -220,7 +220,7 @@
 		if (pte_none(pte))
 			continue;
 		page = pte_page(pte);
-		huge_page_release(page);
+		put_page(page);
 	}
 	mm->rss -= (end - start) >> PAGE_SHIFT;
 	flush_tlb_range(vma, start, end);
Index: wli-2.6.6-rc2-mm1/arch/ia64/mm/hugetlbpage.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/arch/ia64/mm/hugetlbpage.c	2004-04-21 05:19:41.000000000 -0700
+++ wli-2.6.6-rc2-mm1/arch/ia64/mm/hugetlbpage.c	2004-04-23 03:40:07.000000000 -0700
@@ -249,7 +249,7 @@
 		if (pte_none(*pte))
 			continue;
 		page = pte_page(*pte);
-		huge_page_release(page);
+		put_page(page);
 		pte_clear(pte);
 	}
 	mm->rss -= (end - start) >> PAGE_SHIFT;
Index: wli-2.6.6-rc2-mm1/arch/ppc64/mm/hugetlbpage.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/arch/ppc64/mm/hugetlbpage.c	2004-04-21 05:20:29.000000000 -0700
+++ wli-2.6.6-rc2-mm1/arch/ppc64/mm/hugetlbpage.c	2004-04-23 03:40:10.000000000 -0700
@@ -394,7 +394,7 @@
 			flush_hash_hugepage(mm->context, addr,
 					    pte, local);
 
-		huge_page_release(page);
+		put_page(page);
 	}
 
 	mm->rss -= (end - start) >> PAGE_SHIFT;
Index: wli-2.6.6-rc2-mm1/arch/sh/mm/hugetlbpage.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/arch/sh/mm/hugetlbpage.c	2004-04-21 05:19:43.000000000 -0700
+++ wli-2.6.6-rc2-mm1/arch/sh/mm/hugetlbpage.c	2004-04-23 03:40:14.000000000 -0700
@@ -200,7 +200,7 @@
 		if (pte_none(*pte))
 			continue;
 		page = pte_page(*pte);
-		huge_page_release(page);
+		put_page(page);
 		for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
 			pte_clear(pte);
 			pte++;
Index: wli-2.6.6-rc2-mm1/arch/sparc64/mm/hugetlbpage.c
===================================================================
--- wli-2.6.6-rc2-mm1.orig/arch/sparc64/mm/hugetlbpage.c	2004-04-21 05:19:43.000000000 -0700
+++ wli-2.6.6-rc2-mm1/arch/sparc64/mm/hugetlbpage.c	2004-04-23 03:40:17.000000000 -0700
@@ -198,7 +198,7 @@
 		if (pte_none(*pte))
 			continue;
 		page = pte_page(*pte);
-		huge_page_release(page);
+		put_page(page);
 		for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
 			pte_clear(pte);
 			pte++;

  reply	other threads:[~2004-04-23 10:47 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 [this message]
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
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=20040423104744.GG743@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc64-dev@lists.linuxppc.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.