Skip to content

Commit bf7c149

Browse files
riteshharjanimaddy-kerneldev
authored andcommitted
powerpc/64s: Move serialize_against_pte_lookup() to hash_pgtable.c
Originally, commit fa4531f ("powerpc/mm: Don't send IPI to all cpus on THP updates") introduced serialize_against_pte_lookup() call for both Radix and Hash. However below commit fixed the race with Radix commit 70cbc3c ("mm: gup: fix the fast GUP race against THP collapse") And therefore following commit removed the serialize_against_pte_lookup() call from radix_pgtable.c commit bedf034 ("powerpc/64s/radix: don't need to broadcast IPI for radix pmd collapse flush") Now since serialize_against_pte_lookup() only gets called from hash__pmdp_collapse_flush(), thus move the related functions to hash_pgtable.c Hence this patch: - moves serialize_against_pte_lookup() from radix_pgtable.c to hash_pgtable.c - removes the radix specific calls from do_serialize() - renames do_serialize() to do_nothing(). There should not be any functionality change in this patch. Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/a73ebe800a9be257329507703779f822363f8b2f.1773078178.git.ritesh.list@gmail.com
1 parent 4a342f3 commit bf7c149

3 files changed

Lines changed: 21 additions & 26 deletions

File tree

arch/powerpc/include/asm/book3s/64/pgtable.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,6 @@ static inline bool arch_needs_pgtable_deposit(void)
14151415
return false;
14161416
return true;
14171417
}
1418-
extern void serialize_against_pte_lookup(struct mm_struct *mm);
14191418

14201419
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
14211420

arch/powerpc/mm/book3s64/hash_pgtable.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,27 @@ unsigned long hash__pmd_hugepage_update(struct mm_struct *mm, unsigned long addr
221221
return old;
222222
}
223223

224+
static void do_nothing(void *arg)
225+
{
226+
227+
}
228+
229+
/*
230+
* Serialize against __find_linux_pte() which does lock-less
231+
* lookup in page tables with local interrupts disabled. For huge pages
232+
* it casts pmd_t to pte_t. Since format of pte_t is different from
233+
* pmd_t we want to prevent transit from pmd pointing to page table
234+
* to pmd pointing to huge page (and back) while interrupts are disabled.
235+
* We clear pmd to possibly replace it with page table pointer in
236+
* different code paths. So make sure we wait for the parallel
237+
* __find_linux_pte() to finish.
238+
*/
239+
static void serialize_against_pte_lookup(struct mm_struct *mm)
240+
{
241+
smp_mb();
242+
smp_call_function_many(mm_cpumask(mm), do_nothing, mm, 1);
243+
}
244+
224245
pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long address,
225246
pmd_t *pmdp)
226247
{

arch/powerpc/mm/book3s64/pgtable.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,6 @@ void set_pud_at(struct mm_struct *mm, unsigned long addr,
150150
return set_pte_at_unchecked(mm, addr, pudp_ptep(pudp), pud_pte(pud));
151151
}
152152

153-
static void do_serialize(void *arg)
154-
{
155-
/* We've taken the IPI, so try to trim the mask while here */
156-
if (radix_enabled()) {
157-
struct mm_struct *mm = arg;
158-
exit_lazy_flush_tlb(mm, false);
159-
}
160-
}
161-
162-
/*
163-
* Serialize against __find_linux_pte() which does lock-less
164-
* lookup in page tables with local interrupts disabled. For huge pages
165-
* it casts pmd_t to pte_t. Since format of pte_t is different from
166-
* pmd_t we want to prevent transit from pmd pointing to page table
167-
* to pmd pointing to huge page (and back) while interrupts are disabled.
168-
* We clear pmd to possibly replace it with page table pointer in
169-
* different code paths. So make sure we wait for the parallel
170-
* __find_linux_pte() to finish.
171-
*/
172-
void serialize_against_pte_lookup(struct mm_struct *mm)
173-
{
174-
smp_mb();
175-
smp_call_function_many(mm_cpumask(mm), do_serialize, mm, 1);
176-
}
177-
178153
/*
179154
* We use this to invalidate a pmdp entry before switching from a
180155
* hugepte to regular pmd entry.

0 commit comments

Comments
 (0)