From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
Vineet Gupta <vgupta@synopsys.com>,
Russell King <linux@armlinux.org.uk>,
Will Deacon <will.deacon@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Ralf Baechle <ralf@linux-mips.org>,
"David S. Miller" <davem@davemloft.net>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Andrea Arcangeli <aarcange@redhat.com>
Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Nitin Gupta <nitin.m.gupta@oracle.com>
Subject: Re: [PATCHv3 08/11] sparc64: update pmdp_invalidate to return old pmd value
Date: Wed, 13 Sep 2017 10:36:13 +0530 [thread overview]
Message-ID: <87r2vbur0a.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170912153941.47012-9-kirill.shutemov@linux.intel.com>
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> writes:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
You got the author wrong there.
>
> It's required to avoid loosing dirty and accessed bits.
>
> Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
> arch/sparc/include/asm/pgtable_64.h | 2 +-
> arch/sparc/mm/tlb.c | 23 ++++++++++++++++++-----
> 2 files changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
> index 4fefe3762083..83b06c98bb94 100644
> --- a/arch/sparc/include/asm/pgtable_64.h
> +++ b/arch/sparc/include/asm/pgtable_64.h
> @@ -979,7 +979,7 @@ void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
> pmd_t *pmd);
>
> #define __HAVE_ARCH_PMDP_INVALIDATE
> -extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
> +extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
> pmd_t *pmdp);
>
> #define __HAVE_ARCH_PGTABLE_DEPOSIT
> diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
> index ee8066c3d96c..d36c65fc55cf 100644
> --- a/arch/sparc/mm/tlb.c
> +++ b/arch/sparc/mm/tlb.c
> @@ -218,17 +218,28 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
> }
> }
>
> +static inline pmd_t pmdp_establish(struct vm_area_struct *vma,
> + unsigned long address, pmd_t *pmdp, pmd_t pmd)
> +{
> + pmd_t old;
> +
> + {
> + old = *pmdp;
> + } while (cmpxchg64(&pmdp->pmd, old.pmd, pmd.pmd) != old.pmd);
> +
> + return old;
> +}
> +
> /*
> * This routine is only called when splitting a THP
> */
> -void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
> +pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
> pmd_t *pmdp)
> {
> - pmd_t entry = *pmdp;
> -
> - pmd_val(entry) &= ~_PAGE_VALID;
> + pmd_t old, entry;
>
> - set_pmd_at(vma->vm_mm, address, pmdp, entry);
> + entry = __pmd(pmd_val(*pmdp) & ~_PAGE_VALID);
> + old = pmdp_establish(vma, address, pmdp, entry);
> flush_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
>
> /*
> @@ -239,6 +250,8 @@ void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
> if ((pmd_val(entry) & _PAGE_PMD_HUGE) &&
> !is_huge_zero_page(pmd_page(entry)))
> (vma->vm_mm)->context.thp_pte_count--;
> +
> + return old;
> }
>
> void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
> --
> 2.14.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-09-13 5:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 15:39 [PATCHv3 00/11] Do not loose dirty bit on THP pages Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 01/11] asm-generic: Provide generic_pmdp_establish() Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 02/11] arc: Use generic_pmdp_establish as pmdp_establish Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 03/11] arm/mm: Provide pmdp_establish() helper Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 04/11] arm64: " Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 05/11] mips: Use generic_pmdp_establish as pmdp_establish Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 06/11] powerpc/mm: update pmdp_invalidate to return old pmd value Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 07/11] s390/mm: Modify pmdp_invalidate to return old value Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 08/11] sparc64: update pmdp_invalidate to return old pmd value Kirill A. Shutemov
2017-09-13 5:06 ` Aneesh Kumar K.V [this message]
2017-09-12 15:39 ` [PATCHv3 09/11] x86/mm: Provide pmdp_establish() helper Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 10/11] mm: Do not loose dirty and access bits in pmdp_invalidate() Kirill A. Shutemov
2017-09-12 15:39 ` [PATCHv3 11/11] mm: Use updated pmdp_invalidate() interface to track dirty/accessed bits Kirill A. Shutemov
2017-09-13 2:08 ` Aneesh Kumar K.V
2017-12-13 10:13 ` Kirill A. Shutemov
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=87r2vbur0a.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@armlinux.org.uk \
--cc=nitin.m.gupta@oracle.com \
--cc=ralf@linux-mips.org \
--cc=schwidefsky@de.ibm.com \
--cc=vbabka@suse.cz \
--cc=vgupta@synopsys.com \
--cc=will.deacon@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).