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=-8.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 6B1F6C433EF for ; Fri, 3 Sep 2021 07:42:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 24D08610C8 for ; Fri, 3 Sep 2021 07:42:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 24D08610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 947AB8D0002; Fri, 3 Sep 2021 03:42:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F71B8D0001; Fri, 3 Sep 2021 03:42:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E5AB8D0002; Fri, 3 Sep 2021 03:42:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 7004E8D0001 for ; Fri, 3 Sep 2021 03:42:39 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DCEA3184DB429 for ; Fri, 3 Sep 2021 07:42:38 +0000 (UTC) X-FDA: 78545469996.04.309AFDB Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 778887001A08 for ; Fri, 3 Sep 2021 07:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630654957; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zGNoXGQR4G1nHZ5SvtMA1M71DXUrv+gYZg+gvrpIQ0E=; b=NAxyZeVEUaGsGnFTxqPJj356f91EQK+Rrgf0CSs424z4l7oek/qImXfoMCn30BYV6s1y2i pH3Gs4nUpC2GK6qzlP6jOTu0LRTQUSLQkivbvlCuFkaKAnjNM2Z5Ikn6Z/NM4m2ueZECDb XIJjxi7goHYWuDV+qm34dA42b4pCYY4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-vivod9P7NxyXC0k55kEmwg-1; Fri, 03 Sep 2021 03:42:36 -0400 X-MC-Unique: vivod9P7NxyXC0k55kEmwg-1 Received: by mail-wm1-f69.google.com with SMTP id n16-20020a1c7210000000b002ea2ed60dc6so1530764wmc.0 for ; Fri, 03 Sep 2021 00:42:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=zGNoXGQR4G1nHZ5SvtMA1M71DXUrv+gYZg+gvrpIQ0E=; b=R63lIpCw5idg7A78jw9ee1db+5v+AeHdoGc9+d2UF2CVaLmx4enHjUPAxOXvnwxFyy 7OwS/C7VHO+RnOrWjMjgHG+TQ96iGr4Ie48FL4UiCwT9q8q9hlYr8/wrxeciVYA0MB0K DuMoNu0fyRDIdqadWmzPRey80ZHVJlb0IOLddxmMI/z+rFGG9KC3HVlSWSZRDZrKkBud T+u2+cC58g67iIyMADsspXNsuzfmd6aqRRldCVkKplOfe2PQRcqJm+5Yl8EardXSQNB1 q1Tm5AbN8JNVlS70js7ykDYh42aVHmK0HkphL0VNZOe6pf+uDiq7Kb4TOUF/kgCDmmCs /zgQ== X-Gm-Message-State: AOAM531A4hVXqbg9ehlkLSMz1cxQYPqeFevehokZaHfYeY5yLEr72Wzg ahW+sOd9TsVSSxpoUMkblPzGfR50xxf8CygI2F2aW13I6B7Q9q0T15pLhxQq06Ntzwn4Wi4fKOL oCgNW2986hw8= X-Received: by 2002:a5d:6352:: with SMTP id b18mr2395716wrw.116.1630654955675; Fri, 03 Sep 2021 00:42:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzQuMGwLZdTovtvmgDjV4dIuN1t/yCejCcf/NATI9SRiWTlVPjpzfobAR/VEFh2l/oUzEBdw== X-Received: by 2002:a5d:6352:: with SMTP id b18mr2395690wrw.116.1630654955521; Fri, 03 Sep 2021 00:42:35 -0700 (PDT) Received: from [192.168.3.132] (p4ff23e05.dip0.t-ipconnect.de. [79.242.62.5]) by smtp.gmail.com with ESMTPSA id c9sm4040224wrf.77.2021.09.03.00.42.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Sep 2021 00:42:35 -0700 (PDT) Subject: Re: [PATCH v2 1/5] mm/shmem: Unconditionally set pte dirty in mfill_atomic_install_pte To: Peter Xu , linux-kernel@vger.kernel.org, Andrew Morton , Hugh Dickins , linux-mm@kvack.org Cc: Andrea Arcangeli , Yang Shi , Matthew Wilcox , Jerome Glisse , Mike Rapoport , "Kirill A . Shutemov" , Miaohe Lin , Alistair Popple , Axel Rasmussen References: <20210902201721.52796-1-peterx@redhat.com> <20210902201721.52796-2-peterx@redhat.com> From: David Hildenbrand Organization: Red Hat Message-ID: <2f1bfe82-9bb7-957c-2b32-2ccf8a48e70a@redhat.com> Date: Fri, 3 Sep 2021 09:42:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210902201721.52796-2-peterx@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 778887001A08 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NAxyZeVE; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf02.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam01 X-Stat-Signature: zrheny7kywnjfisrk361yi4sf6ydew9q X-HE-Tag: 1630654958-490756 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 02.09.21 22:17, Peter Xu wrote: > It was conditionally done previously, as there's one shmem special case that we > use SetPageDirty() instead. However that's not necessary and it should be > easier and cleaner to do it unconditionally in mfill_atomic_install_pte(). > > The most recent discussion about this is here, where Hugh explained the history > of SetPageDirty() and why it's possible that it's not required at all: > > https://lore.kernel.org/lkml/alpine.LSU.2.11.2104121657050.1097@eggly.anvils/ > > Currently mfill_atomic_install_pte() has three callers: > > 1. shmem_mfill_atomic_pte > 2. mcopy_atomic_pte > 3. mcontinue_atomic_pte > > After the change: case (1) should have its SetPageDirty replaced by the dirty > bit on pte (so we unify them together, finally), case (2) should have no > functional change at all as it has page_in_cache==false, case (3) may add a > dirty bit to the pte. However since case (3) is UFFDIO_CONTINUE for shmem, > it's merely 100% sure the page is dirty after all, so should not make a real > difference either. Would it be worth adding VM_BUG_ON() to make sure that "100%" is really the case? > > This should make it much easier to follow on which case will set dirty for > uffd, as we'll simply set it all now for all uffd related ioctls. Meanwhile, > no special handling of SetPageDirty() if there's no need. To me this all sounds sane, but I'm certainly not an expert on that code, so ... -- Thanks, David / dhildenb