ia64/xen-unstable

changeset 3011:15c78c720203

bitkeeper revision 1.1159.170.37 (419b4e93x5uYHCJBfuNflDeySU4JpQ)

Clean up "foreign pages" patch to refelect what we pushed upstream to
the core Linux maintainers.
author kaf24@freefall.cl.cam.ac.uk
date Wed Nov 17 13:13:55 2004 +0000 (2004-11-17)
parents 0028a5b33f67
children 14ff9fcc97a3
files .rootkeys linux-2.6.9-xen-sparse/arch/xen/Kconfig linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig linux-2.6.9-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/page.h linux-2.6.9-xen-sparse/include/asm-xen/foreign_page.h linux-2.6.9-xen-sparse/include/linux/gfp.h linux-2.6.9-xen-sparse/include/linux/page-flags.h linux-2.6.9-xen-sparse/mm/page_alloc.c
line diff
     1.1 --- a/.rootkeys	Wed Nov 17 12:14:21 2004 +0000
     1.2 +++ b/.rootkeys	Wed Nov 17 13:13:55 2004 +0000
     1.3 @@ -237,6 +237,7 @@ 41062ab7uFxnCq-KtPeAm-aV8CicgA linux-2.6
     1.4  40f5623bxUbeGjkRrjDguCy_Gm8RLw linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/xor.h
     1.5  40f5623bYNP7tHE2zX6YQxp9Zq2utQ linux-2.6.9-xen-sparse/include/asm-xen/ctrl_if.h
     1.6  40f5623b3Eqs8pAc5WpPX8_jTzV2qw linux-2.6.9-xen-sparse/include/asm-xen/evtchn.h
     1.7 +419b4e9367PjTEvdjwavWN12BeBBXg linux-2.6.9-xen-sparse/include/asm-xen/foreign_page.h
     1.8  412dfaeazclyNDM0cpnp60Yo4xulpQ linux-2.6.9-xen-sparse/include/asm-xen/gnttab.h
     1.9  40f5623aGPlsm0u1LTO-NVZ6AGzNRQ linux-2.6.9-xen-sparse/include/asm-xen/hypervisor.h
    1.10  3f108af1ylCIm82H052FVTfXACBHrw linux-2.6.9-xen-sparse/include/asm-xen/linux-public/privcmd.h
    1.11 @@ -245,7 +246,7 @@ 40f5623cndVUFlkxpf7Lfx7xu8madQ linux-2.6
    1.12  4122466356eIBnC9ot44WSVVIFyhQA linux-2.6.9-xen-sparse/include/asm-xen/queues.h
    1.13  3f689063BoW-HWV3auUJ-OqXfcGArw linux-2.6.9-xen-sparse/include/asm-xen/xen_proc.h
    1.14  4124d8c4aocX7A-jIbuGraWN84pxGQ linux-2.6.9-xen-sparse/include/linux/bio.h
    1.15 -4124f66fp5QwbDHEfoUIa7pqO5Xhag linux-2.6.9-xen-sparse/include/linux/page-flags.h
    1.16 +419b4e93z2S0gR17XTy8wg09JEwAhg linux-2.6.9-xen-sparse/include/linux/gfp.h
    1.17  4124f66f4NaKNa0xPiGGykn9QaZk3w linux-2.6.9-xen-sparse/include/linux/skbuff.h
    1.18  40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.9-xen-sparse/mkbuildtree
    1.19  412f46c0LJuKAgSPGoC0Z1DEkLfuLA linux-2.6.9-xen-sparse/mm/memory.c
     2.1 --- a/linux-2.6.9-xen-sparse/arch/xen/Kconfig	Wed Nov 17 12:14:21 2004 +0000
     2.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/Kconfig	Wed Nov 17 13:13:55 2004 +0000
     2.3 @@ -111,10 +111,6 @@ config XEN_SCRUB_PAGES
     2.4  
     2.5  endmenu
     2.6  
     2.7 -config FOREIGN_PAGES
     2.8 -	bool
     2.9 -	default y
    2.10 -
    2.11  config HAVE_ARCH_DEV_ALLOC_SKB
    2.12  	bool
    2.13  	default y
     3.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Wed Nov 17 12:14:21 2004 +0000
     3.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xen0_defconfig	Wed Nov 17 13:13:55 2004 +0000
     3.3 @@ -19,7 +19,6 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     3.4  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     3.5  CONFIG_XEN_WRITABLE_PAGETABLES=y
     3.6  CONFIG_XEN_SCRUB_PAGES=y
     3.7 -CONFIG_FOREIGN_PAGES=y
     3.8  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
     3.9  CONFIG_X86=y
    3.10  # CONFIG_X86_64 is not set
    3.11 @@ -158,7 +157,7 @@ CONFIG_MAGIC_SYSRQ=y
    3.12  # CONFIG_DEBUG_INFO is not set
    3.13  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    3.14  # CONFIG_FRAME_POINTER is not set
    3.15 -CONFIG_4KSTACKS=y
    3.16 +# CONFIG_4KSTACKS is not set
    3.17  CONFIG_X86_BIOS_REBOOT=y
    3.18  CONFIG_X86_STD_RESOURCES=y
    3.19  CONFIG_PC=y
     4.1 --- a/linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig	Wed Nov 17 12:14:21 2004 +0000
     4.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/configs/xenU_defconfig	Wed Nov 17 13:13:55 2004 +0000
     4.3 @@ -19,7 +19,6 @@ CONFIG_XEN_NETDEV_FRONTEND=y
     4.4  # CONFIG_XEN_NETDEV_FRONTEND_PIPELINED_TRANSMITTER is not set
     4.5  CONFIG_XEN_WRITABLE_PAGETABLES=y
     4.6  CONFIG_XEN_SCRUB_PAGES=y
     4.7 -CONFIG_FOREIGN_PAGES=y
     4.8  CONFIG_HAVE_ARCH_DEV_ALLOC_SKB=y
     4.9  CONFIG_X86=y
    4.10  # CONFIG_X86_64 is not set
    4.11 @@ -119,7 +118,7 @@ CONFIG_HAVE_DEC_LOCK=y
    4.12  CONFIG_EARLY_PRINTK=y
    4.13  # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
    4.14  # CONFIG_FRAME_POINTER is not set
    4.15 -CONFIG_4KSTACKS=y
    4.16 +# CONFIG_4KSTACKS is not set
    4.17  CONFIG_X86_BIOS_REBOOT=y
    4.18  CONFIG_X86_STD_RESOURCES=y
    4.19  CONFIG_PC=y
     5.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/mm/pgtable.c	Wed Nov 17 12:14:21 2004 +0000
     5.2 +++ b/linux-2.6.9-xen-sparse/arch/xen/i386/mm/pgtable.c	Wed Nov 17 13:13:55 2004 +0000
     5.3 @@ -23,6 +23,8 @@
     5.4  #include <asm/tlbflush.h>
     5.5  #include <asm/io.h>
     5.6  
     5.7 +#include <asm-xen/foreign_page.h>
     5.8 +
     5.9  void show_mem(void)
    5.10  {
    5.11  	int total = 0, reserved = 0;
     6.1 --- a/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/page.h	Wed Nov 17 12:14:21 2004 +0000
     6.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/asm-i386/page.h	Wed Nov 17 13:13:55 2004 +0000
     6.3 @@ -16,6 +16,15 @@
     6.4  #include <linux/string.h>
     6.5  #include <linux/types.h>
     6.6  #include <asm-xen/xen-public/xen.h>
     6.7 +#include <asm-xen/foreign_page.h>
     6.8 +
     6.9 +#define arch_free_page(_page,_order)			\
    6.10 +({	int foreign = PageForeign(_page);		\
    6.11 +	if (foreign)					\
    6.12 +		(PageForeignDestructor(_page))(_page);	\
    6.13 +	foreign;					\
    6.14 +})
    6.15 +#define HAVE_ARCH_FREE_PAGE
    6.16  
    6.17  #ifdef CONFIG_XEN_SCRUB_PAGES
    6.18  #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/linux-2.6.9-xen-sparse/include/asm-xen/foreign_page.h	Wed Nov 17 13:13:55 2004 +0000
     7.3 @@ -0,0 +1,33 @@
     7.4 +/******************************************************************************
     7.5 + * foreign_page.h
     7.6 + * 
     7.7 + * Provide a "foreign" page type, that is owned by a foreign allocator and 
     7.8 + * not the normal buddy allocator in page_alloc.c
     7.9 + * 
    7.10 + * Copyright (c) 2004, K A Fraser
    7.11 + */
    7.12 +
    7.13 +#ifndef __ASM_XEN_FOREIGN_PAGE_H__
    7.14 +#define __ASM_XEN_FOREIGN_PAGE_H__
    7.15 +
    7.16 +/*
    7.17 + * NOTE: PG_foreign must not conflict with any PG_ definition in page-flags.h!!
    7.18 + */
    7.19 +#define PG_foreign		25
    7.20 +
    7.21 +#define PageForeign(page)	test_bit(PG_foreign, &(page)->flags)
    7.22 +
    7.23 +#define SetPageForeign(page, dtor) do {		\
    7.24 +	set_bit(PG_foreign, &(page)->flags);	\
    7.25 +	(page)->mapping = (void *)dtor;		\
    7.26 +} while (0)
    7.27 +
    7.28 +#define ClearPageForeign(page) do {		\
    7.29 +	clear_bit(PG_foreign, &(page)->flags);	\
    7.30 +	(page)->mapping = NULL;			\
    7.31 +} while (0)
    7.32 +
    7.33 +#define PageForeignDestructor(page)	\
    7.34 +	( (void (*) (struct page *)) (page)->mapping )
    7.35 +
    7.36 +#endif /* __ASM_XEN_FOREIGN_PAGE_H__ */
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/linux-2.6.9-xen-sparse/include/linux/gfp.h	Wed Nov 17 13:13:55 2004 +0000
     8.3 @@ -0,0 +1,141 @@
     8.4 +#ifndef __LINUX_GFP_H
     8.5 +#define __LINUX_GFP_H
     8.6 +
     8.7 +#include <linux/mmzone.h>
     8.8 +#include <linux/stddef.h>
     8.9 +#include <linux/linkage.h>
    8.10 +#include <linux/config.h>
    8.11 +
    8.12 +struct vm_area_struct;
    8.13 +
    8.14 +/*
    8.15 + * GFP bitmasks..
    8.16 + */
    8.17 +/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
    8.18 +#define __GFP_DMA	0x01
    8.19 +#define __GFP_HIGHMEM	0x02
    8.20 +
    8.21 +/*
    8.22 + * Action modifiers - doesn't change the zoning
    8.23 + *
    8.24 + * __GFP_REPEAT: Try hard to allocate the memory, but the allocation attempt
    8.25 + * _might_ fail.  This depends upon the particular VM implementation.
    8.26 + *
    8.27 + * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
    8.28 + * cannot handle allocation failures.
    8.29 + *
    8.30 + * __GFP_NORETRY: The VM implementation must not retry indefinitely.
    8.31 + */
    8.32 +#define __GFP_WAIT	0x10	/* Can wait and reschedule? */
    8.33 +#define __GFP_HIGH	0x20	/* Should access emergency pools? */
    8.34 +#define __GFP_IO	0x40	/* Can start physical IO? */
    8.35 +#define __GFP_FS	0x80	/* Can call down to low-level FS? */
    8.36 +#define __GFP_COLD	0x100	/* Cache-cold page required */
    8.37 +#define __GFP_NOWARN	0x200	/* Suppress page allocation failure warning */
    8.38 +#define __GFP_REPEAT	0x400	/* Retry the allocation.  Might fail */
    8.39 +#define __GFP_NOFAIL	0x800	/* Retry for ever.  Cannot fail */
    8.40 +#define __GFP_NORETRY	0x1000	/* Do not retry.  Might fail */
    8.41 +#define __GFP_NO_GROW	0x2000	/* Slab internal usage */
    8.42 +#define __GFP_COMP	0x4000	/* Add compound page metadata */
    8.43 +
    8.44 +#define __GFP_BITS_SHIFT 16	/* Room for 16 __GFP_FOO bits */
    8.45 +#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1)
    8.46 +
    8.47 +/* if you forget to add the bitmask here kernel will crash, period */
    8.48 +#define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
    8.49 +			__GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| \
    8.50 +			__GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP)
    8.51 +
    8.52 +#define GFP_ATOMIC	(__GFP_HIGH)
    8.53 +#define GFP_NOIO	(__GFP_WAIT)
    8.54 +#define GFP_NOFS	(__GFP_WAIT | __GFP_IO)
    8.55 +#define GFP_KERNEL	(__GFP_WAIT | __GFP_IO | __GFP_FS)
    8.56 +#define GFP_USER	(__GFP_WAIT | __GFP_IO | __GFP_FS)
    8.57 +#define GFP_HIGHUSER	(__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HIGHMEM)
    8.58 +
    8.59 +/* Flag - indicates that the buffer will be suitable for DMA.  Ignored on some
    8.60 +   platforms, used as appropriate on others */
    8.61 +
    8.62 +#define GFP_DMA		__GFP_DMA
    8.63 +
    8.64 +
    8.65 +/*
    8.66 + * There is only one page-allocator function, and two main namespaces to
    8.67 + * it. The alloc_page*() variants return 'struct page *' and as such
    8.68 + * can allocate highmem pages, the *get*page*() variants return
    8.69 + * virtual kernel addresses to the allocated page(s).
    8.70 + */
    8.71 +
    8.72 +/*
    8.73 + * We get the zone list from the current node and the gfp_mask.
    8.74 + * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones.
    8.75 + *
    8.76 + * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
    8.77 + * optimized to &contig_page_data at compile-time.
    8.78 + */
    8.79 +
    8.80 +/*
    8.81 + * If arch_free_page returns non-zero then the generic free_page code can
    8.82 + * immediately bail: the arch-specific function has done all the work.
    8.83 + */
    8.84 +#ifndef HAVE_ARCH_FREE_PAGE
    8.85 +static inline int arch_free_page(struct page *page, int order)
    8.86 +{
    8.87 +	/* Generic free_page must do the work. */
    8.88 +	return 0;
    8.89 +}
    8.90 +#endif
    8.91 +
    8.92 +extern struct page *
    8.93 +FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *));
    8.94 +
    8.95 +static inline struct page *alloc_pages_node(int nid, unsigned int gfp_mask,
    8.96 +						unsigned int order)
    8.97 +{
    8.98 +	if (unlikely(order >= MAX_ORDER))
    8.99 +		return NULL;
   8.100 +
   8.101 +	return __alloc_pages(gfp_mask, order,
   8.102 +		NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
   8.103 +}
   8.104 +
   8.105 +#ifdef CONFIG_NUMA
   8.106 +extern struct page *alloc_pages_current(unsigned gfp_mask, unsigned order);
   8.107 +
   8.108 +static inline struct page *
   8.109 +alloc_pages(unsigned int gfp_mask, unsigned int order)
   8.110 +{
   8.111 +	if (unlikely(order >= MAX_ORDER))
   8.112 +		return NULL;
   8.113 +
   8.114 +	return alloc_pages_current(gfp_mask, order);
   8.115 +}
   8.116 +extern struct page *alloc_page_vma(unsigned gfp_mask,
   8.117 +			struct vm_area_struct *vma, unsigned long addr);
   8.118 +#else
   8.119 +#define alloc_pages(gfp_mask, order) \
   8.120 +		alloc_pages_node(numa_node_id(), gfp_mask, order)
   8.121 +#define alloc_page_vma(gfp_mask, vma, addr) alloc_pages(gfp_mask, 0)
   8.122 +#endif
   8.123 +#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
   8.124 +
   8.125 +extern unsigned long FASTCALL(__get_free_pages(unsigned int gfp_mask, unsigned int order));
   8.126 +extern unsigned long FASTCALL(get_zeroed_page(unsigned int gfp_mask));
   8.127 +
   8.128 +#define __get_free_page(gfp_mask) \
   8.129 +		__get_free_pages((gfp_mask),0)
   8.130 +
   8.131 +#define __get_dma_pages(gfp_mask, order) \
   8.132 +		__get_free_pages((gfp_mask) | GFP_DMA,(order))
   8.133 +
   8.134 +extern void FASTCALL(__free_pages(struct page *page, unsigned int order));
   8.135 +extern void FASTCALL(free_pages(unsigned long addr, unsigned int order));
   8.136 +extern void FASTCALL(free_hot_page(struct page *page));
   8.137 +extern void FASTCALL(free_cold_page(struct page *page));
   8.138 +
   8.139 +#define __free_page(page) __free_pages((page), 0)
   8.140 +#define free_page(addr) free_pages((addr),0)
   8.141 +
   8.142 +void page_alloc_init(void);
   8.143 +
   8.144 +#endif /* __LINUX_GFP_H */
     9.1 --- a/linux-2.6.9-xen-sparse/include/linux/page-flags.h	Wed Nov 17 12:14:21 2004 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,338 +0,0 @@
     9.4 -/*
     9.5 - * Macros for manipulating and testing page->flags
     9.6 - */
     9.7 -
     9.8 -#ifndef PAGE_FLAGS_H
     9.9 -#define PAGE_FLAGS_H
    9.10 -
    9.11 -#include <linux/percpu.h>
    9.12 -#include <linux/cache.h>
    9.13 -#include <asm/pgtable.h>
    9.14 -
    9.15 -/*
    9.16 - * Various page->flags bits:
    9.17 - *
    9.18 - * PG_reserved is set for special pages, which can never be swapped out. Some
    9.19 - * of them might not even exist (eg empty_bad_page)...
    9.20 - *
    9.21 - * The PG_private bitflag is set if page->private contains a valid value.
    9.22 - *
    9.23 - * During disk I/O, PG_locked is used. This bit is set before I/O and
    9.24 - * reset when I/O completes. page_waitqueue(page) is a wait queue of all tasks
    9.25 - * waiting for the I/O on this page to complete.
    9.26 - *
    9.27 - * PG_uptodate tells whether the page's contents is valid.  When a read
    9.28 - * completes, the page becomes uptodate, unless a disk I/O error happened.
    9.29 - *
    9.30 - * For choosing which pages to swap out, inode pages carry a PG_referenced bit,
    9.31 - * which is set any time the system accesses that page through the (mapping,
    9.32 - * index) hash table.  This referenced bit, together with the referenced bit
    9.33 - * in the page tables, is used to manipulate page->age and move the page across
    9.34 - * the active, inactive_dirty and inactive_clean lists.
    9.35 - *
    9.36 - * Note that the referenced bit, the page->lru list_head and the active,
    9.37 - * inactive_dirty and inactive_clean lists are protected by the
    9.38 - * zone->lru_lock, and *NOT* by the usual PG_locked bit!
    9.39 - *
    9.40 - * PG_error is set to indicate that an I/O error occurred on this page.
    9.41 - *
    9.42 - * PG_arch_1 is an architecture specific page state bit.  The generic code
    9.43 - * guarantees that this bit is cleared for a page when it first is entered into
    9.44 - * the page cache.
    9.45 - *
    9.46 - * PG_highmem pages are not permanently mapped into the kernel virtual address
    9.47 - * space, they need to be kmapped separately for doing IO on the pages.  The
    9.48 - * struct page (these bits with information) are always mapped into kernel
    9.49 - * address space...
    9.50 - */
    9.51 -
    9.52 -/*
    9.53 - * Don't use the *_dontuse flags.  Use the macros.  Otherwise you'll break
    9.54 - * locked- and dirty-page accounting.  The top eight bits of page->flags are
    9.55 - * used for page->zone, so putting flag bits there doesn't work.
    9.56 - */
    9.57 -#define PG_locked	 	 0	/* Page is locked. Don't touch. */
    9.58 -#define PG_error		 1
    9.59 -#define PG_referenced		 2
    9.60 -#define PG_uptodate		 3
    9.61 -
    9.62 -#define PG_dirty	 	 4
    9.63 -#define PG_lru			 5
    9.64 -#define PG_active		 6
    9.65 -#define PG_slab			 7	/* slab debug (Suparna wants this) */
    9.66 -
    9.67 -#define PG_highmem		 8
    9.68 -#define PG_checked		 9	/* kill me in 2.5.<early>. */
    9.69 -#define PG_arch_1		10
    9.70 -#define PG_reserved		11
    9.71 -
    9.72 -#define PG_private		12	/* Has something at ->private */
    9.73 -#define PG_writeback		13	/* Page is under writeback */
    9.74 -#define PG_nosave		14	/* Used for system suspend/resume */
    9.75 -#define PG_compound		15	/* Part of a compound page */
    9.76 -
    9.77 -#define PG_swapcache		16	/* Swap page: swp_entry_t in private */
    9.78 -#define PG_mappedtodisk		17	/* Has blocks allocated on-disk */
    9.79 -#define PG_reclaim		18	/* To be reclaimed asap */
    9.80 -
    9.81 -#define PG_foreign		21	/* Page belongs to foreign allocator */
    9.82 -
    9.83 -
    9.84 -/*
    9.85 - * Global page accounting.  One instance per CPU.  Only unsigned longs are
    9.86 - * allowed.
    9.87 - */
    9.88 -struct page_state {
    9.89 -	unsigned long nr_dirty;		/* Dirty writeable pages */
    9.90 -	unsigned long nr_writeback;	/* Pages under writeback */
    9.91 -	unsigned long nr_unstable;	/* NFS unstable pages */
    9.92 -	unsigned long nr_page_table_pages;/* Pages used for pagetables */
    9.93 -	unsigned long nr_mapped;	/* mapped into pagetables */
    9.94 -	unsigned long nr_slab;		/* In slab */
    9.95 -#define GET_PAGE_STATE_LAST nr_slab
    9.96 -
    9.97 -	/*
    9.98 -	 * The below are zeroed by get_page_state().  Use get_full_page_state()
    9.99 -	 * to add up all these.
   9.100 -	 */
   9.101 -	unsigned long pgpgin;		/* Disk reads */
   9.102 -	unsigned long pgpgout;		/* Disk writes */
   9.103 -	unsigned long pswpin;		/* swap reads */
   9.104 -	unsigned long pswpout;		/* swap writes */
   9.105 -	unsigned long pgalloc_high;	/* page allocations */
   9.106 -
   9.107 -	unsigned long pgalloc_normal;
   9.108 -	unsigned long pgalloc_dma;
   9.109 -	unsigned long pgfree;		/* page freeings */
   9.110 -	unsigned long pgactivate;	/* pages moved inactive->active */
   9.111 -	unsigned long pgdeactivate;	/* pages moved active->inactive */
   9.112 -
   9.113 -	unsigned long pgfault;		/* faults (major+minor) */
   9.114 -	unsigned long pgmajfault;	/* faults (major only) */
   9.115 -	unsigned long pgrefill_high;	/* inspected in refill_inactive_zone */
   9.116 -	unsigned long pgrefill_normal;
   9.117 -	unsigned long pgrefill_dma;
   9.118 -
   9.119 -	unsigned long pgsteal_high;	/* total highmem pages reclaimed */
   9.120 -	unsigned long pgsteal_normal;
   9.121 -	unsigned long pgsteal_dma;
   9.122 -	unsigned long pgscan_kswapd_high;/* total highmem pages scanned */
   9.123 -	unsigned long pgscan_kswapd_normal;
   9.124 -
   9.125 -	unsigned long pgscan_kswapd_dma;
   9.126 -	unsigned long pgscan_direct_high;/* total highmem pages scanned */
   9.127 -	unsigned long pgscan_direct_normal;
   9.128 -	unsigned long pgscan_direct_dma;
   9.129 -	unsigned long pginodesteal;	/* pages reclaimed via inode freeing */
   9.130 -
   9.131 -	unsigned long slabs_scanned;	/* slab objects scanned */
   9.132 -	unsigned long kswapd_steal;	/* pages reclaimed by kswapd */
   9.133 -	unsigned long kswapd_inodesteal;/* reclaimed via kswapd inode freeing */
   9.134 -	unsigned long pageoutrun;	/* kswapd's calls to page reclaim */
   9.135 -	unsigned long allocstall;	/* direct reclaim calls */
   9.136 -
   9.137 -	unsigned long pgrotated;	/* pages rotated to tail of the LRU */
   9.138 -};
   9.139 -
   9.140 -DECLARE_PER_CPU(struct page_state, page_states);
   9.141 -
   9.142 -extern void get_page_state(struct page_state *ret);
   9.143 -extern void get_full_page_state(struct page_state *ret);
   9.144 -extern unsigned long __read_page_state(unsigned offset);
   9.145 -
   9.146 -#define read_page_state(member) \
   9.147 -	__read_page_state(offsetof(struct page_state, member))
   9.148 -
   9.149 -#define mod_page_state(member, delta)					\
   9.150 -	do {								\
   9.151 -		unsigned long flags;					\
   9.152 -		local_irq_save(flags);					\
   9.153 -		__get_cpu_var(page_states).member += (delta);		\
   9.154 -		local_irq_restore(flags);				\
   9.155 -	} while (0)
   9.156 -
   9.157 -
   9.158 -#define inc_page_state(member)	mod_page_state(member, 1UL)
   9.159 -#define dec_page_state(member)	mod_page_state(member, 0UL - 1)
   9.160 -#define add_page_state(member,delta) mod_page_state(member, (delta))
   9.161 -#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
   9.162 -
   9.163 -#define mod_page_state_zone(zone, member, delta)			\
   9.164 -	do {								\
   9.165 -		unsigned long flags;					\
   9.166 -		local_irq_save(flags);					\
   9.167 -		if (is_highmem(zone))					\
   9.168 -			__get_cpu_var(page_states).member##_high += (delta);\
   9.169 -		else if (is_normal(zone))				\
   9.170 -			__get_cpu_var(page_states).member##_normal += (delta);\
   9.171 -		else							\
   9.172 -			__get_cpu_var(page_states).member##_dma += (delta);\
   9.173 -		local_irq_restore(flags);				\
   9.174 -	} while (0)
   9.175 -
   9.176 -/*
   9.177 - * Manipulation of page state flags
   9.178 - */
   9.179 -#define PageLocked(page)		\
   9.180 -		test_bit(PG_locked, &(page)->flags)
   9.181 -#define SetPageLocked(page)		\
   9.182 -		set_bit(PG_locked, &(page)->flags)
   9.183 -#define TestSetPageLocked(page)		\
   9.184 -		test_and_set_bit(PG_locked, &(page)->flags)
   9.185 -#define ClearPageLocked(page)		\
   9.186 -		clear_bit(PG_locked, &(page)->flags)
   9.187 -#define TestClearPageLocked(page)	\
   9.188 -		test_and_clear_bit(PG_locked, &(page)->flags)
   9.189 -
   9.190 -#define PageError(page)		test_bit(PG_error, &(page)->flags)
   9.191 -#define SetPageError(page)	set_bit(PG_error, &(page)->flags)
   9.192 -#define ClearPageError(page)	clear_bit(PG_error, &(page)->flags)
   9.193 -
   9.194 -#define PageReferenced(page)	test_bit(PG_referenced, &(page)->flags)
   9.195 -#define SetPageReferenced(page)	set_bit(PG_referenced, &(page)->flags)
   9.196 -#define ClearPageReferenced(page)	clear_bit(PG_referenced, &(page)->flags)
   9.197 -#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
   9.198 -
   9.199 -#define PageUptodate(page)	test_bit(PG_uptodate, &(page)->flags)
   9.200 -#ifndef SetPageUptodate
   9.201 -#define SetPageUptodate(page)	set_bit(PG_uptodate, &(page)->flags)
   9.202 -#endif
   9.203 -#define ClearPageUptodate(page)	clear_bit(PG_uptodate, &(page)->flags)
   9.204 -
   9.205 -#define PageDirty(page)		test_bit(PG_dirty, &(page)->flags)
   9.206 -#define SetPageDirty(page)	set_bit(PG_dirty, &(page)->flags)
   9.207 -#define TestSetPageDirty(page)	test_and_set_bit(PG_dirty, &(page)->flags)
   9.208 -#define ClearPageDirty(page)	clear_bit(PG_dirty, &(page)->flags)
   9.209 -#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
   9.210 -
   9.211 -#define SetPageLRU(page)	set_bit(PG_lru, &(page)->flags)
   9.212 -#define PageLRU(page)		test_bit(PG_lru, &(page)->flags)
   9.213 -#define TestSetPageLRU(page)	test_and_set_bit(PG_lru, &(page)->flags)
   9.214 -#define TestClearPageLRU(page)	test_and_clear_bit(PG_lru, &(page)->flags)
   9.215 -
   9.216 -#define PageActive(page)	test_bit(PG_active, &(page)->flags)
   9.217 -#define SetPageActive(page)	set_bit(PG_active, &(page)->flags)
   9.218 -#define ClearPageActive(page)	clear_bit(PG_active, &(page)->flags)
   9.219 -#define TestClearPageActive(page) test_and_clear_bit(PG_active, &(page)->flags)
   9.220 -#define TestSetPageActive(page) test_and_set_bit(PG_active, &(page)->flags)
   9.221 -
   9.222 -#define PageSlab(page)		test_bit(PG_slab, &(page)->flags)
   9.223 -#define SetPageSlab(page)	set_bit(PG_slab, &(page)->flags)
   9.224 -#define ClearPageSlab(page)	clear_bit(PG_slab, &(page)->flags)
   9.225 -#define TestClearPageSlab(page)	test_and_clear_bit(PG_slab, &(page)->flags)
   9.226 -#define TestSetPageSlab(page)	test_and_set_bit(PG_slab, &(page)->flags)
   9.227 -
   9.228 -#ifdef CONFIG_HIGHMEM
   9.229 -#define PageHighMem(page)	test_bit(PG_highmem, &(page)->flags)
   9.230 -#else
   9.231 -#define PageHighMem(page)	0 /* needed to optimize away at compile time */
   9.232 -#endif
   9.233 -
   9.234 -#define PageChecked(page)	test_bit(PG_checked, &(page)->flags)
   9.235 -#define SetPageChecked(page)	set_bit(PG_checked, &(page)->flags)
   9.236 -#define ClearPageChecked(page)	clear_bit(PG_checked, &(page)->flags)
   9.237 -
   9.238 -#define PageReserved(page)	test_bit(PG_reserved, &(page)->flags)
   9.239 -#define SetPageReserved(page)	set_bit(PG_reserved, &(page)->flags)
   9.240 -#define ClearPageReserved(page)	clear_bit(PG_reserved, &(page)->flags)
   9.241 -#define __ClearPageReserved(page)	__clear_bit(PG_reserved, &(page)->flags)
   9.242 -
   9.243 -#define SetPagePrivate(page)	set_bit(PG_private, &(page)->flags)
   9.244 -#define ClearPagePrivate(page)	clear_bit(PG_private, &(page)->flags)
   9.245 -#define PagePrivate(page)	test_bit(PG_private, &(page)->flags)
   9.246 -
   9.247 -#define PageWriteback(page)	test_bit(PG_writeback, &(page)->flags)
   9.248 -#define SetPageWriteback(page)						\
   9.249 -	do {								\
   9.250 -		if (!test_and_set_bit(PG_writeback,			\
   9.251 -				&(page)->flags))			\
   9.252 -			inc_page_state(nr_writeback);			\
   9.253 -	} while (0)
   9.254 -#define TestSetPageWriteback(page)					\
   9.255 -	({								\
   9.256 -		int ret;						\
   9.257 -		ret = test_and_set_bit(PG_writeback,			\
   9.258 -					&(page)->flags);		\
   9.259 -		if (!ret)						\
   9.260 -			inc_page_state(nr_writeback);			\
   9.261 -		ret;							\
   9.262 -	})
   9.263 -#define ClearPageWriteback(page)					\
   9.264 -	do {								\
   9.265 -		if (test_and_clear_bit(PG_writeback,			\
   9.266 -				&(page)->flags))			\
   9.267 -			dec_page_state(nr_writeback);			\
   9.268 -	} while (0)
   9.269 -#define TestClearPageWriteback(page)					\
   9.270 -	({								\
   9.271 -		int ret;						\
   9.272 -		ret = test_and_clear_bit(PG_writeback,			\
   9.273 -				&(page)->flags);			\
   9.274 -		if (ret)						\
   9.275 -			dec_page_state(nr_writeback);			\
   9.276 -		ret;							\
   9.277 -	})
   9.278 -
   9.279 -#define PageNosave(page)	test_bit(PG_nosave, &(page)->flags)
   9.280 -#define SetPageNosave(page)	set_bit(PG_nosave, &(page)->flags)
   9.281 -#define TestSetPageNosave(page)	test_and_set_bit(PG_nosave, &(page)->flags)
   9.282 -#define ClearPageNosave(page)		clear_bit(PG_nosave, &(page)->flags)
   9.283 -#define TestClearPageNosave(page)	test_and_clear_bit(PG_nosave, &(page)->flags)
   9.284 -
   9.285 -#define PageMappedToDisk(page)	test_bit(PG_mappedtodisk, &(page)->flags)
   9.286 -#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
   9.287 -#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
   9.288 -
   9.289 -#define PageReclaim(page)	test_bit(PG_reclaim, &(page)->flags)
   9.290 -#define SetPageReclaim(page)	set_bit(PG_reclaim, &(page)->flags)
   9.291 -#define ClearPageReclaim(page)	clear_bit(PG_reclaim, &(page)->flags)
   9.292 -#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
   9.293 -
   9.294 -#define PageCompound(page)	test_bit(PG_compound, &(page)->flags)
   9.295 -#define SetPageCompound(page)	set_bit(PG_compound, &(page)->flags)
   9.296 -#define ClearPageCompound(page)	clear_bit(PG_compound, &(page)->flags)
   9.297 -
   9.298 -/* A foreign page uses a custom destructor rather than the buddy allocator. */
   9.299 -#ifdef CONFIG_FOREIGN_PAGES
   9.300 -#define PageForeign(page)	test_bit(PG_foreign, &(page)->flags)
   9.301 -#define SetPageForeign(page, dtor) do {		\
   9.302 -	set_bit(PG_foreign, &(page)->flags);	\
   9.303 -	(page)->mapping = (void *)dtor;		\
   9.304 -} while (0)
   9.305 -#define ClearPageForeign(page) do {		\
   9.306 -	clear_bit(PG_foreign, &(page)->flags);	\
   9.307 -	(page)->mapping = NULL;			\
   9.308 -} while (0)
   9.309 -#define PageForeignDestructor(page)	\
   9.310 -	( (void (*) (struct page *)) (page)->mapping )
   9.311 -#else
   9.312 -#define PageForeign(page)	0
   9.313 -#define PageForeignDestructor(page)	void
   9.314 -#endif
   9.315 -
   9.316 -#ifdef CONFIG_SWAP
   9.317 -#define PageSwapCache(page)	test_bit(PG_swapcache, &(page)->flags)
   9.318 -#define SetPageSwapCache(page)	set_bit(PG_swapcache, &(page)->flags)
   9.319 -#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags)
   9.320 -#else
   9.321 -#define PageSwapCache(page)	0
   9.322 -#endif
   9.323 -
   9.324 -struct page;	/* forward declaration */
   9.325 -
   9.326 -int test_clear_page_dirty(struct page *page);
   9.327 -int __clear_page_dirty(struct page *page);
   9.328 -int test_clear_page_writeback(struct page *page);
   9.329 -int test_set_page_writeback(struct page *page);
   9.330 -
   9.331 -static inline void clear_page_dirty(struct page *page)
   9.332 -{
   9.333 -	test_clear_page_dirty(page);
   9.334 -}
   9.335 -
   9.336 -static inline void set_page_writeback(struct page *page)
   9.337 -{
   9.338 -	test_set_page_writeback(page);
   9.339 -}
   9.340 -
   9.341 -#endif	/* PAGE_FLAGS_H */
    10.1 --- a/linux-2.6.9-xen-sparse/mm/page_alloc.c	Wed Nov 17 12:14:21 2004 +0000
    10.2 +++ b/linux-2.6.9-xen-sparse/mm/page_alloc.c	Wed Nov 17 13:13:55 2004 +0000
    10.3 @@ -275,7 +275,8 @@ void __free_pages_ok(struct page *page, 
    10.4  	LIST_HEAD(list);
    10.5  	int i;
    10.6  
    10.7 -	arch_free_page(page, order);
    10.8 +	if (arch_free_page(page, order))
    10.9 +		return;
   10.10  
   10.11  	mod_page_state(pgfree, 1 << order);
   10.12  	for (i = 0 ; i < (1 << order) ; ++i)
   10.13 @@ -505,10 +506,8 @@ static void fastcall free_hot_cold_page(
   10.14  	struct per_cpu_pages *pcp;
   10.15  	unsigned long flags;
   10.16  
   10.17 -	if (PageForeign(page))
   10.18 -		return (PageForeignDestructor(page))(page);
   10.19 -
   10.20 -	arch_free_page(page, 0);
   10.21 +	if (arch_free_page(page, 0))
   10.22 +		return;
   10.23  
   10.24  	kernel_map_pages(page, 1, 0);
   10.25  	inc_page_state(pgfree);