From patchwork Thu Feb 25 02:14:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Rasmussen X-Patchwork-Id: 12103105 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=-21.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 3E165C433DB for ; Thu, 25 Feb 2021 02:15:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA6F964ECB for ; Thu, 25 Feb 2021 02:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235206AbhBYCPW (ORCPT ); Wed, 24 Feb 2021 21:15:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234637AbhBYCPW (ORCPT ); Wed, 24 Feb 2021 21:15:22 -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 6EFC9C06174A for ; Wed, 24 Feb 2021 18:14:41 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id d8so4431904ybs.11 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=ceQm4d/PfJiRwEarBsrzGjB3XJUv7FdMHIaWVaspw+eHfBufschJit7+b2PJ+cRiQm rJVVTtFBkZ5eIyqNrIMiBfq33z78jx5ZTN/hGyRxo40X4eKpBzHiCQ8hhivMbpy1wXWH JCMI+PbFwfNOSqiZVgtocIz0BmT4OiencbrE/a4G3Xa8OYvapdEGZz6ipRj6WB/IF2Ap dDUV+VSW8cMA6l9u+UZbJTicPoScmJK3j3dzqI/A7rFGe7lg3pZLQYlGGMrSSclj5dQ3 EMgxNqAfBkkM/ojmhpj3pdchCngI42waoI91hM6LwK2qHiETGociQqhhi2oDguz+AGUM Xo8w== X-Gm-Message-State: AOAM530+8dvR39N1u0VA5Lj0mwUeyHpGSXCMGLeI5CODpsKeLpjXkvBZ 5m3zNdNtd+hCs1UxmAsICVEvNmE3uVPBA4LwUG0n X-Google-Smtp-Source: ABdhPJw98ig0Yji2QsABXFSreCF+ogXsubw5CFDtC6GaaoOwFYEUFPOQp0YULt8aO2A/kWa9cWqMeli63FZEp52R2m/7 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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