From: Zi Yan <zi.yan@sent.com>
To: linux-mm@kvack.org
Cc: dnellans@nvidia.com, apopple@au1.ibm.com,
paulmck@linux.vnet.ibm.com, khandual@linux.vnet.ibm.com,
zi.yan@cs.rutgers.edu
Subject: [RFC PATCH 13/14] mm: migrate: Add copy_page_dma into migrate_page_copy.
Date: Fri, 17 Feb 2017 10:05:50 -0500 [thread overview]
Message-ID: <20170217150551.117028-14-zi.yan@sent.com> (raw)
In-Reply-To: <20170217150551.117028-1-zi.yan@sent.com>
From: Zi Yan <ziy@nvidia.com>
Fallback to copy_highpage when it fails.
Signed-off-by: Zi Yan <ziy@nvidia.com>
---
include/linux/migrate_mode.h | 1 +
include/uapi/linux/mempolicy.h | 1 +
mm/migrate.c | 27 +++++++++++++++++++--------
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
index 2bd849d89122..798737d0a0bc 100644
--- a/include/linux/migrate_mode.h
+++ b/include/linux/migrate_mode.h
@@ -14,6 +14,7 @@ enum migrate_mode {
MIGRATE_ST = 1<<3,
MIGRATE_MT = 1<<4,
MIGRATE_CONCUR = 1<<5,
+ MIGRATE_DMA = 1<<6,
};
#endif /* MIGRATE_MODE_H_INCLUDED */
diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
index 6d9758a32053..bf40534cc93a 100644
--- a/include/uapi/linux/mempolicy.h
+++ b/include/uapi/linux/mempolicy.h
@@ -55,6 +55,7 @@ enum mpol_rebind_step {
#define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */
#define MPOL_MF_MOVE_MT (1<<6) /* Use multi-threaded page copy routine */
#define MPOL_MF_MOVE_CONCUR (1<<7) /* Migrate a list of pages concurrently */
+#define MPOL_MF_MOVE_DMA (1<<8) /* Use DMA based page copy routine */
#define MPOL_MF_VALID (MPOL_MF_STRICT | \
MPOL_MF_MOVE | \
diff --git a/mm/migrate.c b/mm/migrate.c
index a35e6fd43a50..464bc9ba8083 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -634,6 +634,9 @@ static void copy_huge_page(struct page *dst, struct page *src,
if (mode & MIGRATE_MT)
rc = copy_pages_mthread(dst, src, nr_pages);
+ if (rc && (mode & MIGRATE_DMA))
+ rc = copy_page_dma(dst, src, nr_pages);
+
if (rc)
for (i = 0; i < nr_pages; i++) {
cond_resched();
@@ -648,16 +651,18 @@ void migrate_page_copy(struct page *newpage, struct page *page,
enum migrate_mode mode)
{
int cpupid;
+ int rc = -EFAULT;
if (PageHuge(page) || PageTransHuge(page)) {
copy_huge_page(newpage, page, mode);
} else {
- if (mode & MIGRATE_MT) {
- if (copy_pages_mthread(newpage, page, 1))
- copy_highpage(newpage, page);
- } else {
+ if (mode & MIGRATE_DMA)
+ rc = copy_page_dma(newpage, page, 1);
+ else if (mode & MIGRATE_MT)
+ rc = copy_pages_mthread(newpage, page, 1);
+
+ if (rc)
copy_highpage(newpage, page);
- }
}
if (PageError(page))
@@ -1926,7 +1931,8 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
struct page_to_node *pm,
int migrate_all,
int migrate_use_mt,
- int migrate_concur)
+ int migrate_concur,
+ int migrate_use_dma)
{
int err;
struct page_to_node *pp;
@@ -1936,6 +1942,9 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
if (migrate_use_mt)
mode |= MIGRATE_MT;
+ if (migrate_use_dma)
+ mode |= MIGRATE_DMA;
+
down_read(&mm->mmap_sem);
/*
@@ -2098,7 +2107,8 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
err = do_move_page_to_node_array(mm, pm,
flags & MPOL_MF_MOVE_ALL,
flags & MPOL_MF_MOVE_MT,
- flags & MPOL_MF_MOVE_CONCUR);
+ flags & MPOL_MF_MOVE_CONCUR,
+ flags & MPOL_MF_MOVE_DMA);
if (err < 0)
goto out_pm;
@@ -2207,7 +2217,8 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
/* Check flags */
if (flags & ~(MPOL_MF_MOVE|MPOL_MF_MOVE_ALL|
MPOL_MF_MOVE_MT|
- MPOL_MF_MOVE_CONCUR))
+ MPOL_MF_MOVE_CONCUR|
+ MPOL_MF_MOVE_DMA))
return -EINVAL;
if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE))
--
2.11.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>
next prev parent reply other threads:[~2017-02-17 15:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 15:05 [RFC PATCH 00/14] Accelerating page migrations Zi Yan
2017-02-17 15:05 ` [RFC PATCH 01/14] mm/migrate: Add new mode parameter to migrate_page_copy() function Zi Yan
2017-02-17 15:05 ` [RFC PATCH 02/14] mm/migrate: Make migrate_mode types non-exclussive Zi Yan
2017-02-17 15:05 ` [RFC PATCH 03/14] mm/migrate: Add copy_pages_mthread function Zi Yan
2017-02-23 6:06 ` Naoya Horiguchi
2017-02-23 7:50 ` Anshuman Khandual
2017-02-23 8:02 ` Naoya Horiguchi
2017-03-09 5:35 ` Anshuman Khandual
2017-02-17 15:05 ` [RFC PATCH 04/14] mm/migrate: Add new migrate mode MIGRATE_MT Zi Yan
2017-02-23 6:54 ` Naoya Horiguchi
2017-02-23 7:54 ` Anshuman Khandual
2017-02-17 15:05 ` [RFC PATCH 05/14] mm/migrate: Add new migration flag MPOL_MF_MOVE_MT for syscalls Zi Yan
2017-02-17 15:05 ` [RFC PATCH 06/14] sysctl: Add global tunable mt_page_copy Zi Yan
2017-02-17 15:05 ` [RFC PATCH 07/14] migrate: Add copy_page_lists_mthread() function Zi Yan
2017-02-23 8:54 ` Naoya Horiguchi
2017-03-09 13:02 ` Anshuman Khandual
2017-02-17 15:05 ` [RFC PATCH 08/14] mm: migrate: Add concurrent page migration into move_pages syscall Zi Yan
2017-02-24 8:25 ` Naoya Horiguchi
2017-02-24 15:05 ` Zi Yan
2017-02-17 15:05 ` [RFC PATCH 09/14] mm: migrate: Add exchange_page_mthread() and exchange_page_lists_mthread() to exchange two pages or two page lists Zi Yan
2017-02-17 15:05 ` [RFC PATCH 10/14] mm: Add exchange_pages and exchange_pages_concur functions to exchange two lists of pages instead of two migrate_pages() Zi Yan
2017-02-17 15:05 ` [RFC PATCH 11/14] mm: migrate: Add exchange_pages syscall to exchange two page lists Zi Yan
2017-02-17 15:05 ` [RFC PATCH 12/14] migrate: Add copy_page_dma to use DMA Engine to copy pages Zi Yan
2017-02-17 15:05 ` Zi Yan [this message]
2017-02-17 15:05 ` [RFC PATCH 14/14] mm: Add copy_page_lists_dma_always to support copy a list of pages Zi Yan
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=20170217150551.117028-14-zi.yan@sent.com \
--to=zi.yan@sent.com \
--cc=apopple@au1.ibm.com \
--cc=dnellans@nvidia.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-mm@kvack.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=zi.yan@cs.rutgers.edu \
/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