linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Christoph Lameter" <cl@linux.com>,
	"Matthew Wilcox" <willy@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"David Airlie" <airlied@linux.ie>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Daniel Vetter" <daniel.vetter@intel.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>
Subject: [PATCH 07/71] drm: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
Date: Sun, 20 Mar 2016 21:40:14 +0300	[thread overview]
Message-ID: <1458499278-1516-8-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1458499278-1516-1-git-send-email-kirill.shutemov@linux.intel.com>

PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time ago
with promise that one day it will be possible to implement page cache with
bigger chunks than PAGE_SIZE.

This promise never materialized. And unlikely will.

We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE. And it's constant source of confusion on whether PAGE_CACHE_*
or PAGE_* constant should be used in a particular case, especially on the
border between fs and mm.

Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.

Let's stop pretending that pages in page cache are special. They are not.

The changes are pretty straight-forward:

 - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;

 - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

 - page_cache_get() -> get_page();

 - page_cache_release() -> put_page();

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian KA?nig <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 drivers/gpu/drm/armada/armada_gem.c     | 4 ++--
 drivers/gpu/drm/drm_gem.c               | 4 ++--
 drivers/gpu/drm/i915/i915_gem.c         | 8 ++++----
 drivers/gpu/drm/i915/i915_gem_userptr.c | 2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c     | 2 +-
 drivers/gpu/drm/ttm/ttm_tt.c            | 4 ++--
 drivers/gpu/drm/via/via_dmablit.c       | 2 +-
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 1cbb16e15307..d20a485c3aac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -574,7 +574,7 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 			set_page_dirty(page);
 
 		mark_page_accessed(page);
-		page_cache_release(page);
+		put_page(page);
 	}
 
 	sg_free_table(ttm->sg);
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index 6e731db31aa4..aca7f9cc6109 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -481,7 +481,7 @@ armada_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
 
  release:
 	for_each_sg(sgt->sgl, sg, num, i)
-		page_cache_release(sg_page(sg));
+		put_page(sg_page(sg));
  free_table:
 	sg_free_table(sgt);
  free_sgt:
@@ -502,7 +502,7 @@ static void armada_gem_prime_unmap_dma_buf(struct dma_buf_attachment *attach,
 	if (dobj->obj.filp) {
 		struct scatterlist *sg;
 		for_each_sg(sgt->sgl, sg, sgt->nents, i)
-			page_cache_release(sg_page(sg));
+			put_page(sg_page(sg));
 	}
 
 	sg_free_table(sgt);
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 2e8c77e71e1f..da0c5320789f 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -534,7 +534,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
 
 fail:
 	while (i--)
-		page_cache_release(pages[i]);
+		put_page(pages[i]);
 
 	drm_free_large(pages);
 	return ERR_CAST(p);
@@ -569,7 +569,7 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
 			mark_page_accessed(pages[i]);
 
 		/* Undo the reference we took when populating the table */
-		page_cache_release(pages[i]);
+		put_page(pages[i]);
 	}
 
 	drm_free_large(pages);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index bb44bad15403..7d6468407fd6 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -177,7 +177,7 @@ i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
 		drm_clflush_virt_range(vaddr, PAGE_SIZE);
 		kunmap_atomic(src);
 
-		page_cache_release(page);
+		put_page(page);
 		vaddr += PAGE_SIZE;
 	}
 
@@ -243,7 +243,7 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj)
 			set_page_dirty(page);
 			if (obj->madv == I915_MADV_WILLNEED)
 				mark_page_accessed(page);
-			page_cache_release(page);
+			put_page(page);
 			vaddr += PAGE_SIZE;
 		}
 		obj->dirty = 0;
@@ -2204,7 +2204,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
 		if (obj->madv == I915_MADV_WILLNEED)
 			mark_page_accessed(page);
 
-		page_cache_release(page);
+		put_page(page);
 	}
 	obj->dirty = 0;
 
@@ -2344,7 +2344,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
 err_pages:
 	sg_mark_end(sg);
 	for_each_sg_page(st->sgl, &sg_iter, st->nents, 0)
-		page_cache_release(sg_page_iter_page(&sg_iter));
+		put_page(sg_page_iter_page(&sg_iter));
 	sg_free_table(st);
 	kfree(st);
 
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 59e45b3a6937..7b5b6091bfdc 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -764,7 +764,7 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj)
 			set_page_dirty(page);
 
 		mark_page_accessed(page);
-		page_cache_release(page);
+		put_page(page);
 	}
 	obj->dirty = 0;
 
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index e06ac546a90f..19fdacb6cf75 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -610,7 +610,7 @@ static void radeon_ttm_tt_unpin_userptr(struct ttm_tt *ttm)
 			set_page_dirty(page);
 
 		mark_page_accessed(page);
-		page_cache_release(page);
+		put_page(page);
 	}
 
 	sg_free_table(ttm->sg);
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index 4e19d0f9cc30..077ae9b2865d 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -311,7 +311,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
 			goto out_err;
 
 		copy_highpage(to_page, from_page);
