* [PATCH 1/7] Introduce delete_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2010-12-22 15:32 ` [PATCH 2/7] fuse: Change remove_from_page_cache Minchan Kim
` (7 subsequent siblings)
8 siblings, 0 replies; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim, Christoph Hellwig,
Hugh Dickins
This function works as just wrapper remove_from_page_cache.
The difference is that it decreases page references in itself.
So caller have to make sure it has a page reference before calling.
This patch is ready for removing remove_from_page_cache.
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
include/linux/pagemap.h | 1 +
mm/filemap.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 9c66e99..7a1cb49 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -457,6 +457,7 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
extern void remove_from_page_cache(struct page *page);
extern void __remove_from_page_cache(struct page *page);
+extern void delete_from_page_cache(struct page *page);
/*
* Like add_to_page_cache_locked, but used to add newly allocated pages:
diff --git a/mm/filemap.c b/mm/filemap.c
index 095c393..1ca7475 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -166,6 +166,23 @@ void remove_from_page_cache(struct page *page)
}
EXPORT_SYMBOL(remove_from_page_cache);
+/**
+ * delete_from_page_cache - delete page from page cache
+ *
+ * @page: the page which the kernel is trying to remove from page cache
+ *
+ * This must be called only on pages that have
+ * been verified to be in the page cache and locked.
+ * It will never put the page into the free list,
+ * the caller has a reference on the page.
+ */
+void delete_from_page_cache(struct page *page)
+{
+ remove_from_page_cache(page);
+ page_cache_release(page);
+}
+EXPORT_SYMBOL(delete_from_page_cache);
+
static int sync_page(void *word)
{
struct address_space *mapping;
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/7] fuse: Change remove_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
2010-12-22 15:32 ` [PATCH 1/7] Introduce delete_from_page_cache Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2011-01-08 22:22 ` Johannes Weiner
2010-12-22 15:32 ` [PATCH 3/7] tlbfs: " Minchan Kim
` (6 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim, Miklos Szeredi,
fuse-devel
This patch series changes remove_from_page_cache's page ref counting
rule. Page cache ref count is decreased in delete_from_page_cache.
So we don't need decreasing page reference by caller.
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: fuse-devel@lists.sourceforge.net
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/fuse/dev.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index cf8d28d..1ef24fb 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -737,8 +737,7 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
if (WARN_ON(PageMlocked(oldpage)))
goto out_fallback_unlock;
- remove_from_page_cache(oldpage);
- page_cache_release(oldpage);
+ delete_from_page_cache(oldpage);
err = add_to_page_cache_locked(newpage, mapping, index, GFP_KERNEL);
if (err) {
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/7] fuse: Change remove_from_page_cache
2010-12-22 15:32 ` [PATCH 2/7] fuse: Change remove_from_page_cache Minchan Kim
@ 2011-01-08 22:22 ` Johannes Weiner
0 siblings, 0 replies; 17+ messages in thread
From: Johannes Weiner @ 2011-01-08 22:22 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki, Miklos Szeredi,
fuse-devel
On Thu, Dec 23, 2010 at 12:32:44AM +0900, Minchan Kim wrote:
> This patch series changes remove_from_page_cache's page ref counting
> rule. Page cache ref count is decreased in delete_from_page_cache.
> So we don't need decreasing page reference by caller.
>
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> Cc: fuse-devel@lists.sourceforge.net
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 3/7] tlbfs: Change remove_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
2010-12-22 15:32 ` [PATCH 1/7] Introduce delete_from_page_cache Minchan Kim
2010-12-22 15:32 ` [PATCH 2/7] fuse: Change remove_from_page_cache Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2011-01-08 22:25 ` Johannes Weiner
2010-12-22 15:32 ` [PATCH 4/7] swap: " Minchan Kim
` (5 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim, William Irwin
This patch series changes remove_from_page_cache's page ref counting
rule. Page cache ref count is decreased in delete_from_page_cache.
So we don't need decreasing page reference by caller.
Cc: William Irwin <wli@holomorphy.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
fs/hugetlbfs/inode.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 9885082..b9eeb1c 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -332,8 +332,7 @@ static void truncate_huge_page(struct page *page)
{
cancel_dirty_page(page, /* No IO accounting for huge pages? */0);
ClearPageUptodate(page);
- remove_from_page_cache(page);
- put_page(page);
+ delete_from_page_cache(page);
}
static void truncate_hugepages(struct inode *inode, loff_t lstart)
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 3/7] tlbfs: Change remove_from_page_cache
2010-12-22 15:32 ` [PATCH 3/7] tlbfs: " Minchan Kim
@ 2011-01-08 22:25 ` Johannes Weiner
0 siblings, 0 replies; 17+ messages in thread
From: Johannes Weiner @ 2011-01-08 22:25 UTC (permalink / raw)
To: Minchan Kim; +Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki
On Thu, Dec 23, 2010 at 12:32:45AM +0900, Minchan Kim wrote:
> This patch series changes remove_from_page_cache's page ref counting
> rule. Page cache ref count is decreased in delete_from_page_cache.
> So we don't need decreasing page reference by caller.
>
> Cc: William Irwin <wli@holomorphy.com>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
As Mel pointed out, that should be hugetlbfs in the subject.
Otherwise, the patch looks good.
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 4/7] swap: Change remove_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
` (2 preceding siblings ...)
2010-12-22 15:32 ` [PATCH 3/7] tlbfs: " Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2011-01-08 22:28 ` Johannes Weiner
2010-12-22 15:32 ` [PATCH 5/7] truncate: " Minchan Kim
` (4 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim
This patch series changes remove_from_page_cache's page ref counting
rule. Page cache ref count is decreased in delete_from_page_cache.
So we don't need decreasing page reference by caller.
Cc:Hugh Dickins <hughd@google.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
mm/shmem.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index fa9acc9..079cced 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1081,7 +1081,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
shmem_recalc_inode(inode);
if (swap.val && add_to_swap_cache(page, swap, GFP_ATOMIC) == 0) {
- remove_from_page_cache(page);
+ delete_from_page_cache(page);
shmem_swp_set(info, entry, swap.val);
shmem_swp_unmap(entry);
if (list_empty(&info->swaplist))
@@ -1091,7 +1091,6 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
spin_unlock(&info->lock);
swap_shmem_alloc(swap);
BUG_ON(page_mapped(page));
- page_cache_release(page); /* pagecache ref */
swap_writepage(page, wbc);
if (inode) {
mutex_lock(&shmem_swaplist_mutex);
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 4/7] swap: Change remove_from_page_cache
2010-12-22 15:32 ` [PATCH 4/7] swap: " Minchan Kim
@ 2011-01-08 22:28 ` Johannes Weiner
2011-01-10 15:45 ` Minchan Kim
0 siblings, 1 reply; 17+ messages in thread
From: Johannes Weiner @ 2011-01-08 22:28 UTC (permalink / raw)
To: Minchan Kim; +Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki
On Thu, Dec 23, 2010 at 12:32:46AM +0900, Minchan Kim wrote:
> This patch series changes remove_from_page_cache's page ref counting
> rule. Page cache ref count is decreased in delete_from_page_cache.
> So we don't need decreasing page reference by caller.
>
> Cc:Hugh Dickins <hughd@google.com>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> mm/shmem.c | 3 +--
Patch subject should probably say 'shmem' instead of 'swap'.
Otherwise,
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/7] swap: Change remove_from_page_cache
2011-01-08 22:28 ` Johannes Weiner
@ 2011-01-10 15:45 ` Minchan Kim
0 siblings, 0 replies; 17+ messages in thread
From: Minchan Kim @ 2011-01-10 15:45 UTC (permalink / raw)
To: Johannes Weiner; +Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki
On Sun, Jan 9, 2011 at 7:28 AM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> On Thu, Dec 23, 2010 at 12:32:46AM +0900, Minchan Kim wrote:
>> This patch series changes remove_from_page_cache's page ref counting
>> rule. Page cache ref count is decreased in delete_from_page_cache.
>> So we don't need decreasing page reference by caller.
>>
>> Cc:Hugh Dickins <hughd@google.com>
>> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
>> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>> ---
>> mm/shmem.c | 3 +--
>
> Patch subject should probably say 'shmem' instead of 'swap'.
Thanks, Hannes.
Will fix.
>
> Otherwise,
> Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
>
--
Kind regards,
Minchan Kim
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 5/7] truncate: Change remove_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
` (3 preceding siblings ...)
2010-12-22 15:32 ` [PATCH 4/7] swap: " Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2011-01-08 22:33 ` Johannes Weiner
2010-12-22 15:32 ` [PATCH 6/7] Good bye remove_from_page_cache Minchan Kim
` (3 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim, Dan Magenheimer,
Andi Kleen, Nick Piggin, Al Viro
This patch series changes remove_from_page_cache's page ref counting
rule. Page cache ref count is decreased in delete_from_page_cache.
So we don't need decreasing page reference by caller.
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-mm@kvack.org
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
mm/truncate.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/mm/truncate.c b/mm/truncate.c
index 9ee5673..3adb9c0 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -108,13 +108,12 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
cancel_dirty_page(page, PAGE_CACHE_SIZE);
clear_page_mlock(page);
- remove_from_page_cache(page);
+ delete_from_page_cache(page);
ClearPageMappedToDisk(page);
/* this must be after the remove_from_page_cache which
* calls cleancache_put_page (and note page->mapping is now NULL)
*/
cleancache_flush_page(mapping, page);
- page_cache_release(page); /* pagecache ref */
return 0;
}
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 5/7] truncate: Change remove_from_page_cache
2010-12-22 15:32 ` [PATCH 5/7] truncate: " Minchan Kim
@ 2011-01-08 22:33 ` Johannes Weiner
0 siblings, 0 replies; 17+ messages in thread
From: Johannes Weiner @ 2011-01-08 22:33 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki, Dan Magenheimer,
Andi Kleen, Nick Piggin, Al Viro
On Thu, Dec 23, 2010 at 12:32:47AM +0900, Minchan Kim wrote:
> This patch series changes remove_from_page_cache's page ref counting
> rule. Page cache ref count is decreased in delete_from_page_cache.
> So we don't need decreasing page reference by caller.
>
> Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
> Cc: Andi Kleen <andi@firstfloor.org>
> Cc: Nick Piggin <npiggin@kernel.dk>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: linux-mm@kvack.org
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 6/7] Good bye remove_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
` (4 preceding siblings ...)
2010-12-22 15:32 ` [PATCH 5/7] truncate: " Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2011-01-08 22:35 ` Johannes Weiner
2010-12-22 15:32 ` [PATCH 7/7] Change __remove_from_page_cache Minchan Kim
` (2 subsequent siblings)
8 siblings, 1 reply; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim, Christoph Hellwig,
Hugh Dickins
Now delete_from_page_cache replaces remove_from_page_cache.
So we remove remove_from_page_cache so fs or something out of
mainline will notice it when compile time and can fix it.
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
include/linux/pagemap.h | 1 -
mm/filemap.c | 27 +++++++++++----------------
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 7a1cb49..7bf6587 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -455,7 +455,6 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
-extern void remove_from_page_cache(struct page *page);
extern void __remove_from_page_cache(struct page *page);
extern void delete_from_page_cache(struct page *page);
diff --git a/mm/filemap.c b/mm/filemap.c
index 1ca7475..a4c43f7 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -148,7 +148,17 @@ void __remove_from_page_cache(struct page *page)
}
}
-void remove_from_page_cache(struct page *page)
+/**
+ * delete_from_page_cache - delete page from page cache
+ *
+ * @page: the page which the kernel is trying to remove from page cache
+ *
+ * This must be called only on pages that have
+ * been verified to be in the page cache and locked.
+ * It will never put the page into the free list,
+ * the caller has a reference on the page.
+ */
+void delete_from_page_cache(struct page *page)
{
struct address_space *mapping = page->mapping;
void (*freepage)(struct page *);
@@ -163,22 +173,7 @@ void remove_from_page_cache(struct page *page)
if (freepage)
freepage(page);
-}
-EXPORT_SYMBOL(remove_from_page_cache);
-/**
- * delete_from_page_cache - delete page from page cache
- *
- * @page: the page which the kernel is trying to remove from page cache
- *
- * This must be called only on pages that have
- * been verified to be in the page cache and locked.
- * It will never put the page into the free list,
- * the caller has a reference on the page.
- */
-void delete_from_page_cache(struct page *page)
-{
- remove_from_page_cache(page);
page_cache_release(page);
}
EXPORT_SYMBOL(delete_from_page_cache);
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 6/7] Good bye remove_from_page_cache
2010-12-22 15:32 ` [PATCH 6/7] Good bye remove_from_page_cache Minchan Kim
@ 2011-01-08 22:35 ` Johannes Weiner
0 siblings, 0 replies; 17+ messages in thread
From: Johannes Weiner @ 2011-01-08 22:35 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki,
Christoph Hellwig, Hugh Dickins
On Thu, Dec 23, 2010 at 12:32:48AM +0900, Minchan Kim wrote:
> Now delete_from_page_cache replaces remove_from_page_cache.
> So we remove remove_from_page_cache so fs or something out of
> mainline will notice it when compile time and can fix it.
>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Hugh Dickins <hughd@google.com>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 7/7] Change __remove_from_page_cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
` (5 preceding siblings ...)
2010-12-22 15:32 ` [PATCH 6/7] Good bye remove_from_page_cache Minchan Kim
@ 2010-12-22 15:32 ` Minchan Kim
2011-01-08 22:36 ` Johannes Weiner
2010-12-30 3:17 ` [PATCH 0/7] Change page reference handling semantic of page cache Hugh Dickins
2011-01-06 10:31 ` Mel Gorman
8 siblings, 1 reply; 17+ messages in thread
From: Minchan Kim @ 2010-12-22 15:32 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-mm, LKML, KAMEZAWA Hiroyuki, Minchan Kim, Christoph Hellwig,
Hugh Dickins
Now we renamed remove_from_page_cache with delete_from_page_cache.
As consistency of __remove_from_swap_cache and remove_from_swap_cache,
We change internal page cache handling function name, too.
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
include/linux/pagemap.h | 2 +-
mm/filemap.c | 6 +++---
mm/truncate.c | 2 +-
mm/vmscan.c | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 7bf6587..b5b21d8 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -455,7 +455,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
-extern void __remove_from_page_cache(struct page *page);
+extern void __delete_from_page_cache(struct page *page);
extern void delete_from_page_cache(struct page *page);
/*
diff --git a/mm/filemap.c b/mm/filemap.c
index a4c43f7..9776166 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -109,11 +109,11 @@
*/
/*
- * Remove a page from the page cache and free it. Caller has to make
+ * Delete a page from the page cache and free it. Caller has to make
* sure the page is locked and that nobody else uses it - or that usage
* is safe. The caller must hold the mapping's tree_lock.
*/
-void __remove_from_page_cache(struct page *page)
+void __delete_from_page_cache(struct page *page)
{
struct address_space *mapping = page->mapping;
@@ -167,7 +167,7 @@ void delete_from_page_cache(struct page *page)
freepage = mapping->a_ops->freepage;
spin_lock_irq(&mapping->tree_lock);
- __remove_from_page_cache(page);
+ __delete_from_page_cache(page);
spin_unlock_irq(&mapping->tree_lock);
mem_cgroup_uncharge_cache_page(page);
diff --git a/mm/truncate.c b/mm/truncate.c
index 3adb9c0..687429a 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -402,7 +402,7 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
clear_page_mlock(page);
BUG_ON(page_has_private(page));
- __remove_from_page_cache(page);
+ __delete_from_page_cache(page);
spin_unlock_irq(&mapping->tree_lock);
mem_cgroup_uncharge_cache_page(page);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 47a5096..bdb867f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -515,7 +515,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page)
freepage = mapping->a_ops->freepage;
- __remove_from_page_cache(page);
+ __delete_from_page_cache(page);
spin_unlock_irq(&mapping->tree_lock);
mem_cgroup_uncharge_cache_page(page);
--
1.7.0.4
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 7/7] Change __remove_from_page_cache
2010-12-22 15:32 ` [PATCH 7/7] Change __remove_from_page_cache Minchan Kim
@ 2011-01-08 22:36 ` Johannes Weiner
0 siblings, 0 replies; 17+ messages in thread
From: Johannes Weiner @ 2011-01-08 22:36 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki,
Christoph Hellwig, Hugh Dickins
On Thu, Dec 23, 2010 at 12:32:49AM +0900, Minchan Kim wrote:
> Now we renamed remove_from_page_cache with delete_from_page_cache.
> As consistency of __remove_from_swap_cache and remove_from_swap_cache,
> We change internal page cache handling function name, too.
>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Hugh Dickins <hughd@google.com>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/7] Change page reference handling semantic of page cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
` (6 preceding siblings ...)
2010-12-22 15:32 ` [PATCH 7/7] Change __remove_from_page_cache Minchan Kim
@ 2010-12-30 3:17 ` Hugh Dickins
2011-01-06 10:31 ` Mel Gorman
8 siblings, 0 replies; 17+ messages in thread
From: Hugh Dickins @ 2010-12-30 3:17 UTC (permalink / raw)
To: Minchan Kim; +Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki
On Thu, 23 Dec 2010, Minchan Kim wrote:
> Now we increases page reference on add_to_page_cache but doesn't decrease it
> in remove_from_page_cache. Such asymmetric makes confusing about
> page reference so that caller should notice it and comment why they
> release page reference. It's not good API.
>
> Long time ago, Hugh tried it[1] but gave up of reason which
> reiser4's drop_page had to unlock the page between removing it from
> page cache and doing the page_cache_release. But now the situation is
> changed. I think at least things in current mainline doesn't have any
> obstacles. The problem is fs or somethings out of mainline.
> If it has done such thing like reiser4, this patch could be a problem but
> they found it when compile time since we remove remove_from_page_cache.
>
> [1] http://lkml.org/lkml/2004/10/24/140
>
> The series configuration is following as.
>
> [1/7] : This patch introduces new API delete_from_page_cache.
> [2,3,4,5/7] : Change remove_from_page_cache with delete_from_page_cache.
> Intentionally I divide patch per file since someone might have a concern
> about releasing page reference of delete_from_page_cache in
> somecase (ex, truncate.c)
> [6/7] : Remove old API so out of fs can meet compile error when build time
> and can notice it.
> [7/7] : Change __remove_from_page_cache with __delete_from_page_cache, too.
> In this time, I made all-in-one patch because it doesn't change old behavior
> so it has no concern. Just clean up patch.
>
> Minchan Kim (7):
> [1/7] Introduce delete_from_page_cache
> [2/7] fuse: Change remove_from_page_cache
> [3/7] tlbfs: Change remove_from_page_cache
> [4/7] swap: Change remove_from_page_cache
> [5/7] truncate: Change remove_from_page_cache
> [6/7] Good bye remove_from_page_cache
> [7/7] Change __remove_from_page_cache
>
> fs/fuse/dev.c | 3 +--
> fs/hugetlbfs/inode.c | 3 +--
> include/linux/pagemap.h | 4 ++--
> mm/filemap.c | 22 +++++++++++++++++-----
> mm/shmem.c | 3 +--
> mm/truncate.c | 5 ++---
> mm/vmscan.c | 2 +-
> 7 files changed, 25 insertions(+), 17 deletions(-)
Acked-by: Hugh Dickins <hughd@google.com>
for all seven: thanks.
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/7] Change page reference handling semantic of page cache
2010-12-22 15:32 [PATCH 0/7] Change page reference handling semantic of page cache Minchan Kim
` (7 preceding siblings ...)
2010-12-30 3:17 ` [PATCH 0/7] Change page reference handling semantic of page cache Hugh Dickins
@ 2011-01-06 10:31 ` Mel Gorman
8 siblings, 0 replies; 17+ messages in thread
From: Mel Gorman @ 2011-01-06 10:31 UTC (permalink / raw)
To: Minchan Kim; +Cc: Andrew Morton, linux-mm, LKML, KAMEZAWA Hiroyuki
On Thu, Dec 23, 2010 at 12:32:42AM +0900, Minchan Kim wrote:
> Now we increases page reference on add_to_page_cache but doesn't decrease it
> in remove_from_page_cache. Such asymmetric makes confusing about
> page reference so that caller should notice it and comment why they
> release page reference. It's not good API.
>
> Long time ago, Hugh tried it[1] but gave up of reason which
> reiser4's drop_page had to unlock the page between removing it from
> page cache and doing the page_cache_release. But now the situation is
> changed. I think at least things in current mainline doesn't have any
> obstacles. The problem is fs or somethings out of mainline.
> If it has done such thing like reiser4, this patch could be a problem but
> they found it when compile time since we remove remove_from_page_cache.
>
> [1] http://lkml.org/lkml/2004/10/24/140
>
> The series configuration is following as.
>
> [1/7] : This patch introduces new API delete_from_page_cache.
> [2,3,4,5/7] : Change remove_from_page_cache with delete_from_page_cache.
> Intentionally I divide patch per file since someone might have a concern
> about releasing page reference of delete_from_page_cache in
> somecase (ex, truncate.c)
> [6/7] : Remove old API so out of fs can meet compile error when build time
> and can notice it.
> [7/7] : Change __remove_from_page_cache with __delete_from_page_cache, too.
> In this time, I made all-in-one patch because it doesn't change old behavior
> so it has no concern. Just clean up patch.
>
Other than hugetlbfs being called tlbfs in patch 3/7;
Acked-by: Mel Gorman <mel@csn.ul.ie>
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread