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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C5A7C05027 for ; Wed, 15 Feb 2023 00:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229510AbjBOAd2 (ORCPT ); Tue, 14 Feb 2023 19:33:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjBOAd1 (ORCPT ); Tue, 14 Feb 2023 19:33:27 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E16FB23D84 for ; Tue, 14 Feb 2023 16:32:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676421158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0etdia8N+ECGaC0gAhXaKuBpC7aTnF6lYawwxL7alZU=; b=XZAKRH1FvlNLU+FLKHa5Wr/wFzzcvpBYG19XW0RE8jXTD73gkGSiFb3UXdIGdH6ehL6nHr 1KFcaBtJtoAUTT3hMw8ztFeJDIWKdv6yB/FXcbgA8VUvGKFuUNsXizIrjRqGU4K1I9qICH ovL4CMT5DLPzU/4JOioYYuSsf8/X17s= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-574-NQdvLHGQNOqXn1v1e9Uy3g-1; Tue, 14 Feb 2023 19:32:37 -0500 X-MC-Unique: NQdvLHGQNOqXn1v1e9Uy3g-1 Received: by mail-qt1-f200.google.com with SMTP id bz17-20020a05622a1e9100b003b9c1013018so10329882qtb.18 for ; Tue, 14 Feb 2023 16:32:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676421156; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0etdia8N+ECGaC0gAhXaKuBpC7aTnF6lYawwxL7alZU=; b=mJuT7ClQCtr795NY+RjuCepk8xmj7DQOn3KI3kmCHghBrTSG29ZSd/+Uvhc80QfsPf C9N7INFAcvv8AuZQQAxTVpUenMA2HwAOaCf9uy6NOruxq3oZfvdB+q+oabm6JCnI8lLb KsuNUEnwODsYRL/l+TLJ0fqC9WvpKGs5em/XgW9zNFdOvcvmdut398f0+NGm1z7zqADO vEJKNJZa6g2+DqpKOrmFSVPlo6pHYWDQRkouPMxaDMJUlrtThCtgBuONm8aMX6R2yOtu wukjaWvYj3cwz/ObgGBGBXYN2CJc3HTvG7FudRuKsCsbSFyC621G9E0B1/nQwLLjWeST MWAg== X-Gm-Message-State: AO0yUKU2d7v0W+uGut6yVoiuGHQ1+RCUSmqhF+qQWrRHpfGtF16D6nFJ e3iphQINbPhVSrHwUhWGfkXNtpM2XExifESzvRDrZ170EwYWKDWH8GwsEr2ukt7oLmzwdOy2fJG KsPOM9HNO6gAcHWrydj6JTo9XPKlMDVvXzg== X-Received: by 2002:a05:622a:5c7:b0:3b8:36f8:830e with SMTP id d7-20020a05622a05c700b003b836f8830emr338494qtb.6.1676421156142; Tue, 14 Feb 2023 16:32:36 -0800 (PST) X-Google-Smtp-Source: AK7set9yOl2ngRxqcgHLXOhO5w1e7vPn8HhnvU3R6YCTj2Nylo/ep0JaoSfrJ2cQznmURLh3CZz7pw== X-Received: by 2002:a05:622a:5c7:b0:3b8:36f8:830e with SMTP id d7-20020a05622a05c700b003b836f8830emr338467qtb.6.1676421155789; Tue, 14 Feb 2023 16:32:35 -0800 (PST) Received: from x1n ([70.30.145.63]) by smtp.gmail.com with ESMTPSA id s6-20020a372c06000000b00727538eb831sm12902269qkh.86.2023.02.14.16.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 16:32:35 -0800 (PST) Date: Tue, 14 Feb 2023 19:32:29 -0500 From: Peter Xu To: Axel Rasmussen Cc: Matthew Wilcox , Alexander Viro , Mike Kravetz , Muchun Song , Andrew Morton , Hugh Dickins , Shuah Khan , "Liam R. Howlett" , Mike Rapoport , Nadav Amit , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Houghton Subject: Re: [PATCH] mm: userfaultfd: add UFFDIO_CONTINUE_MODE_WP to install WP PTEs Message-ID: References: <20230214215046.1187635-1-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On Tue, Feb 14, 2023 at 02:37:51PM -0800, Axel Rasmussen wrote: > Agreed, it would likely be a nice cleanup. Peter, any objections? I > wouldn't mind writing a commit to do this sort of refactor, and rebase > my change on top of that. No objection here. Personally I actually prefer keeping the parameters around if possible because it's straightforward and no thinking of any possible indirect accesses all over the place. But maybe growing as long as 8 is still a moot point.. It's just that I don't really know whether it'll look that good if we put everything into a struct*. Things like src_start/dst_start/.. do not look good to be there: each layer could loop over its own range of start/end/... so even if not in the function parameter we'll need a variable to hold them anyway. But I do see a few low hanging fruits: - I don't see why we need to pass over mmap_changing over all of the __mcopy_atomic() callers. One chance is we simply pass in the ctx* to replace "dst_mm + mmap_changing". - Merge mcopy_atomic_mode and mode, having last 2 bits for the existing three modes, then bit 3 for WP, good enough to set it for the new case. - Optionally, we can avoid passing over dst_mm/src_mm all around, when dst_vma/src_vma is there? How about we start from simple? -- Peter Xu