Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbdCCFic (ORCPT ); Fri, 3 Mar 2017 00:38:32 -0500 Received: from out4439.biz.mail.alibaba.com ([47.88.44.39]:54012 "EHLO out4439.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbdCCFi3 (ORCPT ); Fri, 3 Mar 2017 00:38:29 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03293;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---.7k9n9XY_1488519311; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "'Kirill A. Shutemov'" , "'Andrea Arcangeli'" , "'Andrew Morton'" Cc: , , "'Minchan Kim'" References: <20170302151034.27829-1-kirill.shutemov@linux.intel.com> <20170302151034.27829-4-kirill.shutemov@linux.intel.com> In-Reply-To: <20170302151034.27829-4-kirill.shutemov@linux.intel.com> Subject: Re: [PATCH 3/4] thp: fix MADV_DONTNEED vs. MADV_FREE race Date: Fri, 03 Mar 2017 13:35:11 +0800 Message-ID: <07b101d293df$ed8c9850$c8a5c8f0$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIZX7NQaCn8dtbnXfLJPrqJKqGIyQEmAP1MoOvNr0A= Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 33 On March 02, 2017 11:11 PM Kirill A. Shutemov wrote: > > Basically the same race as with numa balancing in change_huge_pmd(), but > a bit simpler to mitigate: we don't need to preserve dirty/young flags > here due to MADV_FREE functionality. > > Signed-off-by: Kirill A. Shutemov > Cc: Minchan Kim > --- > mm/huge_memory.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index bb2b3646bd78..324217c31ec9 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -1566,8 +1566,6 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, > deactivate_page(page); > > if (pmd_young(orig_pmd) || pmd_dirty(orig_pmd)) { > - orig_pmd = pmdp_huge_get_and_clear_full(tlb->mm, addr, pmd, > - tlb->fullmm); > orig_pmd = pmd_mkold(orig_pmd); > orig_pmd = pmd_mkclean(orig_pmd); > $ grep -n set_pmd_at linux-4.10/arch/powerpc/mm/pgtable-book3s64.c /* * set a new huge pmd. We should not be called for updating * an existing pmd entry. That should go via pmd_hugepage_update. */ void set_pmd_at(struct mm_struct *mm, unsigned long addr,