Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp994048imm; Fri, 12 Oct 2018 09:56:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV62/cbwAEmlzN9rcaYkyO3nOzTiyLFrl+5CBZBKF0JfR9tVFB4ZWvsJsknZdhQJE2ZQHMvsn X-Received: by 2002:a17:902:9896:: with SMTP id s22-v6mr6537588plp.113.1539363402070; Fri, 12 Oct 2018 09:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539363402; cv=none; d=google.com; s=arc-20160816; b=BRquP7QzXdfIHeTK6gKm5RC/LZGer5lxF8y+lsB1eKzNLX55L9sK02+1VJgw+H9zY9 A8dlyOaNMBT9Kc0djeloJ60mnBCoF6ocJ4K3/vm+Zd7ivWRNyGKrKVrb9/mYf934pzPR nKHMQO6NvBTozUbQ2N2MU+QJl1MgX7R5Vm9dQXtCRETcbVKTk2Nzd4s1jKD1mVcs/toR nZ9fEUTV/CzXYD/WrhOM4yvtfRmJRDnawHJ305IbfEZx9N5p/JUN8U5SaTnjWj6qNfL9 rc+TvCZO4Yt/AEHA+honOdlBd2fvcR5C3lW1lSl6ygM4FvPF9EqyK9MXz3mBNaxZB9c/ +w8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=imLvaSv6WHP1asbyGw3f0JNexr/1JnEXniglvpmoYU4=; b=ROKegl/Y47fuzHnSZGJl5RbglK4v6sklfc0ogL+yP1cN2F2dfqEFTsdg/DUhc3qiIQ hoDd1FaKlGP4gtg3vfxRoaDCMjfPV/amWLf9lC2Q5+FDnpAYuUF+P0N0UrHXOLW3Dcd0 E/V99947PW8OGRX7+tvxFBKjl/mPf4T09dekEsHxSFuyW8h4UhL6+Y2Qu58O1/adLTFh jlBxaKVlooP6v9pkKpj9xCI62L3lsOQgUIjORQdQiXa5HYqJurnExr8ueI9SpfbGv/QG GyAhYqHjVmqpaQo5c6IHXtQxVfrbX4C1d41Ut2pmP7XmIVn/StaeXTW/eB1ev6OZJd32 t8DQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p74-v6si1792738pfa.44.2018.10.12.09.56.27; Fri, 12 Oct 2018 09:56:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbeJMA3T (ORCPT + 99 others); Fri, 12 Oct 2018 20:29:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:59232 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726788AbeJMA3S (ORCPT ); Fri, 12 Oct 2018 20:29:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C633BAE85; Fri, 12 Oct 2018 16:55:52 +0000 (UTC) Date: Fri, 12 Oct 2018 18:55:48 +0200 From: Michal Hocko To: jglisse@redhat.com Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Zi Yan , "Kirill A . Shutemov" , "H. Peter Anvin" , Anshuman Khandual , Dave Hansen , David Nellans , Ingo Molnar , Mel Gorman , Minchan Kim , Naoya Horiguchi , Thomas Gleixner , Vlastimil Babka , Andrea Arcangeli Subject: Re: [PATCH] mm/thp: fix call to mmu_notifier in set_pmd_migration_entry() Message-ID: <20181012165548.GZ5873@dhcp22.suse.cz> References: <20181012160953.5841-1-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181012160953.5841-1-jglisse@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 12-10-18 12:09:53, jglisse@redhat.com wrote: > From: J?r?me Glisse > > Inside set_pmd_migration_entry() we are holding page table locks and > thus we can not sleep so we can not call invalidate_range_start/end() > > So remove call to mmu_notifier_invalidate_range_start/end() and add > call to mmu_notifier_invalidate_range(). Note that we are already > calling mmu_notifier_invalidate_range_start/end() inside the function > calling set_pmd_migration_entry() (see try_to_unmap_one()). > > Signed-off-by: J?r?me Glisse > Reported-by: Andrea Arcangeli > Cc: Andrew Morton > Cc: Greg Kroah-Hartman > Cc: Zi Yan > Cc: Kirill A. Shutemov > Cc: "H. Peter Anvin" > Cc: Anshuman Khandual > Cc: Dave Hansen > Cc: David Nellans > Cc: Ingo Molnar > Cc: Mel Gorman > Cc: Minchan Kim > Cc: Naoya Horiguchi > Cc: Thomas Gleixner > Cc: Vlastimil Babka > Cc: Michal Hocko > Cc: Andrea Arcangeli Is this worth backporting to stable trees? The patch looks good to me Acked-by: Michal Hocko > --- > mm/huge_memory.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 533f9b00147d..93cb80fe12cb 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c > @@ -2885,9 +2885,6 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, > if (!(pvmw->pmd && !pvmw->pte)) > return; > > - mmu_notifier_invalidate_range_start(mm, address, > - address + HPAGE_PMD_SIZE); > - > flush_cache_range(vma, address, address + HPAGE_PMD_SIZE); > pmdval = *pvmw->pmd; > pmdp_invalidate(vma, address, pvmw->pmd); > @@ -2898,11 +2895,9 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, > if (pmd_soft_dirty(pmdval)) > pmdswp = pmd_swp_mksoft_dirty(pmdswp); > set_pmd_at(mm, address, pvmw->pmd, pmdswp); > + mmu_notifier_invalidate_range(mm, address, address + HPAGE_PMD_SIZE); > page_remove_rmap(page, true); > put_page(page); > - > - mmu_notifier_invalidate_range_end(mm, address, > - address + HPAGE_PMD_SIZE); > } > > void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) > -- > 2.17.2 -- Michal Hocko SUSE Labs