From: "Zach O'Keefe" <zokeefe@google.com>
To: Yang Shi <shy828301@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-api@vger.kernel.org,
Axel Rasmussen <axelrasmussen@google.com>,
James Houghton <jthoughton@google.com>,
Hugh Dickins <hughd@google.com>,
Miaohe Lin <linmiaohe@huawei.com>,
David Hildenbrand <david@redhat.com>,
David Rientjes <rientjes@google.com>,
Matthew Wilcox <willy@infradead.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Peter Xu <peterx@redhat.com>,
Rongwei Wang <rongwei.wang@linux.alibaba.com>,
SeongJae Park <sj@kernel.org>, Song Liu <songliubraving@fb.com>,
Vlastimil Babka <vbabka@suse.cz>,
Chris Kennelly <ckennelly@google.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Minchan Kim <minchan@kernel.org>,
Patrick Xia <patrickx@google.com>
Subject: Re: [PATCH mm-unstable v4 03/10] mm/madvise: add file and shmem support to MADV_COLLAPSE
Date: Mon, 26 Sep 2022 18:24:09 -0700 [thread overview]
Message-ID: <CAAa6QmTrAQQBqL7ry6_Mpg0D8C1uNDtfhjkzFyZz2+G_VXmGdQ@mail.gmail.com> (raw)
In-Reply-To: <CAHbLzkrL4T_kBG3VgxYgoiHkpe0eqkJvmmGKt9swy39c6MMCrw@mail.gmail.com>
> > +/* hpage must be locked, and mmap_lock must be held in write */
> > +static int set_huge_pmd(struct vm_area_struct *vma, unsigned long addr,
> > + pmd_t *pmdp, struct page *hpage)
> > +{
> > + struct vm_fault vmf = {
> > + .vma = vma,
> > + .address = addr,
> > + .flags = 0,
>
> It means you are going to install a readonly PMD. It is fine for
> readonly fs, but it may be not performant for shmem since the
> following write will trigger wp fault then the PMD will be split. So
> it should be ok to install writable PMD for shmem.
>
> But anyway this is not a fatal problem, the patch looks good to me.
> Reviewed-by: Yang Shi <shy828301@gmail.com>
>
Thanks, Yang!
I haven't worked out the details for writable shmem, but I'm hoping
FAULT_FLAG_WRITE is enough here.
I'm also now wondering if FAULT_FLAG_REMOTE is needed here for
process_madvise(MADV_COLLAPSE) when called on behalf of another
process; though that would also mean it's needed in
__collapse_huge_page_swapin() as well (even when running as
khugepaged). I can't say I fully understand 1b2ee1266ea6 ("mm/core: Do
not enforce PKEY permissions on remote mm access"), but if the comment
in include/linux/mm_types.h is to be trusted, then this would be the
case.
next prev parent reply other threads:[~2022-09-27 1:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 22:40 [PATCH mm-unstable v4 00/10] mm: add file/shmem " Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 01/10] mm/shmem: add flag to enforce shmem THP in hugepage_vma_check() Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 02/10] mm/khugepaged: attempt to map file/shmem-backed pte-mapped THPs by pmds Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 03/10] mm/madvise: add file and shmem support to MADV_COLLAPSE Zach O'Keefe
2022-09-26 18:39 ` Yang Shi
2022-09-27 1:24 ` Zach O'Keefe [this message]
2022-09-22 22:40 ` [PATCH mm-unstable v4 04/10] mm/khugepaged: add tracepoint to hpage_collapse_scan_file() Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 05/10] selftests/vm: dedup THP helpers Zach O'Keefe
2022-09-27 15:34 ` Zi Yan
2022-09-27 16:32 ` Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 06/10] selftests/vm: modularize thp collapse memory operations Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 07/10] selftests/vm: add thp collapse file and tmpfs testing Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 08/10] selftests/vm: add thp collapse shmem testing Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 09/10] selftests/vm: add file/shmem MADV_COLLAPSE selftest for cleared pmd Zach O'Keefe
2022-09-22 22:40 ` [PATCH mm-unstable v4 10/10] selftests/vm: add selftest for MADV_COLLAPSE of uffd-minor memory Zach O'Keefe
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=CAAa6QmTrAQQBqL7ry6_Mpg0D8C1uNDtfhjkzFyZz2+G_VXmGdQ@mail.gmail.com \
--to=zokeefe@google.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=ckennelly@google.com \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=jthoughton@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linmiaohe@huawei.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=patrickx@google.com \
--cc=peterx@redhat.com \
--cc=rientjes@google.com \
--cc=rongwei.wang@linux.alibaba.com \
--cc=shy828301@gmail.com \
--cc=sj@kernel.org \
--cc=songliubraving@fb.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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