All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Konstantin Khlebnikov <k.khlebnikov@samsung.com>,
	Rafael Aquini <aquini@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] mm: rename "migrate_page" to "generic_migrate_page"
Date: Sat, 30 Aug 2014 20:36:07 +0400	[thread overview]
Message-ID: <20140830163607.28934.36066.stgit@zurg> (raw)
In-Reply-To: <CALYGNiN9rHG-b1p-seR9NfDW-FKAxeQq6iUTdmr1PoQYEpr+qA@mail.gmail.com>

If CONFIG_MIGRATION=n "migrate_page" turns into NULL. This kills ifdef-endif
mess inside definitions of address space operations. But this macro affects
everything with this name, "migrate_page" is too short and generic.

This patch renames it into generic_migrate_page. Fortunately it's used only in
few places. Also here minor update for documentation: a_ops method is called
"migratepage", without underscore, obviously for keeping the macro away.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 Documentation/filesystems/vfs.txt |   13 ++++++++-----
 fs/btrfs/disk-io.c                |    2 +-
 fs/nfs/write.c                    |    2 +-
 include/linux/migrate.h           |    6 +++---
 mm/migrate.c                      |   10 +++++-----
 mm/shmem.c                        |    2 +-
 mm/swap_state.c                   |    2 +-
 7 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 02a766c..a633fa7 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -746,12 +746,15 @@ struct address_space_operations {
 	Filesystems that want to use execute-in-place (XIP) need to implement
 	it.  An example implementation can be found in fs/ext2/xip.c.
 
-  migrate_page:  This is used to compact the physical memory usage.
-        If the VM wants to relocate a page (maybe off a memory card
-        that is signalling imminent failure) it will pass a new page
-	and an old page to this function.  migrate_page should
+  migratepage:  This is used to compact the physical memory usage.
+	If the VM wants to relocate a page (maybe off a memory card
+	that is signalling imminent failure) it will pass a new page
+	and an old page to this function.  migratepage should
 	transfer any private data across and update any references
-        that it has to the page.
+	that it has to the page.
+
+	Filesystem might use here generic_migrate_page if pages have no
+	private data or buffer_migrate_page for pages with buffers.
 
   launder_page: Called before freeing a page - it writes back the dirty page. To
   	prevent redirtying the page, it is kept locked during the whole
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a1d36e6..af1a274 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -973,7 +973,7 @@ static int btree_migratepage(struct address_space *mapping,
 	if (page_has_private(page) &&
 	    !try_to_release_page(page, GFP_KERNEL))
 		return -EAGAIN;
-	return migrate_page(mapping, newpage, page, mode);
+	return generic_migrate_page(mapping, newpage, page, mode);
 }
 #endif
 
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 175d5d0..7101a6d 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1898,7 +1898,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
 	if (!nfs_fscache_release_page(page, GFP_KERNEL))
 		return -EBUSY;
 
-	return migrate_page(mapping, newpage, page, mode);
+	return generic_migrate_page(mapping, newpage, page, mode);
 }
 #endif
 
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a2901c4..0a4604a 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -38,7 +38,7 @@ enum migrate_reason {
 #ifdef CONFIG_MIGRATION
 
 extern void putback_movable_pages(struct list_head *l);
-extern int migrate_page(struct address_space *,
+extern int generic_migrate_page(struct address_space *,
 			struct page *, struct page *, enum migrate_mode);
 extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
 		unsigned long private, enum migrate_mode mode, int reason);
@@ -82,8 +82,8 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 	return -ENOSYS;
 }
 
-/* Possible settings for the migrate_page() method in address_operations */
-#define migrate_page NULL
+/* Possible settings for the migratepage() method in address_operations */
+#define generic_migrate_page	NULL
 
 #endif /* CONFIG_MIGRATION */
 
diff --git a/mm/migrate.c b/mm/migrate.c
index f78ec9b..905b1aa 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -588,7 +588,7 @@ void migrate_page_copy(struct page *newpage, struct page *page)
  *
  * Pages are locked upon entry and exit.
  */
