[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YlXYzpcTQW8NdTTm@xz-m1.local>
Date: Tue, 12 Apr 2022 15:53:50 -0400
From: Peter Xu <peterx@...hat.com>
To: Alistair Popple <apopple@...dia.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Mike Kravetz <mike.kravetz@...cle.com>,
Nadav Amit <nadav.amit@...il.com>,
Matthew Wilcox <willy@...radead.org>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
David Hildenbrand <david@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Jerome Glisse <jglisse@...hat.com>,
"Kirill A . Shutemov" <kirill@...temov.name>,
Andrea Arcangeli <aarcange@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Axel Rasmussen <axelrasmussen@...gle.com>
Subject: Re: [PATCH v8 02/23] mm: Teach core mm about pte markers
Hi, Alistair,
On Tue, Apr 12, 2022 at 11:22:01AM +1000, Alistair Popple wrote:
> I've been reviewing existing pte_none() call sites and noticed the following:
>
> From khugepaged_scan_pmd():
>
> pte_t pteval = *_pte;
> if (is_swap_pte(pteval)) {
> if (++unmapped <= khugepaged_max_ptes_swap) {
> /*
> * Always be strict with uffd-wp
> * enabled swap entries. Please see
> * comment below for pte_uffd_wp().
> */
> if (pte_swp_uffd_wp(pteval)) {
> result = SCAN_PTE_UFFD_WP;
> goto out_unmap;
> }
> continue;
> } else {
> result = SCAN_EXCEED_SWAP_PTE;
> count_vm_event(THP_SCAN_EXCEED_SWAP_PTE);
> goto out_unmap;
> }
> }
> if (pte_none(pteval) || is_zero_pfn(pte_pfn(pteval))) {
> if (!userfaultfd_armed(vma) &&
> ++none_or_zero <= khugepaged_max_ptes_none) {
> continue;
> } else {
> result = SCAN_EXCEED_NONE_PTE;
> count_vm_event(THP_SCAN_EXCEED_NONE_PTE);
> goto out_unmap;
> }
> }
>
> I think the above could encounter a marker PTE right? So the behviour would be
> wrong in that case. As I understand things the is_swap_pte() path will be taken
> rather than pte_none() but in the absence of any special handling shouldn't
> marker PTE's mostly be treated as pte_none() here?
>
> I think you need to s/pte_none/pte_none_mostly/ here and swap the order of
> conditionals around.
Isn't khugepaged_scan_pmd() only for anonymous?
The shmem side is covered by khugepaged_scan_file(), imho. We definitely
don't want to collapse shmem vma ranges that has uffd-wp registered, and
that's actually handled explicilty in "mm/khugepaged: Don't recycle vma
pgtable if uffd-wp registered". Please feel free to have a look.
Thanks,
--
Peter Xu
Powered by blists - more mailing lists