Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp673640pxk; Thu, 17 Sep 2020 13:01:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ+BjfGVh/FVALnEZFTvc7f36q/K1YgbkiTz39YkrETiT1PtPQlzezKfyof72zn7/Q09nT X-Received: by 2002:a17:907:213b:: with SMTP id qo27mr31639148ejb.441.1600372914280; Thu, 17 Sep 2020 13:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600372914; cv=none; d=google.com; s=arc-20160816; b=xPdRWDYB+OxRxRHCkQMfXVzvByfBertHtju6xgzBI48C1323zsAutK71u9x9Kc0Cvh ApoyVUAqNWRK2H4hEyCnG27tUvE+SaSUPKkRv1bTtdzCS0Qfxas2ZjcRlyH2Ry6j/yST K9xIfkhbOgfneSoGvbllrN0Cx9/0eoQndNnCzzrMNHrJZ8Nzt8GhIOcCRWG7cru+8MvL OJGHMrGCBzpHF/xBJx9tZ3BCjKLzW2bTcAqfG6fqGOICEyeQQcEZ1zQpjuS0WJW9SaHq OCWZ+YyD0egSvzCgTtJrBUBhwETcDg6CMJqTEG53u8NgWBAvGpK1GsrXUTSqCnvvqNvo IJxw== 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=32bcgpldYXbmLkD9PAPTV/r5I9yvArjUAJrUez/8fCw=; b=bvYTNeqV53MFId1IpoTIJUx1MXwcPVuouQ/fgieuipHYmvlIPzO5WHqysGJgV/kDm8 QlPNQujQbjtpAYPE4pucDwYH+nFrrb8YnMv+wXdLbg+AUO2U/4crV1a0fWBgvfRxPA+1 G/fvnwqHvaEYVc6Q79SiuRfM92ayhxrKR9YnB4UAmsSEUngVDpjZwXiZit7m0AGI6IAy XJsYl1l8nSuO4CvhQh3Imam1izjYj8jhPCy1Ofg8LSt73ZgaP6nTK/pwT9q4E4hJ9dYA Wh3BuBbTCz4RmZesfcP94tDlKrWVp6y7Gws9xkH74HwLFd7n7DiD7hIv+qSFmHl+cifi qBsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=VOlzEfJu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs11si542594edb.90.2020.09.17.13.01.30; Thu, 17 Sep 2020 13:01:54 -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=@linux-foundation.org header.s=google header.b=VOlzEfJu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbgIQT6Z (ORCPT + 99 others); Thu, 17 Sep 2020 15:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726469AbgIQT57 (ORCPT ); Thu, 17 Sep 2020 15:57:59 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7494DC0611C2 for ; Thu, 17 Sep 2020 12:52:09 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id z19so3529986lfr.4 for ; Thu, 17 Sep 2020 12:52:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=32bcgpldYXbmLkD9PAPTV/r5I9yvArjUAJrUez/8fCw=; b=VOlzEfJuZB9Z+OwJNOchIJXDkd0bTa9i+wPMaYSxT6D0dAH/K7Ga73jt3/YtjGTVK4 sVlY9P9deW7WIX2Nd152ey3/qPcCEHpblJw+UwDlDNRH2yhqCE0SHAuB/jZEQ2s1KDp6 q34MhREhlKcWU3KC+0AmTV4BHtmSJ7oVUjShk= 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=32bcgpldYXbmLkD9PAPTV/r5I9yvArjUAJrUez/8fCw=; b=bcqsVUDeucNcg4i4g/M3cVB1Q0V2Fwj8nTgi2Fi0APLbrWJ7Ru50ys99kJh1aolKOW Qt8UX79acUNP4mmtemIl+Xde0qJQMj2Ks5XE4sY+gYNa66Xhdhlc1Mc3nEWtq9uV42Y8 cQ/rItdlEqT+OOk8zKGc5mO440xuen3QmqksOQdHRNobEwoosi/UR/QykGXW+q4gbX5r xopXGvXjS19ds9+seAjjmw3U7Rr3p/tRPRf0Ya6RX5OtUwMyWi00dHMZbDvfgGGcrU43 59YwcpesMHNdawXaRw5c30vu42vAegAFlxXJ4ZHzQ/pea/WfQTZtw4Uf/b6J6+GnDCBI 09BA== X-Gm-Message-State: AOAM533uqLYBPitmQBiJRWgNWBzFHZEvCSsGvXY41IX8hX/pUgqPuvg3 r5qGFJCQ7QsvR675VJjOkFIdeb9zp6ttyg== X-Received: by 2002:a19:4284:: with SMTP id p126mr9217957lfa.393.1600372327219; Thu, 17 Sep 2020 12:52:07 -0700 (PDT) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id f2sm105525lfd.103.2020.09.17.12.52.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Sep 2020 12:52:06 -0700 (PDT) Received: by mail-lf1-f44.google.com with SMTP id y11so3521817lfl.5 for ; Thu, 17 Sep 2020 12:52:06 -0700 (PDT) X-Received: by 2002:a19:4186:: with SMTP id o128mr9365158lfa.148.1600372325687; Thu, 17 Sep 2020 12:52:05 -0700 (PDT) MIME-Version: 1.0 References: <20200915182933.GM1221970@ziepe.ca> <20200915191346.GD2949@xz-x1> <20200915193838.GN1221970@ziepe.ca> <20200915213330.GE2949@xz-x1> <20200915232238.GO1221970@ziepe.ca> <20200916174804.GC8409@ziepe.ca> <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917193824.GL8409@ziepe.ca> In-Reply-To: <20200917193824.GL8409@ziepe.ca> From: Linus Torvalds Date: Thu, 17 Sep 2020 12:51:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification To: Jason Gunthorpe Cc: Peter Xu , John Hubbard , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 12:38 PM Jason Gunthorpe wrote: > > Looking for awhile, this now looks reasonable and > doable. page_maybe_dma_pinned() was created for exactly this kind of > case. > > I've attached a dumb sketch for the pte level (surely wrong! I have > never looked at this part of the mm before!) at the end of this > message. This looks conceptually fine to me. But as mentioned, I think I'd be even happier if we added a "thsi vma has seen a page pin event" flag to the vma flags, and didn't rely _just_ on the page_maybe_dma_pinned() check, which migth be triggered by those fork-happy loads. Side note: I wonder if that COW mapping check could be entirely within that vm_normal_page() path. Because how could a non-normal page be a COW page and not already write-protected? But that's a separate issue, it's just how your patch makes that odd case more obvious. Linus