diff mbox

[3/5] drm/i915: use shmem helpers if possible

Message ID 1401021252-29006-3-git-send-email-dh.herrmann@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Herrmann May 25, 2014, 12:34 p.m. UTC
Instead of shuffling gfp-masks all the time, use the
shmem_read_mapping_page() helper. Note that __GFP_IO and __GFP_WAIT are
set in mapping_gfp_mask() for i915, so the behavior is still the same.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

Comments

Daniel Vetter June 2, 2014, 3 p.m. UTC | #1
On Sun, May 25, 2014 at 02:34:10PM +0200, David Herrmann wrote:
> Instead of shuffling gfp-masks all the time, use the
> shmem_read_mapping_page() helper. Note that __GFP_IO and __GFP_WAIT are
> set in mapping_gfp_mask() for i915, so the behavior is still the same.
> 
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_gem.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index e1fa919..1a72aad 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1925,16 +1925,10 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
>  			 * our own buffer, now let the real VM do its job and
>  			 * go down in flames if truly OOM.
>  			 */
> -			gfp &= ~(__GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD);
> -			gfp |= __GFP_IO | __GFP_WAIT;
> -
>  			i915_gem_shrink_all(dev_priv);
> -			page = shmem_read_mapping_page_gfp(mapping, i, gfp);
> +			page = shmem_read_mapping_page(mapping, i);
>  			if (IS_ERR(page))
>  				goto err_pages;
> -
> -			gfp |= __GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD;
> -			gfp &= ~(__GFP_IO | __GFP_WAIT);
>  		}
>  #ifdef CONFIG_SWIOTLB
>  		if (swiotlb_nr_tbl()) {
> -- 
> 1.9.3
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e1fa919..1a72aad 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1925,16 +1925,10 @@  i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
 			 * our own buffer, now let the real VM do its job and
 			 * go down in flames if truly OOM.
 			 */
-			gfp &= ~(__GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD);
-			gfp |= __GFP_IO | __GFP_WAIT;
-
 			i915_gem_shrink_all(dev_priv);
-			page = shmem_read_mapping_page_gfp(mapping, i, gfp);
+			page = shmem_read_mapping_page(mapping, i);
 			if (IS_ERR(page))
 				goto err_pages;
-
-			gfp |= __GFP_NORETRY | __GFP_NOWARN | __GFP_NO_KSWAPD;
-			gfp &= ~(__GFP_IO | __GFP_WAIT);
 		}
 #ifdef CONFIG_SWIOTLB
 		if (swiotlb_nr_tbl()) {