diff options
Diffstat (limited to 'mm/migrate.c')
-rw-r--r-- | mm/migrate.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index b1f57501de9c..6f0c24438bba 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -200,15 +200,14 @@ static void remove_migration_ptes(struct page *old, struct page *new) | |||
200 | * get to the page and wait until migration is finished. | 200 | * get to the page and wait until migration is finished. |
201 | * When we return from this function the fault will be retried. | 201 | * When we return from this function the fault will be retried. |
202 | */ | 202 | */ |
203 | void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, | 203 | static void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep, |
204 | unsigned long address) | 204 | spinlock_t *ptl) |
205 | { | 205 | { |
206 | pte_t *ptep, pte; | 206 | pte_t pte; |
207 | spinlock_t *ptl; | ||
208 | swp_entry_t entry; | 207 | swp_entry_t entry; |
209 | struct page *page; | 208 | struct page *page; |
210 | 209 | ||
211 | ptep = pte_offset_map_lock(mm, pmd, address, &ptl); | 210 | spin_lock(ptl); |
212 | pte = *ptep; | 211 | pte = *ptep; |
213 | if (!is_swap_pte(pte)) | 212 | if (!is_swap_pte(pte)) |
214 | goto out; | 213 | goto out; |
@@ -236,6 +235,20 @@ out: | |||
236 | pte_unmap_unlock(ptep, ptl); | 235 | pte_unmap_unlock(ptep, ptl); |
237 | } | 236 | } |
238 | 237 | ||
238 | void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd, | ||
239 | unsigned long address) | ||
240 | { | ||
241 | spinlock_t *ptl = pte_lockptr(mm, pmd); | ||
242 | pte_t *ptep = pte_offset_map(pmd, address); | ||
243 | __migration_entry_wait(mm, ptep, ptl); | ||
244 | } | ||
245 | |||
246 | void migration_entry_wait_huge(struct mm_struct *mm, pte_t *pte) | ||
247 | { | ||
248 | spinlock_t *ptl = &(mm)->page_table_lock; | ||
249 | __migration_entry_wait(mm, pte, ptl); | ||
250 | } | ||
251 | |||
239 | #ifdef CONFIG_BLOCK | 252 | #ifdef CONFIG_BLOCK |
240 | /* Returns true if all buffers are successfully locked */ | 253 | /* Returns true if all buffers are successfully locked */ |
241 | static bool buffer_migrate_lock_buffers(struct buffer_head *head, | 254 | static bool buffer_migrate_lock_buffers(struct buffer_head *head, |