Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp945960imm; Fri, 12 Oct 2018 09:10:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV6374V1rM0qBRD+CTJH9w3JMj30MbMX623G50fnJTNDvFYvWMZeM61Pxa0LZlVf2D0A40Vf5 X-Received: by 2002:a17:902:4401:: with SMTP id k1-v6mr6374722pld.97.1539360646699; Fri, 12 Oct 2018 09:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539360646; cv=none; d=google.com; s=arc-20160816; b=azA3WXxo46jWDLtMHoMwAlQG6Pj7S9E/3YIuzN7hjcN0XK+KPdfcKMRKTjpdyH9+LN uXN+h6HS3nRy0rawsPNM0AHq70g5XZQtJRKa/VXzS90BaOt5Fqt9u/N1LVGXQlfWFMtN /hO5k+dQVZUHMxRXgMGpNsVz3Y71r70S9RERirNFdqxtXP1a+MKy4pZ9GoU06RLMHTdY 5OsL1D/ZtwMCNgk9AKuL+KTbMwcPRmM+LZkgrAYS+RJStjMCFntko6Pi6/yObjn2vANF U1E3gZsVM6enF3zoDt+KlJMOb1mfy8WwtESJazjdiOjUJqZlQBz3tJVWH7cM+9Bg6Os7 PCYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=sfRpCvT7oBRLZTNAiKmvU3rA65o0h6TU/+TZtEDfzT4=; b=WN7a+jWlhE2ghszKc/PllT2AZDtDVtUFtv1GD7SWL4aPuaFxB0tdrYHjbbYtxyCif0 AprDTWEdW+MwE/H+DoymCgoCyn5IbfkRIfROrhwJXFAkG9z6XGrNQE17I5Q0LOkLmgXU qWrhANC2gaWuDVPp+q9a5MEmpqeShfMdFGGm0gLk5yWj+tYlA8S7223hSVXFAXW/iGcH zcDA8WqB2sLjGZoNKYBzt/sk9zhDpZO2ciEY/yGJFHVrTF9eNSxHiu452LGYojTPM8mQ aIWUYZLGTeYiarGr51X4d0mwF5Ys3mR8RM8yfzF60IgTJ497ogXp3OmxUkoenV2+NhCn AuCg== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4-v6si1506200pgi.554.2018.10.12.09.10.31; Fri, 12 Oct 2018 09:10:46 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728815AbeJLXnU (ORCPT + 99 others); Fri, 12 Oct 2018 19:43:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21178 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728730AbeJLXnU (ORCPT ); Fri, 12 Oct 2018 19:43:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D11A309D39C; Fri, 12 Oct 2018 16:10:09 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-125-5.rdu2.redhat.com [10.10.125.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 848DA7ADDF; Fri, 12 Oct 2018 16:10:06 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org Cc: Andrew Morton , linux-kernel@vger.kernel.org, =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , 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 , Michal Hocko , Andrea Arcangeli Subject: [PATCH] mm/thp: fix call to mmu_notifier in set_pmd_migration_entry() Date: Fri, 12 Oct 2018 12:09:53 -0400 Message-Id: <20181012160953.5841-1-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 12 Oct 2018 16:10:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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