Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Mar 2010 17:11:02 +0000 (09:11 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Mar 2010 17:11:02 +0000 (09:11 -0800)
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  resource: Fix broken indentation
  resource: Fix generic page_is_ram() for partial RAM pages
  x86, paravirt: Remove kmap_atomic_pte paravirt op.
  x86, vmi: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y
  x86, xen: Disable highmem PTE allocation even when CONFIG_HIGHPTE=y

1  2 
arch/x86/include/asm/pgtable_32.h
kernel/resource.c

@@@ -54,10 -54,10 +54,10 @@@ extern void set_pmd_pfn(unsigned long, 
         in_irq() ? KM_IRQ_PTE :        \
         KM_PTE0)
  #define pte_offset_map(dir, address)                                  \
-       ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), __KM_PTE) +         \
+       ((pte_t *)kmap_atomic(pmd_page(*(dir)), __KM_PTE) +             \
         pte_index((address)))
  #define pte_offset_map_nested(dir, address)                           \
-       ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) +          \
+       ((pte_t *)kmap_atomic(pmd_page(*(dir)), KM_PTE1) +              \
         pte_index((address)))
  #define pte_unmap(pte) kunmap_atomic((pte), __KM_PTE)
  #define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
@@@ -80,7 -80,7 +80,7 @@@ do {                                          
   * The i386 doesn't have any external MMU info: the kernel page
   * tables contain all the necessary information.
   */
 -#define update_mmu_cache(vma, address, pte) do { } while (0)
 +#define update_mmu_cache(vma, address, ptep) do { } while (0)
  
  #endif /* !__ASSEMBLY__ */
  
diff --combined kernel/resource.c
@@@ -188,36 -188,6 +188,36 @@@ static int __release_resource(struct re
        return -EINVAL;
  }
  
 +static void __release_child_resources(struct resource *r)
 +{
 +      struct resource *tmp, *p;
 +      resource_size_t size;
 +
 +      p = r->child;
 +      r->child = NULL;
 +      while (p) {
 +              tmp = p;
 +              p = p->sibling;
 +
 +              tmp->parent = NULL;
 +              tmp->sibling = NULL;
 +              __release_child_resources(tmp);
 +
 +              printk(KERN_DEBUG "release child resource %pR\n", tmp);
 +              /* need to restore size, and keep flags */
 +              size = resource_size(tmp);
 +              tmp->start = 0;
 +              tmp->end = size - 1;
 +      }
 +}
 +
 +void release_child_resources(struct resource *r)
 +{
 +      write_lock(&resource_lock);
 +      __release_child_resources(r);
 +      write_unlock(&resource_lock);
 +}
 +
  /**
   * request_resource - request and reserve an I/O or memory resource
   * @root: root resource descriptor
@@@ -304,7 -274,7 +304,7 @@@ int walk_system_ram_range(unsigned lon
                void *arg, int (*func)(unsigned long, unsigned long, void *))
  {
        struct resource res;
-       unsigned long pfn, len;
+       unsigned long pfn, end_pfn;
        u64 orig_end;
        int ret = -1;
  
        orig_end = res.end;
        while ((res.start < res.end) &&
                (find_next_system_ram(&res, "System RAM") >= 0)) {
-               pfn = (unsigned long)(res.start >> PAGE_SHIFT);
-               len = (unsigned long)((res.end + 1 - res.start) >> PAGE_SHIFT);
-               ret = (*func)(pfn, len, arg);
+               pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT;
+               end_pfn = (res.end + 1) >> PAGE_SHIFT;
+               if (end_pfn > pfn)
+                       ret = (*func)(pfn, end_pfn - pfn, arg);
                if (ret)
                        break;
                res.start = res.end + 1;
@@@ -346,10 -317,8 +347,10 @@@ int __weak page_is_ram(unsigned long pf
  static int find_resource(struct resource *root, struct resource *new,
                         resource_size_t size, resource_size_t min,
                         resource_size_t max, resource_size_t align,
 -                       void (*alignf)(void *, struct resource *,
 -                                      resource_size_t, resource_size_t),
 +                       resource_size_t (*alignf)(void *,
 +                                                 const struct resource *,
 +                                                 resource_size_t,
 +                                                 resource_size_t),
                         void *alignf_data)
  {
        struct resource *this = root->child;
                        tmp.end = max;
                tmp.start = ALIGN(tmp.start, align);
                if (alignf)
 -                      alignf(alignf_data, &tmp, size, align);
 +                      tmp.start = alignf(alignf_data, &tmp, size, align);
                if (tmp.start < tmp.end && tmp.end - tmp.start >= size - 1) {
                        new->start = tmp.start;
                        new->end = tmp.start + size - 1;
  int allocate_resource(struct resource *root, struct resource *new,
                      resource_size_t size, resource_size_t min,
                      resource_size_t max, resource_size_t align,
 -                    void (*alignf)(void *, struct resource *,
 -                                   resource_size_t, resource_size_t),
 +                    resource_size_t (*alignf)(void *,
 +                                              const struct resource *,
 +                                              resource_size_t,
 +                                              resource_size_t),
                      void *alignf_data)
  {
        int err;