ia64/xen-unstable

changeset 3987:d400d2b7feaf

bitkeeper revision 1.1236.9.2 (422840a9xbbNuTrbO6poyFnzBRcuOg)

caller specified decrement to put_page_type(s)
author cwc22@centipede.cl.cam.ac.uk
date Fri Mar 04 11:04:09 2005 +0000 (2005-03-04)
parents f7c31440d003
children 66a6d4a1d88b
files xen/arch/x86/mm.c xen/common/grant_table.c xen/include/asm-x86/mm.h
line diff
     1.1 --- a/xen/arch/x86/mm.c	Fri Mar 04 02:00:12 2005 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Fri Mar 04 11:04:09 2005 +0000
     1.3 @@ -1060,14 +1060,14 @@ void free_page_type(struct pfn_info *pag
     1.4  }
     1.5  
     1.6  
     1.7 -void put_page_type(struct pfn_info *page)
     1.8 +void put_page_types(struct pfn_info *page, u32 decrement)
     1.9  {
    1.10      u32 nx, x, y = page->u.inuse.type_info;
    1.11  
    1.12   again:
    1.13      do {
    1.14          x  = y;
    1.15 -        nx = x - 1;
    1.16 +        nx = x - decrement;
    1.17  
    1.18          ASSERT((x & PGT_count_mask) != 0);
    1.19  
     2.1 --- a/xen/common/grant_table.c	Fri Mar 04 02:00:12 2005 +0000
     2.2 +++ b/xen/common/grant_table.c	Fri Mar 04 11:04:09 2005 +0000
     2.3 @@ -707,7 +707,8 @@ gnttab_release_all_mappings(grant_table_
     2.4      grant_mapping_t        *map;
     2.5      domid_t                 dom;
     2.6      grant_ref_t             ref;
     2.7 -    u16                     handle, i;
     2.8 +    u16                     handle;
     2.9 +    u32                     pincount;
    2.10      struct domain          *ld, *rd;
    2.11      unsigned long           frame;
    2.12      active_grant_entry_t   *act;
    2.13 @@ -733,10 +734,8 @@ gnttab_release_all_mappings(grant_table_
    2.14              {
    2.15                  if ( rd != NULL )
    2.16                      put_domain(rd);
    2.17 -                /* TODO: need to be able to handle domains destroyed
    2.18 -                 *       with active mappings.
    2.19 -                 */
    2.20 -                DPRINTK("Grant release: Could not find domain %d\n", dom);
    2.21 +
    2.22 +                printk(KERN_WARNING "Grant release: Could not find domain %d\n", dom);
    2.23                  continue;
    2.24              }
    2.25  
    2.26 @@ -747,16 +746,16 @@ gnttab_release_all_mappings(grant_table_
    2.27  
    2.28              frame = act->frame;
    2.29  
    2.30 -            for ( i = ((act->pin & GNTPIN_hstw_mask) >> GNTPIN_hstw_shift) +
    2.31 -                      ((act->pin & GNTPIN_devw_mask) >> GNTPIN_devw_shift);
    2.32 -                  i > 0; i-- )
    2.33 -            {
    2.34 -                put_page_type(&frame_table[frame]);
    2.35 -            }
    2.36 -            act->pin = 0;
    2.37 +            pincount = ((act->pin & GNTPIN_hstw_mask) >> GNTPIN_hstw_shift) +
    2.38 +                       ((act->pin & GNTPIN_devw_mask) >> GNTPIN_devw_shift);
    2.39 +
    2.40 +            if ( pincount > 0 )
    2.41 +                put_page_types(&frame_table[frame], pincount);
    2.42  
    2.43              put_page(&frame_table[frame]);
    2.44  
    2.45 +            act->pin = 0;
    2.46 +
    2.47              clear_bit(_GTF_reading, &sha->flags);
    2.48              clear_bit(_GTF_writing, &sha->flags);
    2.49  
     3.1 --- a/xen/include/asm-x86/mm.h	Fri Mar 04 02:00:12 2005 +0000
     3.2 +++ b/xen/include/asm-x86/mm.h	Fri Mar 04 11:04:09 2005 +0000
     3.3 @@ -182,9 +182,14 @@ static inline int get_page(struct pfn_in
     3.4      return 1;
     3.5  }
     3.6  
     3.7 -void put_page_type(struct pfn_info *page);
     3.8 +void put_page_types(struct pfn_info *page, u32 decrement);
     3.9  int  get_page_type(struct pfn_info *page, u32 type);
    3.10  
    3.11 +static inline void put_page_type(struct pfn_info *page)
    3.12 +{
    3.13 +    put_page_types(page, 1);
    3.14 +}
    3.15 +
    3.16  static inline void put_page_and_type(struct pfn_info *page)
    3.17  {
    3.18      put_page_type(page);