Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bf53d6f8fa467397a16de2a2500312ae26528d34
Commit:     bf53d6f8fa467397a16de2a2500312ae26528d34
Parent:     9e2779fa281cfda13ac060753d674bbcaa23367e
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Mon Feb 4 22:28:34 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Feb 5 09:44:14 2008 -0800

    vmalloc: clean up page array indexing
    
    The page array is repeatedly indexed both in vunmap and vmalloc_area_node().
    Add a temporary variable to make it easier to read (and easier to patch
    later).
    
    Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: Nick Piggin <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/vmalloc.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 21abac2..83625b6 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -384,8 +384,10 @@ static void __vunmap(const void *addr, int 
deallocate_pages)
                int i;
 
                for (i = 0; i < area->nr_pages; i++) {
-                       BUG_ON(!area->pages[i]);
-                       __free_page(area->pages[i]);
+                       struct page *page = area->pages[i];
+
+                       BUG_ON(!page);
+                       __free_page(page);
                }
 
                if (area->flags & VM_VPAGES)
@@ -489,15 +491,19 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t 
gfp_mask,
        }
 
        for (i = 0; i < area->nr_pages; i++) {
+               struct page *page;
+
                if (node < 0)
-                       area->pages[i] = alloc_page(gfp_mask);
+                       page = alloc_page(gfp_mask);
                else
-                       area->pages[i] = alloc_pages_node(node, gfp_mask, 0);
-               if (unlikely(!area->pages[i])) {
+                       page = alloc_pages_node(node, gfp_mask, 0);
+
+               if (unlikely(!page)) {
                        /* Successfully allocated i pages, free them in 
__vunmap() */
                        area->nr_pages = i;
                        goto fail;
                }
+               area->pages[i] = page;
        }
 
        if (map_vm_area(area, prot, &pages))
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to