mm: functions may simplify the use of return values

Bugzilla: https://bugzilla.redhat.com/2120352

commit c8db8c2628afc7088a43de3f7cfbcc2ef1f182f7
Author: Li kunyu <kunyu@nfschina.com>
Date:   Thu May 12 20:23:07 2022 -0700

    mm: functions may simplify the use of return values

    p4d_clear_huge may be optimized for void return type and function usage.
    vunmap_p4d_range function saves a few steps here.

    Link: https://lkml.kernel.org/r/20220507150630.90399-1-kunyu@nfschina.com
    Signed-off-by: Li kunyu <kunyu@nfschina.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
This commit is contained in:
Chris von Recklinghausen 2022-10-12 06:42:10 -04:00
parent 9b97a822ab
commit cd6ef9fec1
3 changed files with 6 additions and 16 deletions

View File

@ -676,9 +676,8 @@ int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
*
* No 512GB pages yet -- always return 0
*/
int p4d_clear_huge(p4d_t *p4d)
void p4d_clear_huge(p4d_t *p4d)
{
return 0;
}
#endif

View File

@ -1393,16 +1393,13 @@ static inline int pmd_protnone(pmd_t pmd)
#ifndef __PAGETABLE_P4D_FOLDED
int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot);
int p4d_clear_huge(p4d_t *p4d);
void p4d_clear_huge(p4d_t *p4d);
#else
static inline int p4d_set_huge(p4d_t *p4d, phys_addr_t addr, pgprot_t prot)
{
return 0;
}
static inline int p4d_clear_huge(p4d_t *p4d)
{
return 0;
}
static inline void p4d_clear_huge(p4d_t *p4d) { }
#endif /* !__PAGETABLE_P4D_FOLDED */
int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
@ -1425,10 +1422,7 @@ static inline int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot)
{
return 0;
}
static inline int p4d_clear_huge(p4d_t *p4d)
{
return 0;
}
static inline void p4d_clear_huge(p4d_t *p4d) { }
static inline int pud_clear_huge(pud_t *pud)
{
return 0;

View File

@ -388,18 +388,15 @@ static void vunmap_p4d_range(pgd_t *pgd, unsigned long addr, unsigned long end,
{
p4d_t *p4d;
unsigned long next;
int cleared;
p4d = p4d_offset(pgd, addr);
do {
next = p4d_addr_end(addr, end);
cleared = p4d_clear_huge(p4d);
if (cleared || p4d_bad(*p4d))
p4d_clear_huge(p4d);
if (p4d_bad(*p4d))
*mask |= PGTBL_P4D_MODIFIED;
if (cleared)
continue;
if (p4d_none_or_clear_bad(p4d))
continue;
vunmap_pud_range(p4d, addr, next, mask);