aboutsummaryrefslogtreecommitdiffstats
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-10-25 08:16:32 -0400
committerMel Gorman <mgorman@suse.de>2012-12-11 09:42:44 -0500
commit4b10e7d562c90d0a72f324832c26653947a07381 (patch)
tree733e0fc3ac3fdfe27a312bc72e4ffb07bbf0aa56 /mm/huge_memory.c
parentb24f53a0bea38b266d219ee651b22dba727c44ae (diff)
mm: mempolicy: Implement change_prot_numa() in terms of change_protection()
This patch converts change_prot_numa() to use change_protection(). As pte_numa and friends check the PTE bits directly it is necessary for change_protection() to use pmd_mknuma(). Hence the required modifications to change_protection() are a little clumsy but the end result is that most of the numa page table helpers are just one or two instructions. Signed-off-by: Mel Gorman <mgorman@suse.de>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 5723b551c023..d79f7a55bf6f 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1147,7 +1147,7 @@ out:
1147} 1147}
1148 1148
1149int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 1149int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
1150 unsigned long addr, pgprot_t newprot) 1150 unsigned long addr, pgprot_t newprot, int prot_numa)
1151{ 1151{
1152 struct mm_struct *mm = vma->vm_mm; 1152 struct mm_struct *mm = vma->vm_mm;
1153 int ret = 0; 1153 int ret = 0;
@@ -1155,7 +1155,17 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
1155 if (__pmd_trans_huge_lock(pmd, vma) == 1) { 1155 if (__pmd_trans_huge_lock(pmd, vma) == 1) {
1156 pmd_t entry; 1156 pmd_t entry;
1157 entry = pmdp_get_and_clear(mm, addr, pmd); 1157 entry = pmdp_get_and_clear(mm, addr, pmd);
1158 entry = pmd_modify(entry, newprot); 1158 if (!prot_numa)
1159 entry = pmd_modify(entry, newprot);
1160 else {
1161 struct page *page = pmd_page(*pmd);
1162
1163 /* only check non-shared pages */
1164 if (page_mapcount(page) == 1 &&
1165 !pmd_numa(*pmd)) {
1166 entry = pmd_mknuma(entry);
1167 }
1168 }
1159 set_pmd_at(mm, addr, pmd, entry); 1169 set_pmd_at(mm, addr, pmd, entry);
1160 spin_unlock(&vma->vm_mm->page_table_lock); 1170 spin_unlock(&vma->vm_mm->page_table_lock);
1161 ret = 1; 1171 ret = 1;