mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-15 07:04:44 +00:00
powerpc/mm: flatten function __find_linux_pte() step 3
__find_linux_pte() is full of if/else which is hard to follow allthough the handling is pretty simple. Previous patches left a { } block. This patch removes it. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
e2fb251188
commit
26e66b08c3
1 changed files with 49 additions and 49 deletions
|
@ -348,59 +348,59 @@ pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
|
||||||
hpdp = (hugepd_t *)&pgd;
|
hpdp = (hugepd_t *)&pgd;
|
||||||
goto out_huge;
|
goto out_huge;
|
||||||
}
|
}
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Even if we end up with an unmap, the pgtable will not
|
|
||||||
* be freed, because we do an rcu free and here we are
|
|
||||||
* irq disabled
|
|
||||||
*/
|
|
||||||
pdshift = PUD_SHIFT;
|
|
||||||
pudp = pud_offset(&pgd, ea);
|
|
||||||
pud = READ_ONCE(*pudp);
|
|
||||||
|
|
||||||
if (pud_none(pud))
|
/*
|
||||||
return NULL;
|
* Even if we end up with an unmap, the pgtable will not
|
||||||
|
* be freed, because we do an rcu free and here we are
|
||||||
|
* irq disabled
|
||||||
|
*/
|
||||||
|
pdshift = PUD_SHIFT;
|
||||||
|
pudp = pud_offset(&pgd, ea);
|
||||||
|
pud = READ_ONCE(*pudp);
|
||||||
|
|
||||||
if (pud_huge(pud)) {
|
if (pud_none(pud))
|
||||||
ret_pte = (pte_t *) pudp;
|
return NULL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (is_hugepd(__hugepd(pud_val(pud)))) {
|
|
||||||
hpdp = (hugepd_t *)&pud;
|
|
||||||
goto out_huge;
|
|
||||||
}
|
|
||||||
pdshift = PMD_SHIFT;
|
|
||||||
pmdp = pmd_offset(&pud, ea);
|
|
||||||
pmd = READ_ONCE(*pmdp);
|
|
||||||
/*
|
|
||||||
* A hugepage collapse is captured by pmd_none, because
|
|
||||||
* it mark the pmd none and do a hpte invalidate.
|
|
||||||
*/
|
|
||||||
if (pmd_none(pmd))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (pmd_trans_huge(pmd) || pmd_devmap(pmd)) {
|
if (pud_huge(pud)) {
|
||||||
if (is_thp)
|
ret_pte = (pte_t *)pudp;
|
||||||
*is_thp = true;
|
goto out;
|
||||||
ret_pte = (pte_t *)pmdp;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* pmd_large check below will handle the swap pmd pte
|
|
||||||
* we need to do both the check because they are config
|
|
||||||
* dependent.
|
|
||||||
*/
|
|
||||||
if (pmd_huge(pmd) || pmd_large(pmd)) {
|
|
||||||
ret_pte = (pte_t *)pmdp;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (is_hugepd(__hugepd(pmd_val(pmd)))) {
|
|
||||||
hpdp = (hugepd_t *)&pmd;
|
|
||||||
goto out_huge;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pte_offset_kernel(&pmd, ea);
|
|
||||||
}
|
}
|
||||||
|
if (is_hugepd(__hugepd(pud_val(pud)))) {
|
||||||
|
hpdp = (hugepd_t *)&pud;
|
||||||
|
goto out_huge;
|
||||||
|
}
|
||||||
|
pdshift = PMD_SHIFT;
|
||||||
|
pmdp = pmd_offset(&pud, ea);
|
||||||
|
pmd = READ_ONCE(*pmdp);
|
||||||
|
/*
|
||||||
|
* A hugepage collapse is captured by pmd_none, because
|
||||||
|
* it mark the pmd none and do a hpte invalidate.
|
||||||
|
*/
|
||||||
|
if (pmd_none(pmd))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (pmd_trans_huge(pmd) || pmd_devmap(pmd)) {
|
||||||
|
if (is_thp)
|
||||||
|
*is_thp = true;
|
||||||
|
ret_pte = (pte_t *)pmdp;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* pmd_large check below will handle the swap pmd pte
|
||||||
|
* we need to do both the check because they are config
|
||||||
|
* dependent.
|
||||||
|
*/
|
||||||
|
if (pmd_huge(pmd) || pmd_large(pmd)) {
|
||||||
|
ret_pte = (pte_t *)pmdp;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if (is_hugepd(__hugepd(pmd_val(pmd)))) {
|
||||||
|
hpdp = (hugepd_t *)&pmd;
|
||||||
|
goto out_huge;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pte_offset_kernel(&pmd, ea);
|
||||||
|
|
||||||
out_huge:
|
out_huge:
|
||||||
if (!hpdp)
|
if (!hpdp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue