From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 22FF8C43461 for ; Thu, 17 Sep 2020 19:52:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76C9F235F7 for ; Thu, 17 Sep 2020 19:52:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="VOlzEfJu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76C9F235F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C4C306B0037; Thu, 17 Sep 2020 15:52:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BFCC76B0055; Thu, 17 Sep 2020 15:52:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AEBCA6B005C; Thu, 17 Sep 2020 15:52:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id 96F886B0037 for ; Thu, 17 Sep 2020 15:52:10 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 50AE23638 for ; Thu, 17 Sep 2020 19:52:10 +0000 (UTC) X-FDA: 77273599620.06.flag85_3900d3527125 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 01185100E1C1E for ; Thu, 17 Sep 2020 19:52:09 +0000 (UTC) X-HE-Tag: flag85_3900d3527125 X-Filterd-Recvd-Size: 4925 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 19:52:09 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id q8so3517708lfb.6 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=UrYoSuzt7199kPOigDhtZRWKTyL+10href+2QPxgVX4AU6pHPfV3WLkxEh3PaoIEU8 22IgodbH8hYBik8AKkOfT1jwy2pTf/RTfSMAkfYaFf4V1JiAZwY/khvOgDdFd3/zo7n9 20Na7kGjHkezrWqSTknkItFJQYgPocqpiSVTESVYhwM4wbNKSH3qPwaI7Wa3JxuEzWMk 6YUC5XJD/CmUTCsD7aOgROEV0E9HcPs2xJ5JHJ0dkylwtJq4r1Sz7Ch9Y0Q5sBa+NZZH LD0KNPAnrZCMJZkDzglYkmSVMDKt1LFgCpvvuapLbG9xUQocCqI1YVKxuAsbgQoeJRk0 LzlQ== X-Gm-Message-State: AOAM532pBvVpx8ugjaA9o/4kfkyqi4Ri5gMy6Wb/bO1eoKQSLHcDkHN2 PkmZccjm0EtoEjyo4h0BlBlBT0wrlrgnqQ== X-Google-Smtp-Source: ABdhPJyC1eOm/bQ41S1L1LbkRO14b6vAiAE+gtoWQQFav56Y30LSe7Ntl/xWjYq1oHCvkxKPPIcZGQ== X-Received: by 2002:ac2:491e:: with SMTP id n30mr9204676lfi.395.1600372327412; Thu, 17 Sep 2020 12:52:07 -0700 (PDT) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com. [209.85.167.53]) by smtp.gmail.com with ESMTPSA id m6sm104006lfl.159.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-f53.google.com with SMTP id z19so3529896lfr.4 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" 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: 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