-int migrate_page(struct address_space *mapping,
+int generic_migrate_page(struct address_space *mapping,
 		struct page *newpage, struct page *page,
 		enum migrate_mode mode)
 {
@@ -604,7 +604,7 @@ int migrate_page(struct address_space *mapping,
 	migrate_page_copy(newpage, page);
 	return MIGRATEPAGE_SUCCESS;
 }
-EXPORT_SYMBOL(migrate_page);
+EXPORT_SYMBOL(generic_migrate_page);
 
 #ifdef CONFIG_BLOCK
 /*
@@ -619,7 +619,7 @@ int buffer_migrate_page(struct address_space *mapping,
 	int rc;
 
 	if (!page_has_buffers(page))
-		return migrate_page(mapping, newpage, page, mode);
+		return generic_migrate_page(mapping, newpage, page, mode);
 
 	head = page_buffers(page);
 
@@ -728,7 +728,7 @@ static int fallback_migrate_page(struct address_space *mapping,
 	    !try_to_release_page(page, GFP_KERNEL))
 		return -EAGAIN;
 
-	return migrate_page(mapping, newpage, page, mode);
+	return generic_migrate_page(mapping, newpage, page, mode);
 }
 
 /*
@@ -764,7 +764,7 @@ static int move_to_new_page(struct page *newpage, struct page *page,
 
 	mapping = page_mapping(page);
 	if (!mapping)
-		rc = migrate_page(mapping, newpage, page, mode);
+		rc = generic_migrate_page(mapping, newpage, page, mode);
 	else if (mapping->a_ops->migratepage)
 		/*
 		 * Most pages have a mapping and most filesystems provide a
diff --git a/mm/shmem.c b/mm/shmem.c
index 0e5fb22..2e0058e 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3075,7 +3075,7 @@ static const struct address_space_operations shmem_aops = {
 	.write_begin	= shmem_write_begin,
 	.write_end	= shmem_write_end,
 #endif
-	.migratepage	= migrate_page,
+	.migratepage	= generic_migrate_page,
 	.error_remove_page = generic_error_remove_page,
 };
 
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 3e0ec83..0ac57c4 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -28,7 +28,7 @@
 static const struct address_space_operations swap_aops = {
 	.writepage	= swap_writepage,
 	.set_page_dirty	= swap_set_page_dirty,
-	.migratepage	= migrate_page,
+	.migratepage	= generic_migrate_page,
 };
 
 static struct backing_dev_info swap_backing_dev_info = {

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Konstantin Khlebnikov <k.khlebnikov@samsung.com>,
	Rafael Aquini <aquini@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: [PATCH] mm: rename "migrate_page" to "generic_migrate_page"
Date: Sat, 30 Aug 2014 20:36:07 +0400	[thread overview]
Message-ID: <20140830163607.28934.36066.stgit@zurg> (raw)
In-Reply-To: <CALYGNiN9rHG-b1p-seR9NfDW-FKAxeQq6iUTdmr1PoQYEpr+qA@mail.gmail.com>

If CONFIG_MIGRATION=n "migrate_page" turns into NULL. This kills ifdef-endif
mess inside definitions of address space operations. But this macro affects
everything with this name, "migrate_page" is too short and generic.

This patch renames it into generic_migrate_page. Fortunately it's used only in
few places. Also here minor update for documentation: a_ops method is called
"migratepage", without underscore, obviously for keeping the macro away.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 Documentation/filesystems/vfs.txt |   13 ++++++++-----
 fs/btrfs/disk-io.c                |    2 +-
 fs/nfs/write.c                    |    2 +-
 include/linux/migrate.h           |    6 +++---
 mm/migrate.c                      |   10 +++++-----
 mm/shmem.c                        |    2 +-
 mm/swap_state.c                   |    2 +-
 7 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 02a766c..a633fa7 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -746,12 +746,15 @@ struct address_space_operations {
 	Filesystems that want to use execute-in-place (XIP) need to implement
 	it.  An example implementation can be found in fs/ext2/xip.c.
 
-  migrate_page:  This is used to compact the physical memory usage.
-        If the VM wants to relocate a page (maybe off a memory card
-        that is signalling imminent failure) it will pass a new page
-	and an old page to this function.  migrate_page should
+  migratepage:  This is used to compact the physical memory usage.
+	If the VM wants to relocate a page (maybe off a memory card
+	that is signalling imminent failure) it will pass a new page
+	and an old page to this function.  migratepage should
 	transfer any private data across and update any references
-        that it has to the page.
+	that it has to the page.
+
+	Filesystem might use here generic_migrate_page if pages have no
+	private data or buffer_migrate_page for pages with buffers.
 
   launder_page: Called before freeing a page - it writes back the dirty page. To
   	prevent redirtying the page, it is kept locked during the whole
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a1d36e6..af1a274 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -973,7 +973,7 @@ static int btree_migratepage(struct address_space *mapping,
 	if (page_has_private(page) &&
 	    !try_to_release_page(page, GFP_KERNEL))
 		return -EAGAIN;
-	return migrate_page(mapping, newpage, page, mode);
+	return generic_migrate_page(mapping, newpage, page, mode);
 }
 #endif
 
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 175d5d0..7101a6d 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1898,7 +1898,7 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
 	if (!nfs_fscache_release_page(page, GFP_KERNEL))
 		return -EBUSY;
 
-	return migrate_page(mapping, newpage, page, mode);
+	return generic_migrate_page(mapping, newpage, page, mode);
 }
 #endif
 
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index a2901c4..0a4604a 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -38,7 +38,7 @@ enum migrate_reason {
 #ifdef CONFIG_MIGRATION
 
 extern void putback_movable_pages(struct list_head *l);
-extern int migrate_page(struct address_space *,
+extern int generic_migrate_page(struct address_space *,
 			struct page *, struct page *, enum migrate_mode);
 extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
 		unsigned long private, enum migrate_mode mode, int reason);
@@ -82,8 +82,8 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 	return -ENOSYS;
 }
 
-/* Possible settings for the migrate_page() method in address_operations */
-#define migrate_page NULL
+/* Possible settings for the migratepage() method in address_operations */
+#define generic_migrate_page	NULL
 
 #endif /* CONFIG_MIGRATION */
 
diff --git a/mm/migrate.c b/mm/migrate.c
index f78ec9b..905b1aa 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -588,7 +588,7 @@ void migrate_page_copy(struct page *newpage, struct page *page)
  *
  * Pages are locked upon entry and exit.
  */
-int migrate_page(struct address_space *mapping,
+int generic_migrate_page(struct address_space *mapping,
 		struct page *newpage, struct page *page,
 		enum migrate_mode mode)
 {
@@ -604,7 +604,7 @@ int migrate_page(struct address_space *mapping,
 	migrate_page_copy(newpage, page);
 	return MIGRATEPAGE_SUCCESS;
 }
-EXPORT_SYMBOL(migrate_page);
+EXPORT_SYMBOL(generic_migrate_page);
 
 #ifdef CONFIG_BLOCK
 /*
@@ -619,7 +619,7 @@ int buffer_migrate_page(struct address_space *mapping,
 	int rc;
 
 	if (!page_has_buffers(page))
-		return migrate_page(mapping, newpage, page, mode);
+		return generic_migrate_page(mapping, newpage, page, mode);
 
 	head = page_buffers(page);
 
@@ -728,7 +728,7 @@ static int fallback_migrate_page(struct address_space *mapping,
 	    !try_to_release_page(page, GFP_KERNEL))
 		return -EAGAIN;
 
-	return migrate_page(mapping, newpage, page, mode);
+	return generic_migrate_page(mapping, newpage, page, mode);
 }
 
 /*
@@ -764,7 +764,7 @@ static int move_to_new_page(struct page *newpage, struct page *page,
 
 	mapping = page_mapping(page);
 	if (!mapping)
-		rc = migrate_page(mapping, newpage, page, mode);
+		rc = generic_migrate_page(mapping, newpage, page, mode);
 	else if (mapping->a_ops->migratepage)
 		/*
 		 * Most pages have a mapping and most filesystems provide a
diff --git a/mm/shmem.c b/mm/shmem.c
index 0e5fb22..2e0058e 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3075,7 +3075,7 @@ static const struct address_space_operations shmem_aops = {
 	.write_begin	= shmem_write_begin,
 	.write_end	= shmem_write_end,
 #endif
-	.migratepage	= migrate_page,
+	.migratepage	= generic_migrate_page,
 	.error_remove_page = generic_error_remove_page,
 };
 
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 3e0ec83..0ac57c4 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -28,7 +28,7 @@
 static const struct address_space_operations swap_aops = {
 	.writepage	= swap_writepage,
 	.set_page_dirty	= swap_set_page_dirty,
-	.migratepage	= migrate_page,
+	.migratepage	= generic_migrate_page,
 };
 
 static struct backing_dev_info swap_backing_dev_info = {


  reply	other threads:[~2014-08-30 16:36 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 15:04 [PATCH 1/7] mm/balloon_compaction: ignore anonymous pages Konstantin Khlebnikov
2014-08-20 15:04 ` Konstantin Khlebnikov
2014-08-20 15:04 ` [PATCH 2/7] mm/balloon_compaction: keep ballooned pages away from normal migration path Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 23:33   ` Rafael Aquini
2014-08-20 23:33     ` Rafael Aquini
2014-08-20 15:04 ` [PATCH 3/7] mm/balloon_compaction: isolate balloon pages without lru_lock Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 23:35   ` Rafael Aquini
2014-08-20 23:35     ` Rafael Aquini
2014-08-20 15:04 ` [PATCH 4/7] selftests/vm/transhuge-stress: stress test for memory compaction Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 15:04 ` [PATCH 5/7] mm: introduce common page state for ballooned memory Konstantin Khlebnikov
2014-08-20 15:04   ` Konstantin Khlebnikov
2014-08-20 23:46   ` Rafael Aquini
2014-08-20 23:46     ` Rafael Aquini
2014-08-20 15:05 ` [PATCH 6/7] mm/balloon_compaction: use common page ballooning Konstantin Khlebnikov
2014-08-20 15:05   ` Konstantin Khlebnikov
2014-08-20 23:48   ` Rafael Aquini
2014-08-20 23:48     ` Rafael Aquini
2014-08-20 15:05 ` [PATCH 7/7] mm/balloon_compaction: general cleanup Konstantin Khlebnikov
2014-08-20 15:05   ` Konstantin Khlebnikov
     [not found]   ` <5ad4664811559496e563ead974f10e8ee6b4ed47.1408576903.git.aquini@redhat.com>
2014-08-20 23:58     ` Rafael Aquini
2014-08-20 23:58       ` Rafael Aquini
2014-08-21  7:30       ` Konstantin Khlebnikov
2014-08-21  7:30         ` Konstantin Khlebnikov
2014-08-21 12:31         ` Rafael Aquini
2014-08-21 12:31           ` Rafael Aquini
2014-08-29 21:05   ` Andrew Morton
2014-08-29 21:05     ` Andrew Morton
2014-08-29 21:09     ` Rafael Aquini
2014-08-29 21:09       ` Rafael Aquini
2014-08-29 21:26       ` Rafael Aquini
2014-08-29 21:26         ` Rafael Aquini
2014-08-29 21:38   ` Andrew Morton
2014-08-29 21:38     ` Andrew Morton
2014-08-30  6:44     ` Konstantin Khlebnikov
2014-08-30  6:44       ` Konstantin Khlebnikov
2014-08-30 16:36       ` Konstantin Khlebnikov [this message]
2014-08-30 16:36         ` [PATCH] mm: rename "migrate_page" to "generic_migrate_page" Konstantin Khlebnikov
2014-08-20 23:32 ` [PATCH 1/7] mm/balloon_compaction: ignore anonymous pages Rafael Aquini
2014-08-20 23:32   ` Rafael Aquini

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=20140830163607.28934.36066.stgit@zurg \
    --to=koct9i@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aquini@redhat.com \
    --cc=k.khlebnikov@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryabinin.a.a@gmail.com \
    --cc=sasha.levin@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.