mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
To: linux-kernel@vger.kernel.org
Cc: Ian.Pratt@cl.cam.ac.uk, akpm@osdl.org, Keir.Fraser@cl.cam.ac.uk,
	Christian.Limpach@cl.cam.ac.uk
Subject: [patch 2] Xen core patch : arch_free_page return value
Date: Wed, 17 Nov 2004 23:48:57 +0000	[thread overview]
Message-ID: <E1CUZXm-00053v-00@mta1.cl.cam.ac.uk> (raw)


This patch adds a return value to the existing arch_free_page function
that indicates whether the normal free routine still has work to
do. The only architecture that currently uses arch_free_page is arch
'um'. arch-xen needs this for 'foreign pages' - pages that don't
belong to the page allocator but are instead managed by custom
allocators. Unlike PG_Reserved, we need the ref counting, but just
need to control how the page is finally freed.

Signed-off-by: ian.pratt@cl.cam.ac.uk

---

diff -ur linux-2.6.9/arch/um/kernel/physmem.c linux-2.6.9-new/arch/um/kernel/physmem.c
--- linux-2.6.9/arch/um/kernel/physmem.c	2004-10-18 22:54:37.000000000 +0100
+++ linux-2.6.9-new/arch/um/kernel/physmem.c	2004-11-16 17:37:32.919951978 +0000
@@ -225,7 +225,7 @@
 EXPORT_SYMBOL(physmem_remove_mapping);
 EXPORT_SYMBOL(physmem_subst_mapping);
 
-void arch_free_page(struct page *page, int order)
+int arch_free_page(struct page *page, int order)
 {
 	void *virt;
 	int i;
@@ -234,6 +234,8 @@
 		virt = __va(page_to_phys(page + i));
 		physmem_remove_mapping(virt);
 	}
+
+	return 0;
 }
 
 int is_remapped(void *virt)
diff -ur linux-2.6.9/include/asm-um/page.h linux-2.6.9-new/include/asm-um/page.h
--- linux-2.6.9/include/asm-um/page.h	2004-10-18 22:55:36.000000000 +0100
+++ linux-2.6.9-new/include/asm-um/page.h	2004-11-16 17:37:55.471701151 +0000
@@ -46,7 +46,7 @@
 extern struct page *arch_validate(struct page *page, int mask, int order);
 #define HAVE_ARCH_VALIDATE
 
-extern void arch_free_page(struct page *page, int order);
+extern int arch_free_page(struct page *page, int order);
 #define HAVE_ARCH_FREE_PAGE
 
 #endif
diff -ur linux-2.6.9/include/linux/gfp.h linux-2.6.9-new/include/linux/gfp.h
--- linux-2.6.9/include/linux/gfp.h	2004-10-18 22:53:44.000000000 +0100
+++ linux-2.6.9-new/include/linux/gfp.h	2004-11-16 17:41:25.825723812 +0000
@@ -74,8 +74,16 @@
  * optimized to &contig_page_data at compile-time.
  */
 
+/*
+ * If arch_free_page returns non-zero then the generic free_page code can
+ * immediately bail: the arch-specific function has done all the work.
+ */
 #ifndef HAVE_ARCH_FREE_PAGE
-static inline void arch_free_page(struct page *page, int order) { }
+static inline int arch_free_page(struct page *page, int order)
+{
+	/* Generic free_page must do the work. */
+	return 0;
+}
 #endif
 
 extern struct page *
diff -ur linux-2.6.9/mm/page_alloc.c linux-2.6.9-new/mm/page_alloc.c
--- linux-2.6.9/mm/page_alloc.c	2004-10-18 22:53:11.000000000 +0100
+++ linux-2.6.9-new/mm/page_alloc.c	2004-11-16 17:42:23.793227175 +0000
@@ -275,7 +275,8 @@
 	LIST_HEAD(list);
 	int i;
 
-	arch_free_page(page, order);
+	if (arch_free_page(page, order))
+		return;
 
 	mod_page_state(pgfree, 1 << order);
 	for (i = 0 ; i < (1 << order) ; ++i)
@@ -505,7 +506,8 @@
 	struct per_cpu_pages *pcp;
 	unsigned long flags;
 
-	arch_free_page(page, 0);
+	if (arch_free_page(page, 0))
+		return;
 
 	kernel_map_pages(page, 1, 0);
 	inc_page_state(pgfree);



             reply	other threads:[~2004-11-18  0:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-17 23:48 Ian Pratt [this message]
2004-11-18  1:04 ` Dave Hansen
2004-11-18  1:19   ` Ian Pratt
2004-11-18  1:26     ` Dave Hansen
2004-11-18  8:35       ` Keir Fraser
2004-11-18  9:17         ` Andrew Morton
2004-11-18  5:08     ` Jeff Dike
2004-11-18  3:09       ` Andrew Morton
2004-11-18  6:54         ` Jeff Dike
2004-11-18  4:57           ` Andrew Morton
2004-11-18  8:37 ` Mitchell Blank Jr
2004-11-18 10:05 Ian Pratt
2004-11-18 10:14 ` Andrew Morton
2004-11-18 10:18   ` Keir Fraser
2004-11-18 12:39     ` William Lee Irwin III
2004-11-18 10:36   ` William Lee Irwin III
2004-11-18 12:51     ` Ian Pratt
2004-11-18 12:57       ` William Lee Irwin III

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=E1CUZXm-00053v-00@mta1.cl.cam.ac.uk \
    --to=ian.pratt@cl.cam.ac.uk \
    --cc=Christian.Limpach@cl.cam.ac.uk \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®