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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75A57C4332F for ; Tue, 20 Dec 2022 19:02:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDCF48E0002; Tue, 20 Dec 2022 14:02:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D66438E0001; Tue, 20 Dec 2022 14:02:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDFDD8E0002; Tue, 20 Dec 2022 14:02:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AA2A78E0001 for ; Tue, 20 Dec 2022 14:02:15 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 66C02A2766 for ; Tue, 20 Dec 2022 19:02:15 +0000 (UTC) X-FDA: 80263605030.28.105B4D8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 5FA7E180002 for ; Tue, 20 Dec 2022 19:02:12 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AJdQ7MqL; spf=pass (imf16.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671562932; a=rsa-sha256; cv=none; b=ZPucHMLgU5F1+X+WCx9j2ctGuhnxonZkzYVSI3tSj7NEw/fFkkIMbkkm1+Eo4ZYP/gOWUw sJms7/z9F+HMo1uGVPDHAi7tkg+9xGBnJ30c5dBwSeXmtQdnupE58qgJi+O+7hP4oNsQJp 6t2HPW54TfqLP70+vhrjYFlXDGWx1dE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=AJdQ7MqL; spf=pass (imf16.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671562932; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eYc8wovIm/Vz9Gb0Hhxo/LT9d5qQ3FV3jFu1a7zreS8=; b=t3nvpv0wlTF1IY3BAd2cOBiaT1d7FX5jshabUFy9uYALQRWj4VchOF3PptetqdOCKil/cd FFhAR07fUK5xoa32DMZz1t640FLQyPnrCpB0ZFXQ+qISR1liB3zKM+GNmU4OYDRpC8UDkR 5XsSBZbhizVS9fyGXf2P5f6CglX2Xfo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671562931; 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=eYc8wovIm/Vz9Gb0Hhxo/LT9d5qQ3FV3jFu1a7zreS8=; b=AJdQ7MqLV1arIaOnTdvVOsHMdq9g5cMrBwYL67upgt13Su1iIQ3AOBug2v8QQsLlGylo+0 fhhTXn9gI5etMHHCrVTUCvb34d9Axdn/JQvgz74+uPiq1mxu51bjfXYPWOA29w1gp3zDmr tQjeq9fUO5kf+JVKizsMTLu4vyv0xnE= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-39-qLktDjnnPsq7zmFevTO47g-1; Tue, 20 Dec 2022 14:02:10 -0500 X-MC-Unique: qLktDjnnPsq7zmFevTO47g-1 Received: by mail-ot1-f69.google.com with SMTP id e15-20020a0568301e4f00b006783b3a27c3so1488352otj.0 for ; Tue, 20 Dec 2022 11:02:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=eYc8wovIm/Vz9Gb0Hhxo/LT9d5qQ3FV3jFu1a7zreS8=; b=Wg3w3QEETUWzFpf5yk3vqbK0GEqxsVNpyntJRqyE3hX1tmicIrQZAAtTH2Nyhklv4I 4bpieirGrotAHzQZhMXj3FPGuVbOB5t7C3Yh0VGn5FlLea6lU+JFpAG0dsF9Ty3hbeHl FCg4Vz66qPFEWtt+xd0K5J9r/CuY9xHUz1P3cID6TqrdNTB2YTWqlqvc0PkQjJ7md2Wc P5OIrQBBGEy7YYwTAYwL0Kc8o6a7yUdOz8qv/LX0zay6DyT5KOkVQYeyyGCNAaVSf++y DsF/CVRKunmSTOOYSHZOC37No0ns/IVyx3Q/mC0aT4AIS0191n7KybW1uDBbldEwltql tN5g== X-Gm-Message-State: ANoB5plAIQxvhzUXG0JgRoARydT+kIlCP7v993ObNmLxSvwxg70nfjpc y7HUQdzBy3AGOOB3wPQ+rM5c4vjJeVi9ingAl6R7NPoDUvtcxbRbF6HQHK9xoGeM4wpn4C9iTNn iqC0SsNz06nI= X-Received: by 2002:a9d:6452:0:b0:667:20b:b999 with SMTP id m18-20020a9d6452000000b00667020bb999mr21561190otl.2.1671562929512; Tue, 20 Dec 2022 11:02:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf7c0LscNnTqJtKRJRf5z/nsLAeS+hrOjbcVw3CgrNe5NM2f03MX1SvAr8/P7qhJo8Ayf0ic1w== X-Received: by 2002:a9d:6452:0:b0:667:20b:b999 with SMTP id m18-20020a9d6452000000b00667020bb999mr21561159otl.2.1671562929117; Tue, 20 Dec 2022 11:02:09 -0800 (PST) Received: from x1n (bras-base-aurron9127w-grc-45-70-31-26-132.dsl.bell.ca. [70.31.26.132]) by smtp.gmail.com with ESMTPSA id d136-20020ae9ef8e000000b006fef157c8aesm9228574qkg.36.2022.12.20.11.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 11:02:08 -0800 (PST) Date: Tue, 20 Dec 2022 14:02:07 -0500 From: Peter Xu To: Muhammad Usama Anjum Cc: David Hildenbrand , Cyrill Gorcunov , Andrew Morton , Paul Gofman , Nadav Amit , Andrea Arcangeli , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel@collabora.com Subject: Re: [PATCH v4 1/3] mm/mprotect: Fix soft-dirty check in can_change_pte_writable() Message-ID: References: <20220725142048.30450-1-peterx@redhat.com> <20220725142048.30450-2-peterx@redhat.com> <0a3e3397-6ff3-1203-52cb-49636ef38247@collabora.com> MIME-Version: 1.0 In-Reply-To: <0a3e3397-6ff3-1203-52cb-49636ef38247@collabora.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 5FA7E180002 X-Stat-Signature: 6w6m3zcqxwi5auzi5dzd3gbi93pq61md X-HE-Tag: 1671562932-436297 X-HE-Meta: U2FsdGVkX1/S1xn7KOSYNewHhqKgth50SMHaz6J6gfVXg2VY4M5/W432LTps44MnVIsXgk1ciTGqKWfu8oMwhiNs4aAcX1h3qDV6RAE1kQOzy9tADRGKByAqvhetpjuh9Ka9rO2OzJ/3825uMhtZqeDS3xaBsOuIx3sgc9qa6lMtjuUdWpyDR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owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Dec 20, 2022 at 11:15:00PM +0500, Muhammad Usama Anjum wrote: > Hi Peter, Hi, Muhammad, [...] > Nothing has changed for the userspace. But when the default soft-dirty > feature always updates the soft-dirty flag in the PTEs regardless of > VM_SOFTDIRTY is set or not But it was not? I don't see why the pte flags must be considered at all if VM_SOFTDIRTY is set in existing code base, or before this patch. > why does other components of the mm stop caring for soft-dirty flag in > the PTE when VM_SOFTDIRTY is set? > > > > > Your approach introduced PAGEMAP_NO_REUSED_REGIONS but that special > > information is not remembered in vma, IIUC that's why you find things > > messed up. Fundamentally, it's because you're trying to reuse soft-dirty > > design but it's not completely soft-dirty anymore. > Correct, that's why I'm trying to find a way to correct the soft-dirty > support instead of using anything else. We should try and correct it. I've > sent a RFC to track the soft-dirty flags for sub regions in the VMA. Note that I'm not against the change if that's servicing the purpose of the enhancement you're proposing. But again I wouldn't use "correct" as the word here because I still didn't see anything wrong with the old code. so IMHO the extra complexity on handling VM_SOFTDIRTY (even if to drop it and replace with other structures to maintain ranged soft-dirty) needs to be justified along with the feature introduced, not be justified as a fix. Thanks, -- Peter Xu