Message ID | 20181205053628.3210-1-jglisse@redhat.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E963F13BF for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 5 Dec 2018 05:37:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D400026E7B for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 5 Dec 2018 05:37:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C36F82A4D3; Wed, 5 Dec 2018 05:37:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AB7826E7B for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 5 Dec 2018 05:37:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4684D6B72B4; Wed, 5 Dec 2018 00:37:03 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 418396B72B5; Wed, 5 Dec 2018 00:37:03 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32F756B72B6; Wed, 5 Dec 2018 00:37:03 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 0A9AF6B72B4 for <linux-mm@kvack.org>; Wed, 5 Dec 2018 00:37:03 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id w185so19162934qka.9 for <linux-mm@kvack.org>; Tue, 04 Dec 2018 21:37:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=TRwmn4DetRDB6wdMD+5kUeCfFYSbePoIhsWVrpkWzXE=; b=VcbC5SgALzvooG3VCyi2YsMNLumBEdxvykzMnUnC9WmGco68AYTjDURauvaYQRk+RD P1tJcGOBiwq5cdir9eqAu+7Cg9fcFjIjPiINrmqcAEv7V0rV1OcF3hlr2jZ4YteTErw/ 6g2LBCd1zg7Nngb9Q6lNyHdwcj0dSDEMULe1jIIaoDKB4Lie9V9S4lMUgy0pUJLHGYQ4 hC8lRSw/eu1ioZjkAWnXEdFxpo289WSgaC40wnsDsY4kUDVap4BcRmV/cM+Ifx3W82rw VIyZdfouZrpjtRxurx77PDiEUSEaIQ/3MK8h9RtFpw/yTwH/KFfThcS8eAqxLDK/2eEE EPNg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AA+aEWYKzpSmdnibqKw0pe4X/8RVA5wC3+GUTpgo1pbkNqbd7GWY6jlq IaG85ksEkWjX8mffmOMb8vT7JXg18PkBTljEkETELWwhD5ZalCY5HXyqmLf2VYXwhwo3ATgoJoq VQqx9r+QntH20solU99YMVSnImUT12WrgSg5azeO7No1ADR8UD2WzxVTQFj9d71w+tA== X-Received: by 2002:a37:112a:: with SMTP id b42mr21649738qkh.136.1543988222785; Tue, 04 Dec 2018 21:37:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/WV9q+fMtZYszg/hkECScxG5i7R9kixudPrONCF0+s683cjFBwOunA2pP+ICtU/8g3BsZxr X-Received: by 2002:a37:112a:: with SMTP id b42mr21649713qkh.136.1543988222056; Tue, 04 Dec 2018 21:37:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543988222; cv=none; d=google.com; s=arc-20160816; b=jczaKmA1W5Ad2arDU9FRMgAHuVAX+Or2fx3HSrsM7SKxi+p1gjtAtYqFFJUvw7yPep wiIRtHq/FRlZrtOzvX7ZX3e7Z/LUvyilvxjS6sTCwyVEPhRi4a35B3ZjAzVo7kqbLCr+ Btxg/ONA9CNJbgUfpXf0WciCKBsCmAAMrK+VrjjoAmLOfdf7Cv+bPzzl5RZMnCWW9Hkz u68Aztv3IDwvaSxax/ZB/jpo81AnYisIhWQ7H72SSHiZkRlFLkGXniPtciara2M7HMmL ixWqKaWSIa5D3Mr3G7759WEQcis51tXrs9y/wHiUf0YtEkfBn3uRBaHhk2SHsDneC9ZI YGMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=TRwmn4DetRDB6wdMD+5kUeCfFYSbePoIhsWVrpkWzXE=; b=a4UTRMBMDvvWkOcKQbz60uIX8OsHaf0n0cBTqnHUfGBXa9qX5s7NE9e003esFe1gHY XuAav5hbeuezvpFM23EIwhhNS79y5D4+qAet3pvgUzLLsv98eEJ6ygiRnYqEpgR1b3fh PIpMNlc2Wh7GMUdOfqvqW1gMKgbz8ZPV+GNGgLu+6oFMaeQz9skfe+AvRd3FETc4n6wB 7wwcplhHkF7JmFhNW7ns726kwc8uIV5Ra9rS966d74C5yFZd1ONjLOgAGeC4lERQz/HQ Obe/0lUbaWpi9m8S0FtHHhd0gfBP53/9CO/03f2zSI05NYCmTWMXpX1EWx4YTvZGFFdn DbgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id x83si125211qka.105.2018.12.04.21.37.01 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Dec 2018 21:37:02 -0800 (PST) Received-SPF: pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jglisse@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jglisse@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 40D9930820EA; Wed, 5 Dec 2018 05:37:01 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-80.rdu2.redhat.com [10.10.120.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id C730A5C57E; Wed, 5 Dec 2018 05:36:58 +0000 (UTC) From: jglisse@redhat.com To: linux-mm@kvack.org Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= <jglisse@redhat.com> Subject: [PATCH v2 0/3] mmu notifier contextual informations Date: Wed, 5 Dec 2018 00:36:25 -0500 Message-Id: <20181205053628.3210-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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 05 Dec 2018 05:37:01 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series | mmu notifier contextual informations | expand |
From: Jérôme Glisse <jglisse@redhat.com> Changes since v1: - Fixed the case where mmu notifier is not enabled and avoid wasting memory and resource when that is the case. - Fixed bug in migrate code. - Use kernel doc format for describing kernel enum v1 cover letter: This patchset add contextual information, why an invalidation is happening, to mmu notifier callback. This is necessary for user of mmu notifier that wish to maintains their own data structure without having to add new fields to struct vm_area_struct (vma). For instance device can have they own page table that mirror the process address space. When a vma is unmap (munmap() syscall) the device driver can free the device page table for the range. Today we do not have any information on why a mmu notifier call back is happening and thus device driver have to assume that it is always an munmap(). This is inefficient at it means that it needs to re-allocate device page table on next page fault and rebuild the whole device driver data structure for the range. Other use case beside munmap() also exist, for instance it is pointless for device driver to invalidate the device page table when the invalidation is for the soft dirtyness tracking. Or device driver can optimize away mprotect() that change the page table permission access for the range. This patchset enable all this optimizations for device driver. I do not include any of those in this serie but other patchset i am posting will leverage this. From code point of view the patchset is pretty simple, the first two patches consolidate all mmu notifier arguments into a struct so that it is easier to add/change arguments. The last patch adds the contextual information (munmap, protection, soft dirty, clear, ...). Cheers, Jérôme Jérôme Glisse (3): mm/mmu_notifier: use structure for invalidate_range_start/end callback mm/mmu_notifier: use structure for invalidate_range_start/end calls v2 mm/mmu_notifier: contextual information for event triggering invalidation v2 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 43 ++++---- drivers/gpu/drm/i915/i915_gem_userptr.c | 14 ++- drivers/gpu/drm/radeon/radeon_mn.c | 16 ++- drivers/infiniband/core/umem_odp.c | 20 ++-- drivers/infiniband/hw/hfi1/mmu_rb.c | 13 +-- drivers/misc/mic/scif/scif_dma.c | 11 +- drivers/misc/sgi-gru/grutlbpurge.c | 14 ++- drivers/xen/gntdev.c | 12 +-- fs/dax.c | 15 ++- fs/proc/task_mmu.c | 8 +- include/linux/mm.h | 4 +- include/linux/mmu_notifier.h | 132 ++++++++++++++++++------ kernel/events/uprobes.c | 11 +- mm/hmm.c | 23 ++--- mm/huge_memory.c | 58 +++++------ mm/hugetlb.c | 54 +++++----- mm/khugepaged.c | 11 +- mm/ksm.c | 23 ++--- mm/madvise.c | 22 ++-- mm/memory.c | 103 +++++++++--------- mm/migrate.c | 26 ++--- mm/mmu_notifier.c | 22 ++-- mm/mprotect.c | 16 +-- mm/mremap.c | 11 +- mm/oom_kill.c | 17 +-- mm/rmap.c | 32 +++--- virt/kvm/kvm_main.c | 14 +-- 27 files changed, 404 insertions(+), 341 deletions(-)