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=-0.8 required=3.0 tests=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 CB32EC4360C for ; Thu, 26 Sep 2019 22:21:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7DEA4205F4 for ; Thu, 26 Sep 2019 22:21:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="F0LSxC3w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DEA4205F4 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 0A2908E0027; Thu, 26 Sep 2019 18:21:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02AE48E0025; Thu, 26 Sep 2019 18:21:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5B808E0027; Thu, 26 Sep 2019 18:21:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id BF27A8E0025 for ; Thu, 26 Sep 2019 18:21:02 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 7805E180AD803 for ; Thu, 26 Sep 2019 22:21:02 +0000 (UTC) X-FDA: 75978493164.03.frame44_43339d9d1e70f X-HE-Tag: frame44_43339d9d1e70f X-Filterd-Recvd-Size: 5877 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 22:21:01 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id q64so477594ljb.12 for ; Thu, 26 Sep 2019 15:21:01 -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:content-transfer-encoding; bh=ge4WC49pngiICthc1WDcavUjVJbMBv50VLzrcwA4/hc=; b=F0LSxC3wcSztazbG0uwCTRtKvGqprF/KA5I/kBqM8nEjAxsHAszHBhkaAnVSswq05I IPDhtPkVd/mlH10svz+m4SxGzJUZb8x7FqMDs4M8P0ZJ8e08izgtmsrZi+eLmVZ7fgoV 8FC65G/EFwknPF5qvRjXEHu47uk9C2Rj8l8IE= 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:content-transfer-encoding; bh=ge4WC49pngiICthc1WDcavUjVJbMBv50VLzrcwA4/hc=; b=LQpbz2lCsw2VLbNG4ZN+cki1H9KFdHl2WltMpx6S5CBROvKxxckHHLvfjr5Ln6RHT1 +aH0KinEn8eQ4eARAlIFv96Rh0FjehpP4a7TktOOMHgAI5MkKOJ7IbYV/KGfpnY6qbXy iIbl/xjbQizw0cNliC4KkvEMl8zAeM6KCCFRbwWl4t0UI7EudHw8PyipepLf7YFNX5RD qf6wH6Qoyw4dinu+62uCGqbZ8wTbW2T/F4AcbfMS5urnzm7fAjztNQNN1ON8uhX1aWil oQnkKYZE0bXR3KMj9j2ynX8eiUVaUHIDIrT2X6eYWmSTTT1V+jvFUirYw6rMjVFOwvlC iDCA== X-Gm-Message-State: APjAAAXiPT+cD8TOBQLCodRk1/cxkjgNWE+FTt9+rt2+czlU9iA07yq8 rzhpqKQ8XUzuTbgL7qWS2nn5EeepWfc= X-Google-Smtp-Source: APXvYqxvnbtLfQ2qJtiWgB3MRPQAMpoT5dZUvbY5qO4TSZXetaZ3sbRWoYHYjy7nBpZCXv2rDfPudg== X-Received: by 2002:a05:651c:283:: with SMTP id b3mr601809ljo.25.1569536459824; Thu, 26 Sep 2019 15:20:59 -0700 (PDT) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id e7sm93757lfn.12.2019.09.26.15.20.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Sep 2019 15:20:58 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id r22so392272lfm.1 for ; Thu, 26 Sep 2019 15:20:58 -0700 (PDT) X-Received: by 2002:a19:741a:: with SMTP id v26mr487782lfe.79.1569536458354; Thu, 26 Sep 2019 15:20:58 -0700 (PDT) MIME-Version: 1.0 References: <20190926115548.44000-1-thomas_os@shipmail.org> <20190926115548.44000-2-thomas_os@shipmail.org> <85e31bcf-d3c8-2fcf-e659-2c9f82ebedc7@shipmail.org> In-Reply-To: From: Linus Torvalds Date: Thu, 26 Sep 2019 15:20:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Ack to merge through DRM? WAS Re: [PATCH v2 1/5] mm: Add write-protect and clean utilities for address space ranges To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m_=28VMware=29?= Cc: Linux Kernel Mailing List , dri-devel , Linux-MM , Andrew Morton , Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 26, 2019 at 1:55 PM Thomas Hellstr=C3=B6m (VMware) wrote: > > Well, we're working on supporting huge puds and pmds in the graphics > VMAs, although in the write-notify cases we're looking at here, we would > probably want to split them down to PTE level. Well, that's what the existing walker code does if you don't have that "pud_entry()" callback. That said, I assume you would *not* want to do that if the huge pud/pmd is already clean and read-only, but just continue. So you may want to have a special pud_entry() that handles that case. Eventually. Maybe. Although honestly, if you're doing dirty tracking, I doubt it makes much sense to use largepages. > Looking at zap_pud_range() which when called from unmap_mapping_pages() > uses identical locking (no mmap_sem), it seems we should be able to get > away with i_mmap_lock(), making sure the whole page table doesn't > disappear under us. So it's not clear to me why the mmap_sem is strictly > needed here. Better to sort those restrictions out now rather than when > huge entries start appearing. zap_pud_range()actually does have that VM_BUG_ON_VMA(!rwsem_is_locked(&tlb->mm->mmap_sem), vma); exactly for the case where it might have to split the pud entry. Zapping the whole thing it does do without the assert. I'm not going to swear the mmap_sem is absolutely required, since a shared vma should be stable due to the i_mmap_lock, but splitting the hugepage really is a fairly big deal. It can't happen if you zap the *whole* mapping, but it can happen if you have a start/end range. Like you do. Also, in general it's probably not a great idea to look at zap_page_range() (and copy_page_range()) for ideas. They are kind of special, since they tend to be used for fundamental whole-address-space operations (ie fork/exit) and so as a result they get to do special things that a normal page walker generally shouldn't do. It's why they've never gotten translated to use the generic walker code. Linus