public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling•org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux•vnet.ibm.com>,
	benh@kernel•crashing.org, paulus@samba•org, mpe@ellerman•id.au
Cc: linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH 2/3] powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm
Date: Tue, 14 Feb 2017 15:17:28 +1100	[thread overview]
Message-ID: <1487045848.21048.26.camel@neuling.org> (raw)
In-Reply-To: <1486609101-5231-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On Thu, 2017-02-09 at 08:28 +0530, Aneesh Kumar K.V wrote:
> This helps us to do some optimization for application exit case, where we=
 can
> skip the DD1 style pte update sequence.
>=20
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux•vnet.ibm.com>

Tested-by: Michael Neuling <mikey@neuling•org>

> ---
> =C2=A0arch/powerpc/include/asm/book3s/64/pgtable.h | 17 +++++++++++++++++
> =C2=A0arch/powerpc/include/asm/book3s/64/radix.h=C2=A0=C2=A0=C2=A0| 23 ++=
++++++++++++++++++++-
> =C2=A02 files changed, 39 insertions(+), 1 deletion(-)
>=20
> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h
> b/arch/powerpc/include/asm/book3s/64/pgtable.h
> index 6f15bde94da2..e91ada786d48 100644
> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
> @@ -373,6 +373,23 @@ static inline pte_t ptep_get_and_clear(struct mm_str=
uct
> *mm,
> =C2=A0	return __pte(old);
> =C2=A0}
> =C2=A0
> +#define __HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL
> +static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
> +					=C2=A0=C2=A0=C2=A0=C2=A0unsigned long addr,
> +					=C2=A0=C2=A0=C2=A0=C2=A0pte_t *ptep, int full)
> +{
> +	if (full && radix_enabled()) {
> +		/*
> +		=C2=A0* Let's skip the DD1 style pte update here. We know that
> +		=C2=A0* this is a full mm pte clear and hence can be sure there is
> +		=C2=A0* no parallel set_pte.
> +		=C2=A0*/
> +		return radix__ptep_get_and_clear_full(mm, addr, ptep, full);
> +	}
> +	return ptep_get_and_clear(mm, addr, ptep);
> +}
> +
> +
> =C2=A0static inline void pte_clear(struct mm_struct *mm, unsigned long ad=
dr,
> =C2=A0			=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0pte_t * ptep)
> =C2=A0{
> diff --git a/arch/powerpc/include/asm/book3s/64/radix.h
> b/arch/powerpc/include/asm/book3s/64/radix.h
> index 70a3cdcdbe47..fcf822d6c204 100644
> --- a/arch/powerpc/include/asm/book3s/64/radix.h
> +++ b/arch/powerpc/include/asm/book3s/64/radix.h
> @@ -139,7 +139,7 @@ static inline unsigned long radix__pte_update(struct
> mm_struct *mm,
> =C2=A0
> =C2=A0		unsigned long new_pte;
> =C2=A0
> -		old_pte =3D __radix_pte_update(ptep, ~0, 0);
> +		old_pte =3D __radix_pte_update(ptep, ~0ul, 0);
> =C2=A0		/*
> =C2=A0		=C2=A0* new value of pte
> =C2=A0		=C2=A0*/
> @@ -157,6 +157,27 @@ static inline unsigned long radix__pte_update(struct
> mm_struct *mm,
> =C2=A0	return old_pte;
> =C2=A0}
> =C2=A0
> +static inline pte_t radix__ptep_get_and_clear_full(struct mm_struct *mm,
> +						=C2=A0=C2=A0=C2=A0unsigned long addr,
> +						=C2=A0=C2=A0=C2=A0pte_t *ptep, int full)
> +{
> +	unsigned long old_pte;
> +
> +	if (full) {
> +		/*
> +		=C2=A0* If we are trying to clear the pte, we can skip
> +		=C2=A0* the DD1 pte update sequence and batch the tlb flush. The
> +		=C2=A0* tlb flush batching is done by mmu gather code. We
> +		=C2=A0* still keep the cmp_xchg update to make sure we get
> +		=C2=A0* correct R/C bit which might be updated via Nest MMU.
> +		=C2=A0*/
> +		old_pte =3D __radix_pte_update(ptep, ~0ul, 0);
> +	} else
> +		old_pte =3D radix__pte_update(mm, addr, ptep, ~0ul, 0, 0);
> +
> +	return __pte(old_pte);
> +}
> +
> =C2=A0/*
> =C2=A0 * Set the dirty and/or accessed bits atomically in a linux PTE, th=
is
> =C2=A0 * function doesn't need to invalidate tlb.

  reply	other threads:[~2017-02-14  4:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  2:58 [PATCH 1/3] powerpc/mm/radix: Update pte update sequence for pte clear case Aneesh Kumar K.V
2017-02-09  2:58 ` [PATCH 2/3] powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm Aneesh Kumar K.V
2017-02-14  4:17   ` Michael Neuling [this message]
2017-02-09  2:58 ` [PATCH 3/3] powerpc/mm/radix: Skip ptesync in pte update helpers Aneesh Kumar K.V
2017-02-14  4:17   ` Michael Neuling
2017-02-09  3:49 ` [PATCH 1/3] powerpc/mm/radix: Update pte update sequence for pte clear case Benjamin Herrenschmidt
2017-02-09  4:15   ` Benjamin Herrenschmidt
2017-02-09  4:34     ` Aneesh Kumar K.V
2017-02-14  4:17 ` Michael Neuling
2017-02-16  5:59 ` [1/3] " Michael Ellerman

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=1487045848.21048.26.camel@neuling.org \
    --to=mikey@neuling$(echo .)org \
    --cc=aneesh.kumar@linux$(echo .)vnet.ibm.com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox