From: David Hildenbrand <david@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: yang.yang29@zte.com.cn, akpm@linux-foundation.org,
jiang.xuexin@zte.com.cn, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, ran.xiaokai@zte.com.cn, xu.xin.sc@gmail.com,
xu.xin16@zte.com.cn, Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH v6 0/6] ksm: support tracking KSM-placed zero-pages
Date: Mon, 13 Mar 2023 17:04:27 +0100 [thread overview]
Message-ID: <267812a3-6576-33ce-4d41-054f6ecb812d@redhat.com> (raw)
In-Reply-To: <20230313151014.5e17fc19@p-imbrenda>
>> If we'd really want to identify whether a zeropage was deduplciated by
>> KSM, we could try storing that information inside the PTE instead of
>
> this is interesting, but needs caution, for the reason you mention below
>
>> inside the RMAP. Then, we could directly adjust the counter when zapping
>> the shared zeropage or during MADV_DONTNEED/when unmerging.
>>
>> Eventually, we could simply say that
>> * !pte_dirty(): zeropage placed during fault
>> * pte_dirty(): zeropage placed by KSM
>>
>> Then it would also be easy to adjust counters and unmerge. We'd limit
>> this handling to known-working architectures initially (spec64 still has
^ I meant sparc64 here. We can (and should) have a testcase that
deduplicates the shared zeropage using KSM and makes sure that writes
properly lead to a write fault.
>> the issue that pte_mkdirty() will set a pte writable ... and my patch to
>> fix that was not merged yet). We'd have to double-check all
>> pte_mkdirty/pte_mkclean() callsites.
>
> this will be... interesting
IIRC, most code that touches the dirty bit makes sure that it operates
on a proper struct page (via vm_normal_folio()).
madvise_free_pte_range() is one such user. But we have to double-check.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-03-13 16:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 1:15 yang.yang29
2023-03-13 13:03 ` David Hildenbrand
2023-03-13 14:10 ` Claudio Imbrenda
2023-03-13 16:04 ` David Hildenbrand [this message]
2023-03-28 22:38 ` Andrew Morton
2023-03-30 4:47 ` David Hildenbrand
2023-03-30 12:06 ` xu xin
2023-04-03 15:20 ` David Hildenbrand
2023-04-14 1:35 ` xu xin
2023-04-14 8:40 ` Claudio Imbrenda
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=267812a3-6576-33ce-4d41-054f6ecb812d@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=imbrenda@linux.ibm.com \
--cc=jiang.xuexin@zte.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ran.xiaokai@zte.com.cn \
--cc=xu.xin.sc@gmail.com \
--cc=xu.xin16@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/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