Skip to contentSkip to conversation

drm/i915: Drop get/put_pages for scratch page

PATCH New Daniel Vetter 1 participant 2 messages Sep 12, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915: Drop get/put_pages for scratch page

While discussing/reviewing __GFP_MOVEABLE behaviour and interactions with our various page allocations on irc Chris brought up that the scratch page isn't allocated as moveable, but we still grab/put a reference to lock it in place. Which is unecessary.

So drop that.

---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +0 -2
index 14f078c6cb75..a234446a8678 100644
@@ -1752,7 +1752,6 @@ static int setup_scratch_page(struct drm_device *dev)
 	page = alloc_page(GFP_KERNEL | GFP_DMA32 | __GFP_ZERO);
 	if (page == NULL)
 		return -ENOMEM;
-	get_page(page);
 	set_pages_uc(page, 1);
 
 #ifdef CONFIG_INTEL_IOMMU
@@ -1777,7 +1776,6 @@ static void teardown_scratch_page(struct drm_device *dev)
 	set_pages_wb(page, 1);
 	pci_unmap_page(dev->pdev, dev_priv->gtt.base.scratch.addr,
 		       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-	put_page(page);
 	__free_page(page);
 }
 
Signature · 1 line
2.0.1
#1 lore raw

PATCH 2/2 agp/intel-gtt: Remove get/put_pages

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.

---
 drivers/char/agp/intel-gtt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/char/agp/intel-gtt.c +0 -4
index 9a024f899dd4..f3334829e55a 100644
@@ -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);
 }
 
Signature · 1 line
2.0.1