Skip to content

Commit 64cdd54

Browse files
kosakitorvalds
authored andcommitted
mm: cleanup: remove #ifdef CONFIG_MIGRATION
#ifdef in *.c file decrease source readability a bit. removing is better. This patch doesn't have any functional change. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1b0bd11 commit 64cdd54

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

‎include/linux/migrate.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
typedef struct page *new_page_t(struct page *, unsigned long private, int **);
88

99
#ifdef CONFIG_MIGRATION
10+
#define PAGE_MIGRATION 1
11+
1012
extern int putback_lru_pages(struct list_head *l);
1113
extern int migrate_page(struct address_space *,
1214
struct page *, struct page *);
@@ -20,6 +22,8 @@ extern int migrate_vmas(struct mm_struct *mm,
2022
const nodemask_t *from, const nodemask_t *to,
2123
unsigned long flags);
2224
#else
25+
#define PAGE_MIGRATION 0
26+
2327
static inline int putback_lru_pages(struct list_head *l) { return 0; }
2428
static inline int migrate_pages(struct list_head *l, new_page_t x,
2529
unsigned long private) { return -ENOSYS; }

‎mm/mprotect.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/swap.h>
2323
#include <linux/swapops.h>
2424
#include <linux/mmu_notifier.h>
25+
#include <linux/migrate.h>
2526
#include <asm/uaccess.h>
2627
#include <asm/pgtable.h>
2728
#include <asm/cacheflush.h>
@@ -59,8 +60,7 @@ static void change_pte_range(struct mm_struct *mm, pmd_t *pmd,
5960
ptent = pte_mkwrite(ptent);
6061

6162
ptep_modify_prot_commit(mm, addr, pte, ptent);
62-
#ifdef CONFIG_MIGRATION
63-
} else if (!pte_file(oldpte)) {
63+
} else if (PAGE_MIGRATION && !pte_file(oldpte)) {
6464
swp_entry_t entry = pte_to_swp_entry(oldpte);
6565

6666
if (is_write_migration_entry(entry)) {
@@ -72,9 +72,7 @@ static void change_pte_range(struct mm_struct *mm, pmd_t *pmd,
7272
set_pte_at(mm, addr, pte,
7373
swp_entry_to_pte(entry));
7474
}
75-
#endif
7675
}
77-
7876
} while (pte++, addr += PAGE_SIZE, addr != end);
7977
arch_leave_lazy_mmu_mode();
8078
pte_unmap_unlock(pte - 1, ptl);

‎mm/rmap.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <linux/kallsyms.h>
5151
#include <linux/memcontrol.h>
5252
#include <linux/mmu_notifier.h>
53+
#include <linux/migrate.h>
5354

5455
#include <asm/tlbflush.h>
5556

@@ -818,28 +819,23 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
818819
spin_unlock(&mmlist_lock);
819820
}
820821
dec_mm_counter(mm, anon_rss);
821-
#ifdef CONFIG_MIGRATION
822-
} else {
822+
} else if (PAGE_MIGRATION) {
823823
/*
824824
* Store the pfn of the page in a special migration
825825
* pte. do_swap_page() will wait until the migration
826826
* pte is removed and then restart fault handling.
827827
*/
828828
BUG_ON(!migration);
829829
entry = make_migration_entry(page, pte_write(pteval));
830-
#endif
831830
}
832831
set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
833832
BUG_ON(pte_file(*pte));
834-
} else
835-
#ifdef CONFIG_MIGRATION
836-
if (migration) {
833+
} else if (PAGE_MIGRATION && migration) {
837834
/* Establish migration entry for a file page */
838835
swp_entry_t entry;
839836
entry = make_migration_entry(page, pte_write(pteval));
840837
set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
841838
} else
842-
#endif
843839
dec_mm_counter(mm, file_rss);
844840

845841

0 commit comments

Comments
 (0)