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.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 29E42C10F14 for ; Thu, 3 Oct 2019 18:12:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E32AB20862 for ; Thu, 3 Oct 2019 18:12:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="dMFb3uM/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E32AB20862 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 800686B0005; Thu, 3 Oct 2019 14:12:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B1D16B0006; Thu, 3 Oct 2019 14:12:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C7C16B0007; Thu, 3 Oct 2019 14:12:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 4ADBD6B0005 for ; Thu, 3 Oct 2019 14:12:15 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id CB5BA824CA30 for ; Thu, 3 Oct 2019 18:12:14 +0000 (UTC) X-FDA: 76003267788.14.wave43_3083f2f59de34 X-HE-Tag: wave43_3083f2f59de34 X-Filterd-Recvd-Size: 5674 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Oct 2019 18:12:13 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id a22so3843719ljd.0 for ; Thu, 03 Oct 2019 11:12:13 -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=9CLff0xdjhwTwseNBTStiFNCovDaCPWc7aVjBBxw1vY=; b=dMFb3uM/UyVtVEpIyGLjZQ5D18cmbwEsrABzaJQGR8dc/u0V7qHCKXlrcEidk/cRrn wYj/a7r+sxttXokd27j5hVkylFooq/4ywDgSdJj8Ry/bZU6+gYBaMVdp6VvVAc+mHPVP Xx6A534Uq6kdvFHYq1JLHYRTJlsG39xebJzh8= 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=9CLff0xdjhwTwseNBTStiFNCovDaCPWc7aVjBBxw1vY=; b=mqE0vqSKnf5iW4LhmjaI//K+KrqbIRwCxwZ97YUq0Lll7U15bsVx9RXnJzfMxp6JG4 x3k3ml0i+4hC3RTFImEDt0jgB6EwTTx9TIg2P3HYKiGUk160fvZtuFqPtBpz5mOJ8F1Y ZG0noJha08jtSaRYllieX+K04OXB9FVkt+yoL7DNyYunWWNOaYT+1LZ7wvDqRfpw8Qxo 3pauJTW+DrDeXE/sE5nnSv3xUDqhrxJbpkKoMdiOAer8lQb7Dk/TwdSivYWVbocby/hZ mEX/4aCocq37FJ105YTJ+1Slri2r7IIIRNOYXYH2jQksPTgV5f1MzOAuSq647nkZ/sYu fvWA== X-Gm-Message-State: APjAAAWn5Fs0/yQHj8i/StVaGwAf7sDL7sJAmGzIWDjRpPED6PJ/15S0 0MMh88oGw+HsjaNFfeV8bomSkALPWk0= X-Google-Smtp-Source: APXvYqwqj3aJn32G2S358C6B87YqRDNI1hc4Z4k+D4v/CrKdqUfEUFKs+nxM28l7Mcttn96UCwXDng== X-Received: by 2002:a05:651c:22a:: with SMTP id z10mr7030487ljn.103.1570126330988; Thu, 03 Oct 2019 11:12:10 -0700 (PDT) Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com. [209.85.208.172]) by smtp.gmail.com with ESMTPSA id 134sm599909lfk.70.2019.10.03.11.12.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Oct 2019 11:12:10 -0700 (PDT) Received: by mail-lj1-f172.google.com with SMTP id l21so3825522lje.4 for ; Thu, 03 Oct 2019 11:12:09 -0700 (PDT) X-Received: by 2002:a2e:9241:: with SMTP id v1mr7032210ljg.148.1570126329445; Thu, 03 Oct 2019 11:12:09 -0700 (PDT) MIME-Version: 1.0 References: <20191002134730.40985-1-thomas_os@shipmail.org> <20191002134730.40985-4-thomas_os@shipmail.org> <516814a5-a616-b15e-ac87-26ede681da85@shipmail.org> In-Reply-To: From: Linus Torvalds Date: Thu, 3 Oct 2019 11:11:53 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 3/7] mm: Add write-protect and clean utilities for address space ranges To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m_=28VMware=29?= Cc: Thomas Hellstrom , Linux-MM , Linux Kernel Mailing List , Andrew Morton , Matthew Wilcox , Will Deacon , Peter Zijlstra , Rik van Riel , Minchan Kim , Michal Hocko , Huang Ying , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , "Kirill A . Shutemov" 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, Oct 3, 2019 at 11:03 AM Thomas Hellstr=C3=B6m (VMware) wrote: > > > > > So I think this is the right direction to move into, but I do want > > people to think about this, and think about that next phase of doing > > the pmd_trans_huge_lock too. > > I think if we take the ptl lock outside the callback, we'd need to allow > the callback to unlock to do non-atomic things or to avoid recursive > locking if it decides to split in the callback. Note that I think that the particular pmd locking case we should leave for later, simply because it's a separate issue, and it comes with more worries. So I just wanted to mention it to see what people thought and keep it in mind for later, but I don't think it should be part of this series. Your use case doesn't need it (at least yet), and existing users already do their own locking. The "change pte_entry" to do the proper locking I think is safe. Probably exactly *because* pte_entry is so broken, we literally have only five users of it in the whole kernel, and they are fairly simple and certainly don't block. (Ok, the s390 has some funky hw locking, so maybe "simple" is the wrong word to use, but it doesn't seem to have any interaction with the locking). End result: I absolutely agree that changing the pmd locking to be done by the walker would be a much bigger change. I don't think we need to do that part yet. It's not the current pain-point. Linus