From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726AbbJQMM5 (ORCPT ); Sat, 17 Oct 2015 08:12:57 -0400 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:51114 "EHLO e28smtp01.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752459AbbJQMM4 (ORCPT ); Sat, 17 Oct 2015 08:12:56 -0400 X-Helo: d28dlp01.in.ibm.com X-MailFrom: aneesh.kumar@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org From: "Aneesh Kumar K.V" To: Laurent Dufour , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, xemul@parallels.com, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org Cc: criu@openvz.org Subject: Re: [PATCH 1/3] mm: clearing pte in clear_soft_dirty() In-Reply-To: <8352032008c7d9f1eee8d39599888a4cbe570bf7.1444995096.git.ldufour@linux.vnet.ibm.com> References: <8352032008c7d9f1eee8d39599888a4cbe570bf7.1444995096.git.ldufour@linux.vnet.ibm.com> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Sat, 17 Oct 2015 17:42:49 +0530 Message-ID: <87fv19itha.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15101712-4790-0000-0000-00000AF90A1F Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Laurent Dufour writes: > As mentioned in the commit 56eecdb912b5 ("mm: Use ptep/pmdp_set_numa() > for updating _PAGE_NUMA bit"), architecture like ppc64 doesn't do > tlb flush in set_pte/pmd functions. > > So when dealing with existing pte in clear_soft_dirty, the pte must > be cleared before being modified. > > Signed-off-by: Laurent Dufour > CC: Aneesh Kumar K.V Reviewed-by: Aneesh Kumar K.V > --- > fs/proc/task_mmu.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > index e2d46adb54b4..c9454ee39b28 100644 > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c > @@ -753,19 +753,20 @@ static inline void clear_soft_dirty(struct vm_area_struct *vma, > pte_t ptent = *pte; > > if (pte_present(ptent)) { > + ptent = ptep_modify_prot_start(vma->vm_mm, addr, pte); > ptent = pte_wrprotect(ptent); > ptent = pte_clear_flags(ptent, _PAGE_SOFT_DIRTY); > + ptep_modify_prot_commit(vma->vm_mm, addr, pte, ptent); > } else if (is_swap_pte(ptent)) { > ptent = pte_swp_clear_soft_dirty(ptent); > + set_pte_at(vma->vm_mm, addr, pte, ptent); > } > - > - set_pte_at(vma->vm_mm, addr, pte, ptent); > } > > static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma, > unsigned long addr, pmd_t *pmdp) > { > - pmd_t pmd = *pmdp; > + pmd_t pmd = pmdp_huge_get_and_clear(vma->vm_mm, addr, pmdp); > > pmd = pmd_wrprotect(pmd); > pmd = pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY); > -- > 1.9.1