Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp182023ybp; Thu, 3 Oct 2019 11:59:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/M3/jwXdQabWvkuOYJvBdSWnJ/PkCo9yjSS0A9quNmQlRFrmVtdzR8Hfs9/TErBYhLRd4 X-Received: by 2002:a50:ec81:: with SMTP id e1mr11189173edr.107.1570129156750; Thu, 03 Oct 2019 11:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570129156; cv=none; d=google.com; s=arc-20160816; b=ujK8P5BMcNH1RMBiolUvNEzbBPIKGRqQZDzUyr4RrikD7yhR2WnlD08emtTX/YtEjX Y3yTtOf8uCUGx1xXTmvwEyZ8rrrXQr7kbCpVg5v4WDf8+zBvDRjPFQRBJIkAwblljint EEQtrJRDgNTnWfbyOcNLUozqwVL3RSJLxfK2yb2i//q4LvIxdymNXgkoLdRpnv0bnDkS bkR1RuejnwU+ig5hSZCRGQJHEKY6H2ugQ2IG7Me35NkYRNLBb04CpJd8xCPbJENQcNgq 9omoTGUviSucgN77hE6u0DKmt/ahYouJfUbSS4kSdI+kNg81rmph5EcHZQ5dmRznRk1p H7GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9CLff0xdjhwTwseNBTStiFNCovDaCPWc7aVjBBxw1vY=; b=QqX9KX5fKSVps15PpqXyj9nEXL49Ef4gq44cLjTs4D6d39juZFuO9/PDPzgOzr9L4f b56c8Jg27JTlWab9+zX/Mhg3xvMMHrIOJq01wE1zU9O9RNjFPhH7yBRUG6ne9I64/BVh PYY5j2Ozi+LWLutS/bflbXaKrqt+Oe98XFwUNOQVGCQQrj2uUjWS8dBKPt46qbHJfpj6 PMx57og2fhaB4XmerwLDFjBbR4eMudt+Tex6vIAbknihRTj9EIXHKwe/DM7ULkXUovV/ hhrcH6XeEypWcYqXDgoqKYI+9q+rsNJCRvVuEr020APaZKNo37mbTFPjpyHPgV15VPX2 Wjhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="dMFb3uM/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b21si1683230ejq.343.2019.10.03.11.58.52; Thu, 03 Oct 2019 11:59:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="dMFb3uM/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732987AbfJCSMQ (ORCPT + 99 others); Thu, 3 Oct 2019 14:12:16 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37339 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731502AbfJCSMQ (ORCPT ); Thu, 3 Oct 2019 14:12:16 -0400 Received: by mail-lj1-f195.google.com with SMTP id l21so3825753lje.4 for ; Thu, 03 Oct 2019 11:12:14 -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=Frb2UentRCWiWzQjpsHIYjcVr7Oxm9QG1ayg2B/zI4Qq2FIuvBoReewrfMwcbhLFWr xwVLX6X1snyXbF7OzyllX77DBlyuPFpAg8ngAMyCy03ahxTtM/QolxjxVq2ZCmEJ2ARs 8as4yR9EnsAiY6rlSbw/LTLfkZ8tCVjHgbsx0z5viBlYQw3f3g6j+vNvlgF2XOLbygh6 K0yoCbiZTtsPsUQ3KDELPUYzELeLN1b+PeswBwtWYwRGPlMMNgCQoC3A6LsQ005VlZod p6Bk0patgzWRPkgr9ISt+aINyw0POA84MbBUdcXbvQcelMG3qZxxB4JN/MwWTYNNzNpm WOFA== X-Gm-Message-State: APjAAAVr7qvw/MNhTarNkeJJD18but+Rwcvd5fYe+4tRnDNuPW19qjaS a8Nu6v8JygWHTfAOPU9QpZrYVvK7op8= X-Received: by 2002:a2e:4e12:: with SMTP id c18mr6752550ljb.47.1570126332872; Thu, 03 Oct 2019 11:12:12 -0700 (PDT) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id o13sm672112ljh.35.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-f181.google.com with SMTP id m13so3772745ljj.11 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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