agp/intel-gtt: Remove get/put_pages
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 12 Sep 2014 13:20:24 +0000 (15:20 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 19 Sep 2014 12:43:11 +0000 (14:43 +0200)
If a page isn't allocated as __GFP_MOVEABLE it won't move around, so
no need to grab a reference to lock it into place.

Discovered while reviewing page allocation handling in i915 gem.

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
drivers/char/agp/intel-gtt.c

index 9a024f899dd40a040ccede1571e1e2919e61bea9..f3334829e55a3e6ac393a348c6da0e7aef159709 100644 (file)
@@ -153,7 +153,6 @@ static struct page *i8xx_alloc_pages(void)
                __free_pages(page, 2);
                return NULL;
        }
-       get_page(page);
        atomic_inc(&agp_bridge->current_memory_agp);
        return page;
 }
@@ -164,7 +163,6 @@ static void i8xx_destroy_pages(struct page *page)
                return;
 
        set_pages_wb(page, 4);
-       put_page(page);
        __free_pages(page, 2);
        atomic_dec(&agp_bridge->current_memory_agp);
 }
@@ -300,7 +298,6 @@ static int intel_gtt_setup_scratch_page(void)
        page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO);
        if (page == NULL)
                return -ENOMEM;
-       get_page(page);
        set_pages_uc(page, 1);
 
        if (intel_private.needs_dmar) {
@@ -560,7 +557,6 @@ static void intel_gtt_teardown_scratch_page(void)
        set_pages_wb(intel_private.scratch_page, 1);
        pci_unmap_page(intel_private.pcidev, intel_private.scratch_page_dma,
                       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-       put_page(intel_private.scratch_page);
        __free_page(intel_private.scratch_page);
 }