* [PATCH] mm/mlock: Fix WARN_ON_ONCE condition.
@ 2025-02-07 6:04 Liu Ye
2025-02-07 7:09 ` Dev Jain
2025-02-07 9:28 ` Lorenzo Stoakes
0 siblings, 2 replies; 3+ messages in thread
From: Liu Ye @ 2025-02-07 6:04 UTC (permalink / raw)
To: akpm, Liam.Howlett, lorenzo.stoakes, vbabka, jannh
Cc: linux-mm, linux-kernel, Liu Ye
The condition in WARN_ON_ONCE(cpu_online(cpu)) should be !cpu_online(cpu)
to ensure the warning is triggered when the CPU is offline.
Signed-off-by: Liu Ye <liuye@kylinos.cn>
---
mm/mlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mlock.c b/mm/mlock.c
index cde076fa7d5e..40acf7897917 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -224,7 +224,7 @@ void mlock_drain_remote(int cpu)
{
struct folio_batch *fbatch;
- WARN_ON_ONCE(cpu_online(cpu));
+ WARN_ON_ONCE(!cpu_online(cpu));
fbatch = &per_cpu(mlock_fbatch.fbatch, cpu);
if (folio_batch_count(fbatch))
mlock_folio_batch(fbatch);
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/mlock: Fix WARN_ON_ONCE condition.
2025-02-07 6:04 [PATCH] mm/mlock: Fix WARN_ON_ONCE condition Liu Ye
@ 2025-02-07 7:09 ` Dev Jain
2025-02-07 9:28 ` Lorenzo Stoakes
1 sibling, 0 replies; 3+ messages in thread
From: Dev Jain @ 2025-02-07 7:09 UTC (permalink / raw)
To: Liu Ye, akpm, Liam.Howlett, lorenzo.stoakes, vbabka, jannh
Cc: linux-mm, linux-kernel
On 07/02/25 11:34 am, Liu Ye wrote:
> The condition in WARN_ON_ONCE(cpu_online(cpu)) should be !cpu_online(cpu)
> to ensure the warning is triggered when the CPU is offline.
>
> Signed-off-by: Liu Ye <liuye@kylinos.cn>
> ---
> mm/mlock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mlock.c b/mm/mlock.c
> index cde076fa7d5e..40acf7897917 100644
> --- a/mm/mlock.c
> +++ b/mm/mlock.c
> @@ -224,7 +224,7 @@ void mlock_drain_remote(int cpu)
> {
> struct folio_batch *fbatch;
>
> - WARN_ON_ONCE(cpu_online(cpu));
> + WARN_ON_ONCE(!cpu_online(cpu));
> fbatch = &per_cpu(mlock_fbatch.fbatch, cpu);
> if (folio_batch_count(fbatch))
> mlock_folio_batch(fbatch);
No idea about this code path but mlock_drain_remote() is called by
page_alloc_cpu_dead() which expects an offlined CPU according to the
comments.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/mlock: Fix WARN_ON_ONCE condition.
2025-02-07 6:04 [PATCH] mm/mlock: Fix WARN_ON_ONCE condition Liu Ye
2025-02-07 7:09 ` Dev Jain
@ 2025-02-07 9:28 ` Lorenzo Stoakes
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Stoakes @ 2025-02-07 9:28 UTC (permalink / raw)
To: Liu Ye; +Cc: akpm, Liam.Howlett, vbabka, jannh, linux-mm, linux-kernel
On Fri, Feb 07, 2025 at 02:04:48PM +0800, Liu Ye wrote:
> The condition in WARN_ON_ONCE(cpu_online(cpu)) should be !cpu_online(cpu)
> to ensure the warning is triggered when the CPU is offline.
>
> Signed-off-by: Liu Ye <liuye@kylinos.cn>
NACK.
This is a really odd patch to send, if you were right we'd be seeing
constant warnings on this no? And as per Dev, this seems completely wrong?
You also MUST provide more justification if you're going to do something as
crazy as this. An 'it's wrong because I say it is' isn't acceptable on any
level whatsoever.
> ---
> mm/mlock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mlock.c b/mm/mlock.c
> index cde076fa7d5e..40acf7897917 100644
> --- a/mm/mlock.c
> +++ b/mm/mlock.c
> @@ -224,7 +224,7 @@ void mlock_drain_remote(int cpu)
> {
> struct folio_batch *fbatch;
>
> - WARN_ON_ONCE(cpu_online(cpu));
> + WARN_ON_ONCE(!cpu_online(cpu));
> fbatch = &per_cpu(mlock_fbatch.fbatch, cpu);
> if (folio_batch_count(fbatch))
> mlock_folio_batch(fbatch);
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-07 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-07 6:04 [PATCH] mm/mlock: Fix WARN_ON_ONCE condition Liu Ye
2025-02-07 7:09 ` Dev Jain
2025-02-07 9:28 ` Lorenzo Stoakes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox