Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp473378pxb; Fri, 8 Jan 2021 09:32:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9LthDZQlDqkf8/5yn/toZyZzMkjDshGgSixTfq6pMxv7cLOiP9RiAHWNjFL4MB/nvhXpn X-Received: by 2002:a05:6402:1696:: with SMTP id a22mr6089927edv.385.1610127170947; Fri, 08 Jan 2021 09:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610127170; cv=none; d=google.com; s=arc-20160816; b=m5PnDTb22YsLDkAt7hfmScGsc2HejM6YE50UuEp7lmVYht4yu0kc9HvYAv7d6TZjbu gtR1MTwmLCdSG4ky4uRsHy0EZy5XtZ8PA+MVGEyLUVeFZ/t1W6J9M1PzBPwkny6v9v8Q iotCeiPvpUs4a/WDNn0TfOMgoYqMqyh2qtT0BS0v8EVAwktrU0kQ+a7Ra6igQteg8MLn Y+4dEelr5yVLY3Uh9nsQrx7zWc8pCSuazhA/wXVROb9UwAv9G3xqynfMIAUC2hIJMZ2t PEZH8NRdD5BP2b61iUElb5m2VVkVJuv5z96fM2piyLBRPqPwrqXjHkBtH60W1uuvQzPt QKfg== 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=VXIjqAGwIdysFUxFNrZdW6sBVj2LPsT4/aJMu2Daxhc=; b=xuGWWqoHiQGE11X4YDfTZ+WfIMgMAYDRq3aKqrXmDMFHB9+S+fhAVsPT8OfqNVyYPN zncVUjjdDiGGFWt9EYDyuyVTIWLi82swW2edAhp/uZzUFnFX2TgxsQt480E5oa1fdlL4 zq5tc188xp9bvChAQhd8k/zHSH9z3fO6hJ0UggEqHs3rnEluYSwptfVjK40zIGPTnycQ /XgSYK3pBwChBod2jhYkQlgpIlFF5Bm0pEHRVBBAZzl39xVMQZSPU4maYuUHHAliBaqf HETgnKA3hOBztSg9XqdGYALAz0YufeO0H+GnlUeVd6qxVGaoqb6v8PHAlZIrOmow7Tqw rGCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=h0uCqWoH; 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 g1si4027665ejf.714.2021.01.08.09.32.26; Fri, 08 Jan 2021 09:32:50 -0800 (PST) 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=h0uCqWoH; 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 S1728153AbhAHRba (ORCPT + 99 others); Fri, 8 Jan 2021 12:31:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbhAHRb3 (ORCPT ); Fri, 8 Jan 2021 12:31:29 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B765C061380 for ; Fri, 8 Jan 2021 09:30:49 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id l11so24837604lfg.0 for ; Fri, 08 Jan 2021 09:30:49 -0800 (PST) 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=VXIjqAGwIdysFUxFNrZdW6sBVj2LPsT4/aJMu2Daxhc=; b=h0uCqWoH0H5RlCTO201ht4IXE9MIKRtSYzynacRdMt8/vz8Rz7XretI9vI/MfaHP33 gu558cgmEYSVoCm/9c5H7mLiFP/xi23mq5nwsloZLigSKTbed1joOkNERCziG0t5Y5nA cHAUCZdpY4VNWGyzBwpbsrtL9iIbmVeKUqilg= 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=VXIjqAGwIdysFUxFNrZdW6sBVj2LPsT4/aJMu2Daxhc=; b=MJGKe0spbUOqfLmuQoH9uUfadypjB8NRFMR7T7TKKFM+GzuJVvX4bZ/E/wornXhLdb KpTmpPlaAzLrqKTH03+Bh0P4NVaFQ5yX2La7sjnzgrZQKI4oWm0sbvvfExA5JsfKW5Qu /7SO822hLLTZ+LNzSMWeg7ho3j2HCFLUzI+nJQAih4dHuQNMbOg5z+vJpVRyx1w6B4tU tLy4L0Mp0zKEueSRc5aPMC70hVCHvVpZlsE3Z19B5fr/xPVZKejFatQNjjXTr0CNKXZ0 eEsQLAa8svQancwh8WmqRH8O0n9Py5lj9tdGTM+S8qi4n6w7I77oJC0vX4pex0pSTjtT qN3Q== X-Gm-Message-State: AOAM533ybfVfVUaTC2tjHQ6K4nZ7iftUDoRuWvpdvcyp3cghslptd0jZ ukDJC/1KZuu1YonsorwWDBHN0NI9V04GbQ== X-Received: by 2002:ac2:5e74:: with SMTP id a20mr1894930lfr.81.1610127047601; Fri, 08 Jan 2021 09:30:47 -0800 (PST) Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com. [209.85.167.41]) by smtp.gmail.com with ESMTPSA id v6sm2143841lfa.200.2021.01.08.09.30.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Jan 2021 09:30:46 -0800 (PST) Received: by mail-lf1-f41.google.com with SMTP id 23so24670954lfg.10 for ; Fri, 08 Jan 2021 09:30:45 -0800 (PST) X-Received: by 2002:a2e:9ad7:: with SMTP id p23mr1834917ljj.465.1610127045470; Fri, 08 Jan 2021 09:30:45 -0800 (PST) MIME-Version: 1.0 References: <20210107200402.31095-1-aarcange@redhat.com> <20210107200402.31095-3-aarcange@redhat.com> <20210108124815.GA4512@willie-the-truck> In-Reply-To: <20210108124815.GA4512@willie-the-truck> From: Linus Torvalds Date: Fri, 8 Jan 2021 09:30:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] mm: soft_dirty: userfaultfd: introduce wrprotect_tlb_flush_pending To: Will Deacon Cc: Andrea Arcangeli , Linux-MM , Linux Kernel Mailing List , Yu Zhao , Andy Lutomirski , Peter Xu , Pavel Emelyanov , Mike Kravetz , Mike Rapoport , Minchan Kim , Peter Zijlstra , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oleg Nesterov , Jann Horn , Kees Cook , John Hubbard , Leon Romanovsky , Jason Gunthorpe , Jan Kara , Kirill Tkhai Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 8, 2021 at 4:48 AM Will Deacon wrote: > > It certainly looks simple and correct to me, although it means we're now > taking the mmap sem for write in the case where we only want to clear the > access flag, which should be fine with the thing only held for read, no? When I was looking at that code, I was thinking that the whole function should be split up to get rid of some of the indentation and the "goto out_mm". And yes, it would probably be good to split up up even more than that "initial mm lookup and error handling", and have an actual case statement for the different clear_ref 'type' cases. And then it would be fairly simple and clean to say "this case only needs the mmap_sem for read, that case needs it for write". So I don't disagree, but I think it should be a separate patch - if it even matters. Is this strange /proc case something that is even commonly done? Linus