-		page_cache_release(from_page);
+		put_page(from_page);
 	}
 
 	if (!(ttm->page_flags & TTM_PAGE_FLAG_PERSISTENT_SWAP))
@@ -361,7 +361,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
 		copy_highpage(to_page, from_page);
 		set_page_dirty(to_page);
 		mark_page_accessed(to_page);
-		page_cache_release(to_page);
+		put_page(to_page);
 	}
 
 	ttm_tt_unpopulate(ttm);
diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c
index d0cbd5ecd7f0..0c76a4d429f2 100644
--- a/drivers/gpu/drm/via/via_dmablit.c
+++ b/drivers/gpu/drm/via/via_dmablit.c
@@ -188,7 +188,7 @@ via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg)
 			if (NULL != (page = vsg->pages[i])) {
 				if (!PageReserved(page) && (DMA_FROM_DEVICE == vsg->direction))
 					SetPageDirty(page);
-				page_cache_release(page);
+				put_page(page);
 			}
 		}
 	case dr_via_pages_alloc:
-- 
2.7.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2016-03-20 18:42 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20 18:40 [PATCH 00/71] get rid of PAGE_CACHE_* and page_cache_{get,release} macros Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 01/71] arc: " Kirill A. Shutemov
2016-03-20 18:54   ` Linus Torvalds
2016-03-20 19:00     ` Al Viro
2016-03-20 19:13       ` Linus Torvalds
2016-03-20 19:34         ` Kirill A. Shutemov
2016-03-20 19:57           ` Linus Torvalds
2016-03-20 22:21             ` Hugh Dickins
2016-03-20 19:07     ` Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 02/71] arm: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 03/71] parisc: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 04/71] powerpc: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 05/71] s390: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 06/71] block: " Kirill A. Shutemov
2016-03-20 18:40 ` Kirill A. Shutemov [this message]
2016-03-20 18:40 ` [PATCH 08/71] md: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 09/71] v4l: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 10/71] drivers/misc: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 11/71] mmc: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 12/71] mtd: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 13/71] nvdimm: " Kirill A. Shutemov
2016-03-22 20:16   ` Ross Zwisler
2016-03-20 18:40 ` [PATCH 14/71] oprofile: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 15/71] scsi: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 16/71] lustre: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 17/71] usb: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 18/71] fbdev: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 19/71] 9p: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 20/71] affs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 21/71] afs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 22/71] btrfs: " Kirill A. Shutemov
2016-03-21 13:41   ` David Sterba
2016-03-20 18:40 ` [PATCH 23/71] cachefiles: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 24/71] ceph: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 25/71] cifs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 26/71] configfs: " Kirill A. Shutemov
2016-03-21 14:32   ` Christoph Hellwig
2016-03-20 18:40 ` [PATCH 27/71] cramfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 28/71] dlm: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 29/71] ecryptfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 30/71] efivarfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 31/71] exofs: " Kirill A. Shutemov
2016-03-22  5:31   ` Boaz Harrosh
2016-03-20 18:40 ` [PATCH 32/71] ext2: " Kirill A. Shutemov
2016-03-21  8:50   ` Jan Kara
2016-03-20 18:40 ` [PATCH 33/71] ext4: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 34/71] f2fs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 35/71] freevxfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 36/71] fscache: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 37/71] fuse: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 38/71] gfs2: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 39/71] hfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 40/71] hfsplus: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 41/71] hostfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 42/71] isofs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 43/71] jbd2: " Kirill A. Shutemov
2016-03-21  8:50   ` Jan Kara
2016-03-20 18:40 ` [PATCH 44/71] jffs2: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 45/71] jfs: " Kirill A. Shutemov
2016-03-21 13:28   ` Dave Kleikamp
2016-03-20 18:40 ` [PATCH 46/71] kernfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 47/71] logfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 48/71] minix: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 49/71] ncpfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 50/71] nfs: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 51/71] nilfs2: " Kirill A. Shutemov
2016-03-20 18:40 ` [PATCH 52/71] ntfs: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 53/71] ocfs2: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 54/71] proc: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 55/71] pstore: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 56/71] qnx6: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 57/71] ramfs: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 58/71] reiserfs: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 59/71] " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 60/71] sysv: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 61/71] ubifs: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 62/71] udf: " Kirill A. Shutemov
2016-03-21  8:50   ` Jan Kara
2016-03-20 18:41 ` [PATCH 63/71] ufs: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 64/71] xfs: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 65/71] binfmt: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 66/71] hugetlb: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 67/71] mqueue: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 68/71] uprobes: " Kirill A. Shutemov
2016-03-20 18:41 ` [PATCH 69/71] vfs: " Kirill A. Shutemov
2016-03-20 23:46   ` Matthew Wilcox
2016-03-20 18:41 ` [PATCH 70/71] mm: " Kirill A. Shutemov
2016-03-20 23:59   ` Guenter Roeck
2016-03-20 18:41 ` [PATCH 71/71] mm: drop PAGE_CACHE_* and page_cache_{get,release} definition Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458499278-1516-8-git-send-email-kirill.shutemov@linux.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.deucher@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=cl@linux.com \
    --cc=daniel.vetter@intel.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).