Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4670572pxy; Tue, 27 Apr 2021 10:00:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfLWa5AGj8iegG8rU5paHM4zWSO0wQK5/hm+CMl2/0VafJZh00Z1TM4T4cvCIpl6sf2fcE X-Received: by 2002:a63:790a:: with SMTP id u10mr23139993pgc.407.1619542816714; Tue, 27 Apr 2021 10:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619542816; cv=none; d=google.com; s=arc-20160816; b=huMgrKyJmww3hm7spuVh4RW0rp+ytnZvMg21sUS6Ip8wZ1zuNysPQOpbIyPC2O0JAo 8lfZfdMmOZMnHUabvpQtrb2oN4IhF5aKPHGAU/6S6pGtpwhlDml/RzUHwKQk16+wgmaV xBevnUbDTySYxMGUI2sbCKaBDLl7ond1lidC4fNrLeeAkBcOBWpx/MDdAK0cBRyfPbJD indU9FfA+77F/w76IVnxvvnISeXZ2af2qaGjHUU27kZErAl8Ibklc18v/4PxjHxQqsul OYh5pZxG8P3EQ9NBggT4wvUmu0lQx0ODNbIU6/hdqK4HxstnYeGmYFo/na1Vibzy+qtI sFtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AfWvlXdic+4MOs0KOPuGPjE9kmD8XQr/sjmlrkTPLaI=; b=N62ZjQdJp8VXwc2MNsNgXfXu6DUptc0VMB+FYX+2qrh3dALjhWtYhKWfyvoeTFG4Pn LePi+bQcdcesLwYw4hkFLwgMHQGT4tnp8jtDS1uC2vec3FEGhVOXo/+T8X5a/sbWiFlT A0fbjFUm+qIMnIEcos+XgT8UVp2mR6GUptDHhJQpDx4lxnT/IHG3cxBa5uCr6vdZ71Iq QE5Eh+IlcHRGdnfeRtE4X3MckHrBVzza0ytsTTOyG5vayG79vBe4h8GRKN8QNnWBaKJf gcuvvUicKxuT8Qqrq1rEYJzpNpXOXCRS1d/bDLBaDLCwqbVb9LQm0EuQMrYIxtf4tiaI RjGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=V8ZOgRJc; 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 q11si427471pgr.107.2021.04.27.10.00.04; Tue, 27 Apr 2021 10:00:16 -0700 (PDT) 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=V8ZOgRJc; 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 S238170AbhD0Q7B (ORCPT + 99 others); Tue, 27 Apr 2021 12:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238134AbhD0Q6g (ORCPT ); Tue, 27 Apr 2021 12:58:36 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC57C061761 for ; Tue, 27 Apr 2021 09:57:52 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id c3so3902099ils.5 for ; Tue, 27 Apr 2021 09:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AfWvlXdic+4MOs0KOPuGPjE9kmD8XQr/sjmlrkTPLaI=; b=V8ZOgRJcn6Dtqzn/dNTeT1u9mccvCFMWItwlB2UU5IVebFRpf/CJ71oNx7sVg0gTxn D5QqGQXHstJUFYUStJ6czBmZ5CVbVKd68zvdjnQN0+nn6k8spWRQg3ZN7hButLBVmrkd P1MDMudaGLf3+9zuwY8ZNeRQKEyHpqW3V3aCC0uIRCK/1HCaAzUuTyKbou4oHr50bPfa YPzAtJHZwnrp7epFgbmMoOkqVtlH4iiovgBMyUhDoYOdMTUgzCSkjgSkc05mSJZLjATs GXnDvOYHzpyTJUrMKD0nW67S6wLNYpiHRMkDClN/cndD1/qRlKFgvyLf7CYSGi8lGL66 jzVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AfWvlXdic+4MOs0KOPuGPjE9kmD8XQr/sjmlrkTPLaI=; b=YU6Q67T17p2c9M7fWy1HR+y+aEI0OPWiK2cF25+7mKYDUgE5xM05+BItEiQyE6iQ+c zeOuccog8yhgLoTRYX6lDPpt6IxkXfnlRvpLz4hLwPS0IKlynadfMGdqDUc3TMZXV9Mb PVOKLF2EQQDzZRLOYwOurA5Dl3DtuKleo69YoQcm9D01QnNf3FQK9RBdoMmdCDoYOax8 PPR8qnI7ryCjK1/0lpgYJIOHbUaihAtfX/ouf0gWXyI56T8cHPZySg/ilfPi0Q0AdDb/ QdP9m/dtq1Km8p07JPyF6jZtmnpLsVAt+axH2K7a2yWT3qvcUbHcWazazgK+f6DfBuFm T+cQ== X-Gm-Message-State: AOAM532btRilIHM4P8l+c1nhfx066NIqZolK3qxrVri1Na+AZ8SJGdFy TZhHkLLTEzh3JPL9YzKL9cEfeUPQUnQz6SXcVT+tyA== X-Received: by 2002:a05:6e02:1d06:: with SMTP id i6mr19319768ila.165.1619542671555; Tue, 27 Apr 2021 09:57:51 -0700 (PDT) MIME-Version: 1.0 References: <20210420220804.486803-1-axelrasmussen@google.com> <20210420220804.486803-4-axelrasmussen@google.com> <20210427155414.GB6820@xz-x1> In-Reply-To: <20210427155414.GB6820@xz-x1> From: Axel Rasmussen Date: Tue, 27 Apr 2021 09:57:16 -0700 Message-ID: Subject: Re: [PATCH v4 03/10] userfaultfd/shmem: support UFFDIO_CONTINUE for shmem To: Peter Xu Cc: Hugh Dickins , Alexander Viro , Andrea Arcangeli , Andrew Morton , Jerome Glisse , Joe Perches , Lokesh Gidra , Mike Kravetz , Mike Rapoport , Shaohua Li , Shuah Khan , Stephen Rothwell , Wang Qing , linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, LKML , linux-kselftest@vger.kernel.org, Linux MM , Brian Geffon , "Dr . David Alan Gilbert" , Mina Almasry , Oliver Upton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'd prefer to keep them separate, as they are not tiny patches (they are roughly +200/-150 each). And, they really are quite independent - at least in the sense that I can reorder them via rebase with no conflicts, and the code builds at each commit in either orientation. I think this implies they're easier to review separately, rather than squashed. I don't have a strong feeling about the order. I slightly prefer swapping them compared to this v4 series: first introduce minor faults, then introduce CONTINUE. Since Peter also has no strong opinion, and Hugh it sounds like you prefer it the other way around, I'll swap them as we had in some previous version of this series: first introduce minor faults, then introduce CONTINUE. On Tue, Apr 27, 2021 at 8:54 AM Peter Xu wrote: > > On Mon, Apr 26, 2021 at 07:19:58PM -0700, Hugh Dickins wrote: > > On Tue, 20 Apr 2021, Axel Rasmussen wrote: > > > > > With this change, userspace can resolve a minor fault within a > > > shmem-backed area with a UFFDIO_CONTINUE ioctl. The semantics for this > > > match those for hugetlbfs - we look up the existing page in the page > > > cache, and install a PTE for it. > > > > > > This commit introduces a new helper: mcopy_atomic_install_pte. > > > > > > Why handle UFFDIO_CONTINUE for shmem in mm/userfaultfd.c, instead of in > > > shmem.c? The existing userfault implementation only relies on shmem.c > > > for VM_SHARED VMAs. However, minor fault handling / CONTINUE work just > > > fine for !VM_SHARED VMAs as well. We'd prefer to handle CONTINUE for > > > shmem in one place, regardless of shared/private (to reduce code > > > duplication). > > > > > > Why add a new mcopy_atomic_install_pte helper? A problem we have with > > > continue is that shmem_mcopy_atomic_pte() and mcopy_atomic_pte() are > > > *close* to what we want, but not exactly. We do want to setup the PTEs > > > in a CONTINUE operation, but we don't want to e.g. allocate a new page, > > > charge it (e.g. to the shmem inode), manipulate various flags, etc. Also > > > we have the problem stated above: shmem_mcopy_atomic_pte() and > > > mcopy_atomic_pte() both handle one-half of the problem (shared / > > > private) continue cares about. So, introduce mcontinue_atomic_pte(), to > > > handle all of the shmem continue cases. Introduce the helper so it > > > doesn't duplicate code with mcopy_atomic_pte(). > > > > > > In a future commit, shmem_mcopy_atomic_pte() will also be modified to > > > use this new helper. However, since this is a bigger refactor, it seems > > > most clear to do it as a separate change. > > > > > > Signed-off-by: Axel Rasmussen > > > > If this "03/10" had been numbered 04/10, I would have said > > Acked-by: Hugh Dickins > > > > But I find this new ordering incomprehensible - I'm surprised that it > > even builds this way around (if it does): this patch is so much about > > what has been enabled in "04/10" (references to UFFDIO_CONTINUE shmem > > VMAs etc). > > > > Does Peter still think this way round is better? If he does, then we > > shall have to compromise by asking you just to squash the two together. > > Hi, Hugh, Axel, > > I have no strong opinion. To me, UFFDIO_CONTINUE can be introduced earlier like > this. As long as we don't enable the feature (which is done in the next patch), > no one will be able to call it, then it looks clean. Merging them also looks > good to me. > > Thanks, > > -- > Peter Xu >