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=-5.8 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 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 CA4B7C433E0 for ; Fri, 8 Jan 2021 17:30:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2B6962333E for ; Fri, 8 Jan 2021 17:30:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B6962333E 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 323AC8D018A; Fri, 8 Jan 2021 12:30:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 305368D0156; Fri, 8 Jan 2021 12:30:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EB048D018A; Fri, 8 Jan 2021 12:30:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id AFBD08D0156 for ; Fri, 8 Jan 2021 12:30:51 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 73DE1181AEF31 for ; Fri, 8 Jan 2021 17:30:51 +0000 (UTC) X-FDA: 77683297902.21.girl57_550ad5b274f4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id F4182180442C3 for ; Fri, 8 Jan 2021 17:30:50 +0000 (UTC) X-HE-Tag: girl57_550ad5b274f4 X-Filterd-Recvd-Size: 5352 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 Jan 2021 17:30:50 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id h205so24750021lfd.5 for ; Fri, 08 Jan 2021 09:30:50 -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=YMfXRV0j2BG1xzfLNpi9agc810y9s7fM3CpYmxZvVYVBaj2JJW6lMX0AdS4eJ+lWHN 3cl6CfhcUJnbmQIdhsXFyX6K2X7SRy6xdT3akvDHJjhg5LTGnDiwtcQnxpFaZJ4C42GK ICq6Td13Hjmef4RZl7yoYfZUaPkRmVP92mA0XIPW20hDcjj9p+ssPEc6wh4v6GpCYulk 4cH9WemfX2Gkoz8klo7X+f2mEWH5c90RQfEMbEjoorngUo4Ok2fT7h/1qCWf7sqmjjVC 6PJX+IRMkBYXlkkFgpjNhJTihb7LJdC+bVF9fetaNaI33hWfrgjG9VVFjoEa7bqxMIk3 fezA== X-Gm-Message-State: AOAM530wOWUleILhH2FovcVQbYB5NKT15StYJCVaRn2SuLZIl9uxkMCk 4gWvqsKSjtpdXkCsho76UPV7aiTs8Nv92A== X-Google-Smtp-Source: ABdhPJz0KFKRRt+HicK/rMxdNjAJ95rlP8klBjFGRWnKY8nKRCnqqLzkdFLEIKDFEE7zT9jRMAWbrQ== X-Received: by 2002:a2e:720f:: with SMTP id n15mr1837991ljc.405.1610127047975; Fri, 08 Jan 2021 09:30:47 -0800 (PST) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id j12sm2103068lfc.99.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-f43.google.com with SMTP id b26so24720725lff.9 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" 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 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