diff options
| author | Mel Gorman <mgorman@suse.de> | 2012-01-12 20:19:43 -0500 |
|---|---|---|
| committer | Luis Henriques <luis.henriques@canonical.com> | 2012-08-13 09:10:28 -0400 |
| commit | e41341d698d5c2901e49fff92a90e02b803d2394 (patch) | |
| tree | cfeaa4983c38cdd005d0eba0b891c303f474fed7 /include | |
| parent | aa9381fc018f63b6fd4a0c79f6ee7ce7288b3c8b (diff) | |
mm: compaction: introduce sync-light migration for use by compaction
BugLink: http://bugs.launchpad.net/bugs/1031926
commit a6bc32b899223a877f595ef9ddc1e89ead5072b8 upstream.
Stable note: Not tracked in Buzilla. This was part of a series that
reduced interactivity stalls experienced when THP was enabled.
These stalls were particularly noticable when copying data
to a USB stick but the experiences for users varied a lot.
This patch adds a lightweight sync migrate operation MIGRATE_SYNC_LIGHT
mode that avoids writing back pages to backing storage. Async compaction
maps to MIGRATE_ASYNC while sync compaction maps to MIGRATE_SYNC_LIGHT.
For other migrate_pages users such as memory hotplug, MIGRATE_SYNC is
used.
This avoids sync compaction stalling for an excessive length of time,
particularly when copying files to a USB stick where there might be a
large number of dirty pages backed by a filesystem that does not support
->writepages.
[aarcange@redhat.com: This patch is heavily based on Andrea's work]
[akpm@linux-foundation.org: fix fs/nfs/write.c build]
[akpm@linux-foundation.org: fix fs/btrfs/disk-io.c build]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Andy Isaacson <adi@hexapodia.org>
Cc: Nai Xia <nai.xia@gmail.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/fs.h | 6 | ||||
| -rw-r--r-- | include/linux/migrate.h | 23 |
2 files changed, 22 insertions, 7 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 49e075c89b6..d5447ab1faf 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -529,6 +529,7 @@ enum positive_aop_returns { | |||
| 529 | struct page; | 529 | struct page; |
| 530 | struct address_space; | 530 | struct address_space; |
| 531 | struct writeback_control; | 531 | struct writeback_control; |
| 532 | enum migrate_mode; | ||
| 532 | 533 | ||
| 533 | struct iov_iter { | 534 | struct iov_iter { |
| 534 | const struct iovec *iov; | 535 | const struct iovec *iov; |
| @@ -618,7 +619,7 @@ struct address_space_operations { | |||
| 618 | * is false, it must not block. | 619 | * is false, it must not block. |
| 619 | */ | 620 | */ |
| 620 | int (*migratepage) (struct address_space *, | 621 | int (*migratepage) (struct address_space *, |
| 621 | struct page *, struct page *, bool); | 622 | struct page *, struct page *, enum migrate_mode); |
| 622 | int (*launder_page) (struct page *); | 623 | int (*launder_page) (struct page *); |
| 623 | int (*is_partially_uptodate) (struct page *, read_descriptor_t *, | 624 | int (*is_partially_uptodate) (struct page *, read_descriptor_t *, |
| 624 | unsigned long); | 625 | unsigned long); |
| @@ -2494,7 +2495,8 @@ extern int generic_check_addressable(unsigned, u64); | |||
| 2494 | 2495 | ||
| 2495 | #ifdef CONFIG_MIGRATION | 2496 | #ifdef CONFIG_MIGRATION |
| 2496 | extern int buffer_migrate_page(struct address_space *, | 2497 | extern int buffer_migrate_page(struct address_space *, |
| 2497 | struct page *, struct page *, bool); | 2498 | struct page *, struct page *, |
| 2499 | enum migrate_mode); | ||
| 2498 | #else | 2500 | #else |
| 2499 | #define buffer_migrate_page NULL | 2501 | #define buffer_migrate_page NULL |
| 2500 | #endif | 2502 | #endif |
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 14e6d2a8847..eaf867412f7 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h | |||
| @@ -6,18 +6,31 @@ | |||
| 6 | 6 | ||
| 7 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); | 7 | typedef struct page *new_page_t(struct page *, unsigned long private, int **); |
| 8 | 8 | ||
| 9 | /* | ||
| 10 | * MIGRATE_ASYNC means never block | ||
| 11 | * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking | ||
| 12 | * on most operations but not ->writepage as the potential stall time | ||
| 13 | * is too significant | ||
| 14 | * MIGRATE_SYNC will block when migrating pages | ||
| 15 | */ | ||
| 16 | enum migrate_mode { | ||
| 17 | MIGRATE_ASYNC, | ||
| 18 | MIGRATE_SYNC_LIGHT, | ||
| 19 | MIGRATE_SYNC, | ||
| 20 | }; | ||
| 21 | |||
| 9 | #ifdef CONFIG_MIGRATION | 22 | #ifdef CONFIG_MIGRATION |
| 10 | #define PAGE_MIGRATION 1 | 23 | #define PAGE_MIGRATION 1 |
| 11 | 24 | ||
| 12 | extern void putback_lru_pages(struct list_head *l); | 25 | extern void putback_lru_pages(struct list_head *l); |
| 13 | extern int migrate_page(struct address_space *, | 26 | extern int migrate_page(struct address_space *, |
| 14 | struct page *, struct page *, bool); | 27 | struct page *, struct page *, enum migrate_mode); |
| 15 | extern int migrate_pages(struct list_head *l, new_page_t x, | 28 | extern int migrate_pages(struct list_head *l, new_page_t x, |
| 16 | unsigned long private, bool offlining, | 29 | unsigned long private, bool offlining, |
| 17 | bool sync); | 30 | enum migrate_mode mode); |
| 18 | extern int migrate_huge_pages(struct list_head *l, new_page_t x, | 31 | extern int migrate_huge_pages(struct list_head *l, new_page_t x, |
| 19 | unsigned long private, bool offlining, | 32 | unsigned long private, bool offlining, |
| 20 | bool sync); | 33 | enum migrate_mode mode); |
| 21 | 34 | ||
| 22 | extern int fail_migrate_page(struct address_space *, | 35 | extern int fail_migrate_page(struct address_space *, |
| 23 | struct page *, struct page *); | 36 | struct page *, struct page *); |
| @@ -36,10 +49,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping, | |||
| 36 | static inline void putback_lru_pages(struct list_head *l) {} | 49 | static inline void putback_lru_pages(struct list_head *l) {} |
| 37 | static inline int migrate_pages(struct list_head *l, new_page_t x, | 50 | static inline int migrate_pages(struct list_head *l, new_page_t x, |
| 38 | unsigned long private, bool offlining, | 51 | unsigned long private, bool offlining, |
| 39 | bool sync) { return -ENOSYS; } | 52 | enum migrate_mode mode) { return -ENOSYS; } |
| 40 | static inline int migrate_huge_pages(struct list_head *l, new_page_t x, | 53 | static inline int migrate_huge_pages(struct list_head *l, new_page_t x, |
| 41 | unsigned long private, bool offlining, | 54 | unsigned long private, bool offlining, |
| 42 | bool sync) { return -ENOSYS; } | 55 | enum migrate_mode mode) { return -ENOSYS; } |
| 43 | 56 | ||
| 44 | static inline int migrate_prep(void) { return -ENOSYS; } | 57 | static inline int migrate_prep(void) { return -ENOSYS; } |
| 45 | static inline int migrate_prep_local(void) { return -ENOSYS; } | 58 | static inline int migrate_prep_local(void) { return -ENOSYS; } |
