From patchwork Wed Feb 17 16:30:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 12091893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CE03C433E0 for ; Wed, 17 Feb 2021 16:31:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3C63C64E02 for ; Wed, 17 Feb 2021 16:31:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C63C64E02 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C54DE6B006C; Wed, 17 Feb 2021 11:31:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C00EE6B006E; Wed, 17 Feb 2021 11:31:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA2306B0070; Wed, 17 Feb 2021 11:31:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 92BD26B006C for ; Wed, 17 Feb 2021 11:31:21 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 56F48824934B for ; Wed, 17 Feb 2021 16:31:21 +0000 (UTC) X-FDA: 77828299962.08.limit52_230de152764d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 3A4A6181A04F0 for ; Wed, 17 Feb 2021 16:31:09 +0000 (UTC) X-HE-Tag: limit52_230de152764d X-Filterd-Recvd-Size: 5358 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Feb 2021 16:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613579467; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=P9cZKUnEuKcVQzzvsvOuAQA8Ku1k2Rw4qjxP9l7RO+o=; b=PcobFEqlg5d8tqFK8SGrGYLRPTVdorIOpqp7TTCEgRw2w/B/GN6efHqERxLiJXHQ+DN2fi nL7qfKOrdaqtjpTjkVrUlwAF/PCsg0N2MC28EWy+Y0MxNRoZityUUspkPo2Qyo1JCw2g3R jWDa4AbBR+pT2tsw7NJOm05DADCchlk= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-1p0gOp6pM66r1hSkZhXEqA-1; Wed, 17 Feb 2021 11:31:04 -0500 X-MC-Unique: 1p0gOp6pM66r1hSkZhXEqA-1 Received: by mail-qt1-f200.google.com with SMTP id i19so5622282qtx.6 for ; Wed, 17 Feb 2021 08:31:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8AAWQzQ4/CdL2KkeRSZXE51wd9zmuk6qWVztCiHi//g=; b=CZcu7qRqAb5DlrDUkxkydg02opkZxHNMUXMxD73gzmeup1mgv5ET4zyoI2+nYtnQbT fycTe2N36VsTrZ4zQR55/7XxyXAOx+rOkAPXsbDERR6ti7qTlCYC/eZbHI2zMoXGVpY2 2cSjOa19gZ+EiBwB5n6f7FmAd7m6mPjMe4FK1RkllWAT+BXd4I3sjucXx87/tiRT48Gk Y4QdqBMWbNFywBow7nOmS47e3S4/p9uJF0HwdXDmtK+qjBsJC8fSgPGe8SFXZfHPA/34 ppL3dO+OV+piPBJiZcaJv/CDpHH+lraBqw9VLv4ipUqO9M7+VwJD94gXnjNuvb65udT3 DOjQ== X-Gm-Message-State: AOAM533itq37/6hrkiJV+8ikY7QHBpPZyklYyT1vF0aBgga3MUpsc3rY Oe6gHHNIgRFH5qeiBgA0J/P+FbxDXacxXIDOpC7sw1++2gEWswzSR6obuN9r9WAFr50G3iQP5mw pVh2Hhq+wAVI= X-Received: by 2002:a0c:dc8e:: with SMTP id n14mr34551qvk.6.1613579464214; Wed, 17 Feb 2021 08:31:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY+ynxFfjY7nkB88CerCDQdVqSoB87GQyX3clxID0Vtz7rAhk7euXUgwNUQMp5UuJaLnvT0g== X-Received: by 2002:a0c:dc8e:: with SMTP id n14mr34530qvk.6.1613579464005; Wed, 17 Feb 2021 08:31:04 -0800 (PST) Received: from xz-x1.redhat.com (bras-vprn-toroon474qw-lp130-20-174-93-89-182.dsl.bell.ca. [174.93.89.182]) by smtp.gmail.com with ESMTPSA id z37sm399902qth.87.2021.02.17.08.31.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 08:31:03 -0800 (PST) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Axel Rasmussen , Andrew Morton , Matthew Wilcox , Mike Rapoport , "Kirill A . Shutemov" , Andrea Arcangeli , Mike Kravetz Subject: [PATCH 0/4] hugetlb: Disable huge pmd unshare for uffd-wp Date: Wed, 17 Feb 2021 11:30:58 -0500 Message-Id: <20210217163102.13436-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: This series tries to disable huge pmd unshare of hugetlbfs backed memory for uffd-wp. Although uffd-wp of hugetlbfs is still during rfc stage, the idea of this series may be needed for multiple tasks (Axel's uffd minor fault series, and Mike's soft dirty series), so I picked it out from the larger series. References works: Uffd shmem+hugetlbfs rfc: https://lore.kernel.org/lkml/20210115170907.24498-1-peterx@redhat.com/ Uffd minor mode for hugetlbfs: https://lore.kernel.org/lkml/20210212215403.3457686-1-axelrasmussen@google.com/ Soft dirty for hugetlbfs: https://lore.kernel.org/lkml/20210211000322.159437-1-mike.kravetz@oracle.com/ Please review, thanks. Peter Xu (4): hugetlb: Pass vma into huge_pte_alloc() and huge_pmd_share() hugetlb/userfaultfd: Forbid huge pmd sharing when uffd enabled mm/hugetlb: Move flush_hugetlb_tlb_range() into hugetlb.h hugetlb/userfaultfd: Unshare all pmds for hugetlbfs when register wp arch/arm64/mm/hugetlbpage.c | 7 ++--- arch/ia64/mm/hugetlbpage.c | 3 +- arch/mips/mm/hugetlbpage.c | 4 +-- arch/parisc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/hugetlbpage.c | 3 +- arch/s390/mm/hugetlbpage.c | 2 +- arch/sh/mm/hugetlbpage.c | 2 +- arch/sparc/mm/hugetlbpage.c | 1 + fs/userfaultfd.c | 57 +++++++++++++++++++++++++++++++++++ include/linux/hugetlb.h | 15 +++++++-- include/linux/userfaultfd_k.h | 9 ++++++ mm/hugetlb.c | 43 +++++++++++++------------- mm/userfaultfd.c | 2 +- 13 files changed, 115 insertions(+), 35 deletions(-)