linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
Date: Tue, 5 Sep 2023 04:46:47 +0000	[thread overview]
Message-ID: <57fccd67-39c7-f5c8-ce9c-a6e390ca5d5e@csgroup.eu> (raw)
In-Reply-To: <87a5u1ibwr.fsf@mail.lhotse>



Le 05/09/2023 à 04:36, Michael Ellerman a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Commit 45201c879469 ("powerpc/nohash: Remove hash related code from
>> nohash headers.") replaced:
>>
>>    if ((pte_val(*ptep) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
>> 	return 0;
>>
>> By:
>>
>>    if (pte_young(*ptep))
>> 	return 0;
>>
>> But it should be:
>>
>>    if (!pte_young(*ptep))
>> 	return 0;
> 
> 
> That seems bad :)
> 
> But I don't know off the top of my head where
> __ptep_test_and_clear_young() is used, and so what the symptoms could
> be. Presumably nothing too bad or someone would have noticed?
> 

The two uses in mm/vmscan.c are as follows:

	if (!ptep_test_and_clear_young(args->vma, addr, pte + i))
		VM_WARN_ON_ONCE(true);

So it seems to be expected to never happen.

The only useful place it is used seems to be folio_check_references() 
which is part of the reclaim process. So probably it messes up swap, but 
to what extent ? ppc64e is for embedded systems. Do embedded systems 
have swap at all ?

Also surprising that it is also called from mm/debug_vm_pgtable.c so 
shouldn't we have noticed earlier ? I'll check if it works.

  reply	other threads:[~2023-09-05  4:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-02  8:36 [PATCH] powerpc/64e: Fix wrong test in __ptep_test_and_clear_young() Christophe Leroy
2023-09-05  2:36 ` Michael Ellerman
2023-09-05  4:46   ` Christophe Leroy [this message]
2023-09-05  7:03     ` Christophe Leroy

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=57fccd67-39c7-f5c8-ce9c-a6e390ca5d5e@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.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;
as well as URLs for NNTP newsgroup(s).