Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp160451pxb; Wed, 24 Feb 2021 22:03:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp1Bnsz4ndj3+IwhLN1DgqRxyPg5/+GNTB7/u6QmZkKuz6izdqhMYO9+ALD0yrTLxbz157 X-Received: by 2002:a17:906:f119:: with SMTP id gv25mr1100283ejb.293.1614232991610; Wed, 24 Feb 2021 22:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614232991; cv=none; d=google.com; s=arc-20160816; b=UMII2bdJSxSaUinEt+l/wa/+O1T9KEKf/BJ7O543jBXSBPPtmUeRdeyE95rgvJB9HO 59O2Kd1GL8voOhRM/NOu2d2j6b4wPSMGwft+139V+dIsK8MwWLQ75CNf1OTRE0hEMQX4 JLboBKJxkSGnF7eRNkrddug9dhiZTm4ILsAUvrZ7ItEjm0+/kswWY+2LNKQRm6h+CZVn 63UgO+GDBlcba2HNb5bIvgf/0E4weAAtSXFHah68RHosNttVANi58GRQpPkxCbpycbgR GZuKwdKeC4d9mx9jtSxQ8RtX4wLVfxeyNLLoQSbadCJwihLdrPE+CU2Yjh8rKu8oRi6Z 7GUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=d7qjpU8XKEfBqlMiCyPh8nFPbvWh1eJ63+H3QFuie5Y=; b=dRUFhfE51m8wuQiKUUZtfAOqmvPSnltq4wtKhp9HH5j0o3EjzCjNw10/VLpPe2cs3y HGNTJLB6uYU/yiMgi4IAs3LHVfgA1wVvBmSSbfrmsRgLLQXNH+t2sw2pDCkPNovqLt7h DPJ4g8MZpkH+dgYxj9YkJRy8ykCAvRa5BtnSQV8Fi3tCuWnC4iChs7Kwt663wOI52nFG 2rt1f1l22W6Lva5glVRyLfMvkRnfun119Q8WIY9V97FY9z/pC2hALW9HA0b1hP70L35W dwJrT5NCZGRgau8mY3sQ3Pe+UADPR2GpKqrHvF3FD6EqFk7fh66mEc8MBFHnBdF2MoFn lbkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UMLqTstx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si2841357edi.63.2021.02.24.22.02.43; Wed, 24 Feb 2021 22:03:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UMLqTstx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235527AbhBYCPf (ORCPT + 99 others); Wed, 24 Feb 2021 21:15:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234637AbhBYCP1 (ORCPT ); Wed, 24 Feb 2021 21:15:27 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69432C061574 for ; Wed, 24 Feb 2021 18:14:41 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id v62so4389413ybb.15 for ; Wed, 24 Feb 2021 18:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=d7qjpU8XKEfBqlMiCyPh8nFPbvWh1eJ63+H3QFuie5Y=; b=UMLqTstxNUBx26sg6GLN6yLQPAjd2tgC7PtHCBbHKD4iSU1KIibkTuyxM4iqtkGaCg Ir5emR92f/9DRcZXi+gQ01lXg0qFQy1IjrPYgogIJyIzp/E/dzz+RuR4G4xHh4rpFSjE KxRt4gnRJ0ElbEoeuEI1i3RJ0Svq53VVxRgipBXKZ7oUcdEIDkZjEmqnhG9Z4/by8xpb uhmiPiMYSHUi2h34aYQdi73+ZbPCms3CJAaw/DEiQB5utN3e7pP0npwWSMuGcu0Q1DRK IL8TaM0PNMCbmKdnu6yJ9/5IVHqXEzbuNYDLaEagmMRZl+VZ3N6UNqlAJRaP1ZOfpxl3 RCPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=d7qjpU8XKEfBqlMiCyPh8nFPbvWh1eJ63+H3QFuie5Y=; b=eGgy3CuApF17Y3mylUEvL4ua3e2Q4G1Q6X71khbEJuJTPjqzzcr+X8ghNlP2iobDEP teddL7GfcfkSkHxsqLvcE1VEcfKVWZsmOoXWWIuN9OPPmVPWIA11b1iKnBuMBczxcNrN m9G6l4O3YiU2IR7LTtJJqUPXnOvwhAVGAUREGjf6N82cCwh4l+3toNvoUMDWbj/Jr5Or P7Ou1NV1Uk8BSOA3xs2FeO8KC+cW8RMf+dcjhSxyHjMA4YJBIkW/bTa8spvc1MHm9mmT QldA4r3HZ6sHPzk93AHbH8dSzhmLyeve8ldFT0MH/RKaVukkoGfFraV1CFisOuQ75HBL ahIA== X-Gm-Message-State: AOAM530zBc+LKrzfz2syrTOaI/jb35YSlnYl4xR3w7H9XxvAG1JqGKaZ OKrhWqF0L4mQDcVjmIhJ84r/zgVhAdEEzgEEKaaH Sender: "axelrasmussen via sendgmr" X-Received: from ajr0.svl.corp.google.com ([2620:15c:2cd:203:a5fd:f848:2fdf:4651]) (user=axelrasmussen job=sendgmr) by 2002:a25:8112:: with SMTP id o18mr902059ybk.208.1614219280483; Wed, 24 Feb 2021 18:14:40 -0800 (PST) Date: Wed, 24 Feb 2021 18:14:15 -0800 Message-Id: <20210225021420.2290912-1-axelrasmussen@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog Subject: [PATCH 0/5] userfaultfd: support minor fault handling for shmem From: Axel Rasmussen To: Alexander Viro , Andrea Arcangeli , Andrew Morton , Hugh Dickins , Jerome Glisse , Joe Perches , Lokesh Gidra , Mike Rapoport , Peter Xu , Shaohua Li , Shuah Khan , Wang Qing Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Axel Rasmussen , Cannon Matthews , "Dr . David Alan Gilbert" , David Rientjes , Michel Lespinasse , Mina Almasry , Oliver Upton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Base ==== This series is based on top of my series which adds minor fault handling for hugetlbfs [1]. (And, therefore, it is based on linux-next/akpm and Peter Xu's series for disabling huge pmd sharing as well.) [1] https://lore.kernel.org/patchwork/cover/1384095/ Overview ======== See my original series linked above for a detailed overview of minor fault handling in general. The feature in this series works exactly like the hugetblfs version (from userspace's perspective). I'm sending this as a separate series because: - The original minor fault handling series has been through several rounds of review and seems close to being merged, so it seems reasonable to start looking at this next step. - shmem is different enough that this series may require some additional work before it's ready, and I don't want to delay the original series unnecessarily by bundling them together. Use Case ======== In some cases it is useful to have VM memory backed by tmpfs instead of hugetlbfs. So, this feature will be used to support the same VM live migration use case described in my original series. Additionally, Android folks (Lokesh Gidra ) hope to optimize the Android JVM garbage collector using this feature (a paper describing a somewhat similar approach: https://arxiv.org/pdf/1902.04738.pdf). Axel Rasmussen (5): userfaultfd: support minor fault handling for shmem userfaultfd/selftests: use memfd_create for shmem test type userfaultfd/selftests: create alias mappings in the shmem test userfaultfd/selftests: reinitialize test context in each test userfaultfd/selftests: exercise minor fault handling shmem support fs/userfaultfd.c | 6 +- include/linux/shmem_fs.h | 26 +- include/uapi/linux/userfaultfd.h | 4 +- mm/memory.c | 8 +- mm/shmem.c | 88 +++---- mm/userfaultfd.c | 27 +- tools/testing/selftests/vm/userfaultfd.c | 322 +++++++++++++++-------- 7 files changed, 293 insertions(+), 188 deletions(-) -- 2.30.0.617.g56c4b15f3c-goog