From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Peter Xu <peterx@redhat.com>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
David Hildenbrand <david@redhat.com>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Paul Gofman <pgofman@codeweavers.com>,
Nadav Amit <nadav.amit@gmail.com>,
Andrea Arcangeli <aarcange@redhat.com>,
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()
Date: Wed, 21 Dec 2022 13:17:47 +0500 [thread overview]
Message-ID: <0d0e370c-04bd-aca4-ecb9-e50c06022183@collabora.com> (raw)
In-Reply-To: <Y6IGr2Y21GlLTSRl@x1n>
On 12/21/22 12:02 AM, Peter Xu wrote:
> 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.
I completely agree that setting pte flags isn't needed if VM_SOFTDIRTY is
set. It is wasted effort. Before this patch, the effort was being wasted in
the default part of the feature and in the other related components as
well. After this patch, the effort is being wasted only in the default part
of the feature and other related components have stopped doing this wasted
effort which is a good thing. But now there is discrepancy that one part of
code keeps on tracking pte while other has moved on/improved.
>
>> 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.
The question of tracking re-used regions should be answered by the original
developers of the feature. I've been trying to get comments from them. But
I've not got any. Maybe some conference talk can work where the
maintainers/developers are present? Or I'll summarize the whole problem and
ask Andrew directly.
>
> Thanks,
>
--
BR,
Muhammad Usama Anjum
next prev parent reply other threads:[~2022-12-21 8:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 14:20 [PATCH v4 0/3] mm/mprotect: Fix soft-dirty checks Peter Xu
2022-07-25 14:20 ` [PATCH v4 1/3] mm/mprotect: Fix soft-dirty check in can_change_pte_writable() Peter Xu
2022-11-18 20:16 ` Muhammad Usama Anjum
2022-11-18 23:14 ` Peter Xu
2022-11-21 14:57 ` Muhammad Usama Anjum
2022-11-21 21:17 ` Peter Xu
2022-12-19 12:19 ` Muhammad Usama Anjum
2022-12-20 16:03 ` Peter Xu
2022-12-20 18:15 ` Muhammad Usama Anjum
2022-12-20 19:02 ` Peter Xu
2022-12-21 8:17 ` Muhammad Usama Anjum [this message]
2022-12-28 14:14 ` Muhammad Usama Anjum
2023-01-02 12:29 ` David Hildenbrand
2022-07-25 14:20 ` [PATCH v4 2/3] selftests: soft-dirty: Add test for mprotect Peter Xu
2022-07-25 14:28 ` David Hildenbrand
2022-07-25 14:20 ` [PATCH v4 3/3] selftests: Add soft-dirty into run_vmtests.sh Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d0e370c-04bd-aca4-ecb9-e50c06022183@collabora.com \
--to=usama.anjum@collabora.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=gorcunov@gmail.com \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nadav.amit@gmail.com \
--cc=peterx@redhat.com \
--cc=pgofman@codeweavers.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox