ia64/xen-unstable

changeset 14219:1061c7bff38f

linux: allow use of split page table locks

This changes netback to use struct page's mapping field instead of the
index one, and the PageForeign logic the other way around. That way,
CONFIG_SPLIT_PTLOCK_CPUS doesn't have to be suppressed anymore for x86.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kfraser@localhost.localdomain
date Fri Mar 02 15:59:12 2007 +0000 (2007-03-02)
parents 0d5d7d472024
children 1fb5ae0ee453
files linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/include/linux/page-flags.h linux-2.6-xen-sparse/mm/Kconfig
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri Mar 02 15:32:42 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri Mar 02 15:59:12 2007 +0000
     1.3 @@ -40,6 +40,9 @@
     1.4  
     1.5  /*#define NETBE_DEBUG_INTERRUPT*/
     1.6  
     1.7 +/* extra field used in struct page */
     1.8 +#define netif_page_index(pg) (*(long *)&(pg)->mapping)
     1.9 +
    1.10  struct netbk_rx_meta {
    1.11  	skb_frag_t frag;
    1.12  	int id;
    1.13 @@ -352,7 +355,7 @@ static u16 netbk_gop_frag(netif_t *netif
    1.14  		copy_gop->flags = GNTCOPY_dest_gref;
    1.15  		if (PageForeign(page)) {
    1.16  			struct pending_tx_info *src_pend =
    1.17 -				&pending_tx_info[page->index];
    1.18 +				&pending_tx_info[netif_page_index(page)];
    1.19  			copy_gop->source.domid = src_pend->netif->domid;
    1.20  			copy_gop->source.u.ref = src_pend->req.gref;
    1.21  			copy_gop->flags |= GNTCOPY_source_gref;
    1.22 @@ -1327,7 +1330,7 @@ static void netif_page_release(struct pa
    1.23  	/* Ready for next use. */
    1.24  	init_page_count(page);
    1.25  
    1.26 -	netif_idx_release(page->index);
    1.27 +	netif_idx_release(netif_page_index(page));
    1.28  }
    1.29  
    1.30  irqreturn_t netif_be_int(int irq, void *dev_id, struct pt_regs *regs)
    1.31 @@ -1457,7 +1460,7 @@ static int __init netback_init(void)
    1.32  	for (i = 0; i < MAX_PENDING_REQS; i++) {
    1.33  		page = mmap_pages[i];
    1.34  		SetPageForeign(page, netif_page_release);
    1.35 -		page->index = i;
    1.36 +		netif_page_index(page) = i;
    1.37  	}
    1.38  
    1.39  	pending_cons = 0;
     2.1 --- a/linux-2.6-xen-sparse/include/linux/page-flags.h	Fri Mar 02 15:32:42 2007 +0000
     2.2 +++ b/linux-2.6-xen-sparse/include/linux/page-flags.h	Fri Mar 02 15:59:12 2007 +0000
     2.3 @@ -252,14 +252,14 @@
     2.4  #define PageForeign(page)	test_bit(PG_foreign, &(page)->flags)
     2.5  #define SetPageForeign(page, dtor) do {		\
     2.6  	set_bit(PG_foreign, &(page)->flags);	\
     2.7 -	(page)->mapping = (void *)dtor;		\
     2.8 +	(page)->index = (long)(dtor);		\
     2.9  } while (0)
    2.10  #define ClearPageForeign(page) do {		\
    2.11  	clear_bit(PG_foreign, &(page)->flags);	\
    2.12 -	(page)->mapping = NULL;			\
    2.13 +	(page)->index = 0;			\
    2.14  } while (0)
    2.15  #define PageForeignDestructor(page)		\
    2.16 -	( (void (*) (struct page *)) (page)->mapping )(page)
    2.17 +	( (void (*) (struct page *)) (page)->index )(page)
    2.18  
    2.19  struct page;	/* forward declaration */
    2.20  
     3.1 --- a/linux-2.6-xen-sparse/mm/Kconfig	Fri Mar 02 15:32:42 2007 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,157 +0,0 @@
     3.4 -config SELECT_MEMORY_MODEL
     3.5 -	def_bool y
     3.6 -	depends on EXPERIMENTAL || ARCH_SELECT_MEMORY_MODEL
     3.7 -
     3.8 -choice
     3.9 -	prompt "Memory model"
    3.10 -	depends on SELECT_MEMORY_MODEL
    3.11 -	default DISCONTIGMEM_MANUAL if ARCH_DISCONTIGMEM_DEFAULT
    3.12 -	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
    3.13 -	default FLATMEM_MANUAL
    3.14 -
    3.15 -config FLATMEM_MANUAL
    3.16 -	bool "Flat Memory"
    3.17 -	depends on !(ARCH_DISCONTIGMEM_ENABLE || ARCH_SPARSEMEM_ENABLE) || ARCH_FLATMEM_ENABLE
    3.18 -	help
    3.19 -	  This option allows you to change some of the ways that
    3.20 -	  Linux manages its memory internally.  Most users will
    3.21 -	  only have one option here: FLATMEM.  This is normal
    3.22 -	  and a correct option.
    3.23 -
    3.24 -	  Some users of more advanced features like NUMA and
    3.25 -	  memory hotplug may have different options here.
    3.26 -	  DISCONTIGMEM is an more mature, better tested system,
    3.27 -	  but is incompatible with memory hotplug and may suffer
    3.28 -	  decreased performance over SPARSEMEM.  If unsure between
    3.29 -	  "Sparse Memory" and "Discontiguous Memory", choose
    3.30 -	  "Discontiguous Memory".
    3.31 -
    3.32 -	  If unsure, choose this option (Flat Memory) over any other.
    3.33 -
    3.34 -config DISCONTIGMEM_MANUAL
    3.35 -	bool "Discontiguous Memory"
    3.36 -	depends on ARCH_DISCONTIGMEM_ENABLE
    3.37 -	help
    3.38 -	  This option provides enhanced support for discontiguous
    3.39 -	  memory systems, over FLATMEM.  These systems have holes
    3.40 -	  in their physical address spaces, and this option provides
    3.41 -	  more efficient handling of these holes.  However, the vast
    3.42 -	  majority of hardware has quite flat address spaces, and
    3.43 -	  can have degraded performance from extra overhead that
    3.44 -	  this option imposes.
    3.45 -
    3.46 -	  Many NUMA configurations will have this as the only option.
    3.47 -
    3.48 -	  If unsure, choose "Flat Memory" over this option.
    3.49 -
    3.50 -config SPARSEMEM_MANUAL
    3.51 -	bool "Sparse Memory"
    3.52 -	depends on ARCH_SPARSEMEM_ENABLE
    3.53 -	help
    3.54 -	  This will be the only option for some systems, including
    3.55 -	  memory hotplug systems.  This is normal.
    3.56 -
    3.57 -	  For many other systems, this will be an alternative to
    3.58 -	  "Discontiguous Memory".  This option provides some potential
    3.59 -	  performance benefits, along with decreased code complexity,
    3.60 -	  but it is newer, and more experimental.
    3.61 -
    3.62 -	  If unsure, choose "Discontiguous Memory" or "Flat Memory"
    3.63 -	  over this option.
    3.64 -
    3.65 -endchoice
    3.66 -
    3.67 -config DISCONTIGMEM
    3.68 -	def_bool y
    3.69 -	depends on (!SELECT_MEMORY_MODEL && ARCH_DISCONTIGMEM_ENABLE) || DISCONTIGMEM_MANUAL
    3.70 -
    3.71 -config SPARSEMEM
    3.72 -	def_bool y
    3.73 -	depends on SPARSEMEM_MANUAL
    3.74 -
    3.75 -config FLATMEM
    3.76 -	def_bool y
    3.77 -	depends on (!DISCONTIGMEM && !SPARSEMEM) || FLATMEM_MANUAL
    3.78 -
    3.79 -config FLAT_NODE_MEM_MAP
    3.80 -	def_bool y
    3.81 -	depends on !SPARSEMEM
    3.82 -
    3.83 -#
    3.84 -# Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's
    3.85 -# to represent different areas of memory.  This variable allows
    3.86 -# those dependencies to exist individually.
    3.87 -#
    3.88 -config NEED_MULTIPLE_NODES
    3.89 -	def_bool y
    3.90 -	depends on DISCONTIGMEM || NUMA
    3.91 -
    3.92 -config HAVE_MEMORY_PRESENT
    3.93 -	def_bool y
    3.94 -	depends on ARCH_HAVE_MEMORY_PRESENT || SPARSEMEM
    3.95 -
    3.96 -#
    3.97 -# SPARSEMEM_EXTREME (which is the default) does some bootmem
    3.98 -# allocations when memory_present() is called.  If this can not
    3.99 -# be done on your architecture, select this option.  However,
   3.100 -# statically allocating the mem_section[] array can potentially
   3.101 -# consume vast quantities of .bss, so be careful.
   3.102 -#
   3.103 -# This option will also potentially produce smaller runtime code
   3.104 -# with gcc 3.4 and later.
   3.105 -#
   3.106 -config SPARSEMEM_STATIC
   3.107 -	def_bool n
   3.108 -
   3.109 -#
   3.110 -# Architectecture platforms which require a two level mem_section in SPARSEMEM
   3.111 -# must select this option. This is usually for architecture platforms with
   3.112 -# an extremely sparse physical address space.
   3.113 -#
   3.114 -config SPARSEMEM_EXTREME
   3.115 -	def_bool y
   3.116 -	depends on SPARSEMEM && !SPARSEMEM_STATIC
   3.117 -
   3.118 -# eventually, we can have this option just 'select SPARSEMEM'
   3.119 -config MEMORY_HOTPLUG
   3.120 -	bool "Allow for memory hot-add"
   3.121 -	depends on SPARSEMEM && HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
   3.122 -	depends on (IA64 || X86 || PPC64)
   3.123 -
   3.124 -comment "Memory hotplug is currently incompatible with Software Suspend"
   3.125 -	depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
   3.126 -
   3.127 -# Heavily threaded applications may benefit from splitting the mm-wide
   3.128 -# page_table_lock, so that faults on different parts of the user address
   3.129 -# space can be handled with less contention: split it at this NR_CPUS.
   3.130 -# Default to 4 for wider testing, though 8 might be more appropriate.
   3.131 -# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
   3.132 -# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
   3.133 -# XEN on x86 architecture uses the mapping field on pagetable pages to store a
   3.134 -# pointer to the destructor. This conflicts with pte_lock_deinit().
   3.135 -#
   3.136 -config SPLIT_PTLOCK_CPUS
   3.137 -	int
   3.138 -	default "4096" if ARM && !CPU_CACHE_VIPT
   3.139 -	default "4096" if PARISC && !PA20
   3.140 -	default "4096" if X86_XEN || X86_64_XEN
   3.141 -	default "4"
   3.142 -
   3.143 -#
   3.144 -# support for page migration
   3.145 -#
   3.146 -config MIGRATION
   3.147 -	bool "Page migration"
   3.148 -	def_bool y
   3.149 -	depends on NUMA
   3.150 -	help
   3.151 -	  Allows the migration of the physical location of pages of processes
   3.152 -	  while the virtual addresses are not changed. This is useful for
   3.153 -	  example on NUMA systems to put pages nearer to the processors accessing
   3.154 -	  the page.
   3.155 -
   3.156 -config RESOURCES_64BIT
   3.157 -	bool "64 bit Memory and IO resources (EXPERIMENTAL)" if (!64BIT && EXPERIMENTAL)
   3.158 -	default 64BIT
   3.159 -	help
   3.160 -	  This option allows memory and IO resources to be 64 bit.