* [PATCH] mm: teach mincore_hugetlb about pte markers
@ 2023-03-02 22:24 James Houghton
2023-03-02 22:32 ` Peter Xu
2023-03-03 9:10 ` David Hildenbrand
0 siblings, 2 replies; 4+ messages in thread
From: James Houghton @ 2023-03-02 22:24 UTC (permalink / raw)
To: Peter Xu, Andrew Morton
Cc: David Hildenbrand, Axel Rasmussen, Anish Moorthy, linux-mm,
linux-kernel, James Houghton
By checking huge_pte_none(), we incorrectly classify PTE markers as
"present". Instead, check huge_pte_none_mostly(), classifying PTE
markers the same as if the PTE were completely blank.
PTE markers, unlike other kinds of swap entries, don't reference any
physical page and don't indicate that a physical page was mapped
previously. As such, treat them as non-present for the sake of
mincore().
Fixes: 5c041f5d1f23 ("mm: teach core mm about pte markers")
Signed-off-by: James Houghton <jthoughton@google.com>
---
mm/mincore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mincore.c b/mm/mincore.c
index cd69b9db0081..d359650b0f75 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -33,7 +33,7 @@ static int mincore_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr,
* Hugepages under user process are always in RAM and never
* swapped out, but theoretically it needs to be checked.
*/
- present = pte && !huge_pte_none(huge_ptep_get(pte));
+ present = pte && !huge_pte_none_mostly(huge_ptep_get(pte));
for (; addr != end; vec++, addr += PAGE_SIZE)
*vec = present;
walk->private = vec;
--
2.40.0.rc0.216.gc4246ad0f0-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: teach mincore_hugetlb about pte markers
2023-03-02 22:24 [PATCH] mm: teach mincore_hugetlb about pte markers James Houghton
@ 2023-03-02 22:32 ` Peter Xu
2023-03-03 1:50 ` Andrew Morton
2023-03-03 9:10 ` David Hildenbrand
1 sibling, 1 reply; 4+ messages in thread
From: Peter Xu @ 2023-03-02 22:32 UTC (permalink / raw)
To: James Houghton
Cc: Andrew Morton, David Hildenbrand, Axel Rasmussen, Anish Moorthy,
linux-mm, linux-kernel
On Thu, Mar 02, 2023 at 10:24:04PM +0000, James Houghton wrote:
> By checking huge_pte_none(), we incorrectly classify PTE markers as
> "present". Instead, check huge_pte_none_mostly(), classifying PTE
> markers the same as if the PTE were completely blank.
>
> PTE markers, unlike other kinds of swap entries, don't reference any
> physical page and don't indicate that a physical page was mapped
> previously. As such, treat them as non-present for the sake of
> mincore().
>
> Fixes: 5c041f5d1f23 ("mm: teach core mm about pte markers")
> Signed-off-by: James Houghton <jthoughton@google.com>
Acked-by: Peter Xu <peterx@redhat.com>
Thanks, James.
--
Peter Xu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: teach mincore_hugetlb about pte markers
2023-03-02 22:32 ` Peter Xu
@ 2023-03-03 1:50 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2023-03-03 1:50 UTC (permalink / raw)
To: Peter Xu
Cc: James Houghton, David Hildenbrand, Axel Rasmussen, Anish Moorthy,
linux-mm, linux-kernel
On Thu, 2 Mar 2023 17:32:48 -0500 Peter Xu <peterx@redhat.com> wrote:
> On Thu, Mar 02, 2023 at 10:24:04PM +0000, James Houghton wrote:
> > By checking huge_pte_none(), we incorrectly classify PTE markers as
> > "present". Instead, check huge_pte_none_mostly(), classifying PTE
> > markers the same as if the PTE were completely blank.
> >
> > PTE markers, unlike other kinds of swap entries, don't reference any
> > physical page and don't indicate that a physical page was mapped
> > previously. As such, treat them as non-present for the sake of
> > mincore().
> >
> > Fixes: 5c041f5d1f23 ("mm: teach core mm about pte markers")
> > Signed-off-by: James Houghton <jthoughton@google.com>
>
> Acked-by: Peter Xu <peterx@redhat.com>
>
I think I'll add cc:stable to this.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm: teach mincore_hugetlb about pte markers
2023-03-02 22:24 [PATCH] mm: teach mincore_hugetlb about pte markers James Houghton
2023-03-02 22:32 ` Peter Xu
@ 2023-03-03 9:10 ` David Hildenbrand
1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2023-03-03 9:10 UTC (permalink / raw)
To: James Houghton, Peter Xu, Andrew Morton
Cc: Axel Rasmussen, Anish Moorthy, linux-mm, linux-kernel
On 02.03.23 23:24, James Houghton wrote:
> By checking huge_pte_none(), we incorrectly classify PTE markers as
> "present". Instead, check huge_pte_none_mostly(), classifying PTE
> markers the same as if the PTE were completely blank.
>
> PTE markers, unlike other kinds of swap entries, don't reference any
> physical page and don't indicate that a physical page was mapped
> previously. As such, treat them as non-present for the sake of
> mincore().
>
> Fixes: 5c041f5d1f23 ("mm: teach core mm about pte markers")
> Signed-off-by: James Houghton <jthoughton@google.com>
> ---
> mm/mincore.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mincore.c b/mm/mincore.c
> index cd69b9db0081..d359650b0f75 100644
> --- a/mm/mincore.c
> +++ b/mm/mincore.c
> @@ -33,7 +33,7 @@ static int mincore_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr,
> * Hugepages under user process are always in RAM and never
> * swapped out, but theoretically it needs to be checked.
> */
> - present = pte && !huge_pte_none(huge_ptep_get(pte));
> + present = pte && !huge_pte_none_mostly(huge_ptep_get(pte));
> for (; addr != end; vec++, addr += PAGE_SIZE)
> *vec = present;
> walk->private = vec;
Acked-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-03 9:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 22:24 [PATCH] mm: teach mincore_hugetlb about pte markers James Houghton
2023-03-02 22:32 ` Peter Xu
2023-03-03 1:50 ` Andrew Morton
2023-03-03 9:10 ` David Hildenbrand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox