From: Barry Song <21cnbao@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: David Hildenbrand <david@redhat.com>,
steven.price@arm.com, akpm@linux-foundation.org,
ryan.roberts@arm.com, catalin.marinas@arm.com, will@kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
mhocko@suse.com, shy828301@gmail.com, v-songbaohua@oppo.com,
wangkefeng.wang@huawei.com, xiang@kernel.org,
ying.huang@intel.com, yuzhao@google.com
Subject: Re: [RFC V3 PATCH] arm64: mm: swap: save and restore mte tags for large folios
Date: Sat, 18 Nov 2023 04:36:42 +0800 [thread overview]
Message-ID: <CAGsJ_4w0f+1-8o+5-Vaj2xfO1Q5tm=AJQVrsST50nWihf02ynQ@mail.gmail.com> (raw)
In-Reply-To: <ZVfA2Z8XyD3qtTMZ@casper.infradead.org>
On Sat, Nov 18, 2023 at 3:37 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Fri, Nov 17, 2023 at 07:47:00AM +0800, Barry Song wrote:
> > This has been discussed. Steven, Ryan and I all don't think this is a good
> > option. in case we have a large folio with 16 basepages, as do_swap_page
> > can only map one base page for each page fault, that means we have
> > to restore 16(tags we restore in each page fault) * 16(the times of page faults)
> > for this large folio.
>
> That doesn't seem all that hard to fix? Call set_ptes() instead of
> set_pte_at(). The biggest thing, I guess, is making sure that all
> the PTEs you're going to set up are still pte_none().
I guess you mean all are still swap entries in ptes. some risks I can see
1. vma might be splitted after folios added into swapcache, for example
unmap or mprotect a part of large folios from userspace
2. vma is not splitted, but some basepages are MADV_DONTNEED
within the folios.
3. basepages in the large folio might become having different permissions
on R/W/X.
for example, if a large folio has 16 basepages, as userspace is still
working at 4kb, userspace can mprotect RD_ONLY for a part of them,
in this case, 16PTEs will still be swap entries, but the re-use for
write fault can't work at folio granularity.
I need to consider all the above DoubleMap/split risks rather than simply
checking PTEs as userspace is still 4KB.
>
Thanks
Barry
prev parent reply other threads:[~2023-11-17 20:36 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 1:43 Barry Song
2023-11-15 14:40 ` Steven Price
2023-11-15 15:16 ` David Hildenbrand
2023-11-15 20:49 ` Barry Song
2023-11-15 22:45 ` Yang Shi
2023-11-16 9:36 ` David Hildenbrand
2023-11-16 23:47 ` Barry Song
2023-11-17 0:15 ` Barry Song
2023-11-17 11:28 ` David Hildenbrand
2023-11-17 18:41 ` Barry Song
2023-11-20 9:11 ` David Hildenbrand
2023-11-20 10:57 ` Ryan Roberts
2023-11-20 14:50 ` Steven Price
2023-11-24 1:35 ` Barry Song
2023-11-24 8:55 ` David Hildenbrand
2023-11-24 9:01 ` Ryan Roberts
2023-11-24 9:55 ` Steven Price
2023-11-24 18:14 ` Barry Song
2023-11-27 11:56 ` Ryan Roberts
2023-11-27 12:01 ` David Hildenbrand
2023-11-27 12:14 ` Ryan Roberts
2023-11-27 14:16 ` David Hildenbrand
2023-11-27 14:52 ` Ryan Roberts
2023-11-27 15:42 ` David Hildenbrand
2023-12-07 3:22 ` Barry Song
2023-12-07 10:03 ` David Hildenbrand
2023-12-08 0:00 ` Barry Song
2023-11-17 11:25 ` David Hildenbrand
2023-11-17 19:36 ` Matthew Wilcox
2023-11-17 20:36 ` Barry Song [this message]
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='CAGsJ_4w0f+1-8o+5-Vaj2xfO1Q5tm=AJQVrsST50nWihf02ynQ@mail.gmail.com' \
--to=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=steven.price@arm.com \
--cc=v-songbaohua@oppo.com \
--cc=wangkefeng.wang@huawei.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=xiang@kernel.org \
--cc=ying.huang@intel.com \
--cc=yuzhao@google.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