From patchwork Tue Oct 17 03:10:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 826705 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yGKwh6bDlz9sBZ for ; Tue, 17 Oct 2017 14:11:48 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yGKwh5k0lzDrJV for ; Tue, 17 Oct 2017 14:11:48 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=jglisse@redhat.com; receiver=) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yGKtw57rVzDrD6 for ; Tue, 17 Oct 2017 14:10:16 +1100 (AEDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33CB23DE3C; Tue, 17 Oct 2017 03:10:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 33CB23DE3C Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jglisse@redhat.com Received: from localhost.localdomain.com (ovpn-120-5.rdu2.redhat.com [10.10.120.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id 555335C54E; Tue, 17 Oct 2017 03:10:10 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org Subject: [PATCH 0/2] Optimize mmu_notifier->invalidate_range callback Date: Mon, 16 Oct 2017 23:10:01 -0400 Message-Id: <20171017031003.7481-1-jglisse@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 17 Oct 2017 03:10:14 +0000 (UTC) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrea Arcangeli , Stephen Rothwell , Joerg Roedel , Andrew Donnellan , Alistair Popple , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Suravee Suthikulpanit , Andrew Morton , David Woodhouse Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Jérôme Glisse (Andrew you already have v1 in your queue of patch 1, patch 2 is new, i think you can drop it patch 1 v1 for v2, v2 is bit more conservative and i fixed typos) All this only affect user of invalidate_range callback (at this time CAPI arch/powerpc/platforms/powernv/npu-dma.c, IOMMU ATS/PASID in drivers/iommu/amd_iommu_v2.c|intel-svm.c) This patchset remove useless double call to mmu_notifier->invalidate_range callback wherever it is safe to do so. The first patch just remove useless call and add documentation explaining why it is safe to do so. The second patch go further by introducing mmu_notifier_invalidate_range_only_end() which skip callback to invalidate_range this can be done when clearing a pte, pmd or pud with notification which call invalidate_range right after clearing under the page table lock. It should improve performances but i am lacking hardware and benchmarks which might show an improvement. Maybe folks in cc can help here. Cc: Andrea Arcangeli Cc: Andrew Morton Cc: Joerg Roedel Cc: Suravee Suthikulpanit Cc: David Woodhouse Cc: Alistair Popple Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Stephen Rothwell Cc: Andrew Donnellan Cc: iommu@lists.linux-foundation.org Cc: linuxppc-dev@lists.ozlabs.org Jérôme Glisse (2): mm/mmu_notifier: avoid double notification when it is useless v2 mm/mmu_notifier: avoid call to invalidate_range() in range_end() Documentation/vm/mmu_notifier.txt | 93 +++++++++++++++++++++++++++++++++++++++ fs/dax.c | 9 +++- include/linux/mmu_notifier.h | 20 +++++++-- mm/huge_memory.c | 66 ++++++++++++++++++++++++--- mm/hugetlb.c | 16 +++++-- mm/ksm.c | 15 ++++++- mm/memory.c | 6 ++- mm/migrate.c | 15 +++++-- mm/mmu_notifier.c | 11 ++++- mm/rmap.c | 59 ++++++++++++++++++++++--- 10 files changed, 281 insertions(+), 29 deletions(-) create mode 100644 Documentation/vm/mmu_notifier.txt