All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anshuman Khandual" <anshuman.khandual@arm.com>
Cc: "Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	linux-s390@vger.kernel.org, "Vasily Gorbik" <gor@linux.ibm.com>
Subject: Re: [PATCH 2/3] loongarch/mm: Drop all pxdp_get()
Date: Wed, 23 Sep 2026 04:41:44 +0000	[thread overview]
Message-ID: <20260923044145.2E0911F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923043226.331880-3-anshuman.khandual@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mm: performance regression from de-inlining pte_clear()
--

commit 5d80651056844549679369970919b58e26bc34bf
Author: Anshuman Khandual <anshuman.khandual@arm.com>

loongarch/mm: Drop all pxdp_get()

This patch removes redundant loongarch-specific pxdp_get() helpers, relying
on the generic ones from include/linux/pgtable.h. To prevent build failures,
it moves some dependent functions to out-of-line implementations.

> diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
> index a05f6a4928dc6..b1060b86d5353 100644
> --- a/arch/loongarch/include/asm/pgtable.h
> +++ b/arch/loongarch/include/asm/pgtable.h

[ ... ]

> @@ -378,12 +375,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
>  #endif
>  }
>  
> -static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
> -{
> -	pte_t pte = ptep_get(ptep);
> -	pte_val(pte) &= _PAGE_GLOBAL;
> -	set_pte(ptep, pte);
> -}
> +void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);

[Severity: High]
Does removing 'static inline' and moving pte_clear() out-of-line introduce a
performance regression?

pte_clear() is a core memory management primitive executed iteratively in
extremely hot paths. For instance, zap_pte_range() processes up to 512 PTEs
per PMD during munmap or madvise. Replacing inline bitwise operations with
function calls during large VMA teardown introduces a significant overhead
for any unprivileged process allocating and freeing memory.

Could this be avoided by expanding ptep_get(ptep) to its equivalent
READ_ONCE(*ptep) inside the inline definition instead of moving the function
out-of-line?

[ ... ]

> @@ -618,16 +610,8 @@ static inline pmd_t pmd_mkinvalid(pmd_t pmd)
>   * different prototype.
>   */
>  #define __HAVE_ARCH_PMDP_HUGE_GET_AND_CLEAR
> -static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
> -					    unsigned long address, pmd_t *pmdp)
> -{
> -	pmd_t old = pmdp_get(pmdp);
> -
> -	pmd_clear(pmdp);
> -
> -	return old;
> -}
>  
> +pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm, unsigned long address, pmd_t *pmdp);

[Severity: High]
Does moving pmdp_huge_get_and_clear() out-of-line similarly negatively impact
THP teardown performance?

Like pte_clear(), this function operates on hot paths, and substituting an
inline definition with a function call introduces overhead. Could this also
be kept inline by expanding pmdp_get(pmdp) to READ_ONCE(*pmdp)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923043226.331880-1-anshuman.khandual@arm.com?part=2

  reply	other threads:[~2026-09-23  4:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  4:32 [PATCH 0/3] arch/mm: Drop similar platform overrides for pxdp_get() Anshuman Khandual
2026-09-23  4:32 ` [PATCH 1/3] s390/mm: Drop all pxdp_get() Anshuman Khandual
2026-09-23  4:42   ` sashiko-bot
2026-09-23  9:16   ` Heiko Carstens
2026-09-23 12:12     ` Anshuman Khandual
2026-09-23 14:32       ` Heiko Carstens
2026-09-24  2:37         ` Anshuman Khandual
2026-09-23  4:32 ` [PATCH 2/3] loongarch/mm: " Anshuman Khandual
2026-09-23  4:41   ` sashiko-bot [this message]
2026-09-23  4:32 ` [PATCH 3/3] parisc/mm: " Anshuman Khandual
2026-09-23  4:42   ` sashiko-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-09-19 10:13 [PATCH 0/3] arch/mm: Drop similar platform overrides for pxdp_get() Anshuman Khandual
2026-09-19 10:13 ` [PATCH 2/3] loongarch/mm: Drop all pxdp_get() Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923044145.2E0911F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.