linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Harry Yoo <harry.yoo@oracle.com>, Vlastimil Babka <vbabka@suse.cz>
Cc: rientjes@google.com, cl@gentwo.org, akpm@linux-foundation.org,
	roman.gushchin@linux.dev, willy@infradead.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] mm/slab: fix folio_test_{anon,ksm}() false positive on slabs
Date: Thu, 12 Jun 2025 14:44:43 +0200	[thread overview]
Message-ID: <65505f1f-90e7-4cf5-9e81-0036892a505a@redhat.com> (raw)
In-Reply-To: <aEgwhbOnpEv1dlSF@hyeyoo>

On 10.06.25 15:17, Harry Yoo wrote:
> On Tue, Jun 10, 2025 at 03:03:12PM +0200, Vlastimil Babka wrote:
>> On 6/10/25 14:38, Harry Yoo wrote:
>>> On Mon, Jun 09, 2025 at 04:22:01PM +0200, Vlastimil Babka wrote:
>>>>> With the change, the nonsense slab pages disappear:
>>>>>
>>>>>    $ sudo ./page-types | grep slab
>>>>>    _______S___________________________________	slab
>>>>>
>>>>> Fixes: 130d4df57390 ("mm/sl[au]b: rearrange struct slab fields to allow larger rcu_head")
>>>>> Signed-off-by: Harry Yoo <harry.yoo@oracle.com>
>>>>> ---
>>>>>
>>>>> No Cc: stable because we don't usually check folio_test_anon() on slabs.
>>>>
>>>> Hmm maybe we could just make the code generating /proc/kpageflags stop
>>>> testing/reporting those "flags" for slab pages?
>>>>
>>>> It could be even more future proof code for when struct slab is separated.
>>>
>>> Not sure if I follow. When struct slab is separated, checking if a memdesc
>>> refers to slab or not will not have false positives, and thus no need for
>>> "must check folio_test_slab() before checking folio_test_anon()" rule?
>>
>> Not sure I follow either. I mean today we can add code testing
>> folio_test_slab() and only evaluating the mapping flags (ksm, anon) if it's
>> not slab. Once we convert to memdescs, that code will stay logically the
>> same even the testing functions will be named differently, no?
> 
> Ah, I thought you were saying it is unnecessary to fix folio_test_slab()
> false positives as long as we always check folio_test_slab() before
> folio_test_anon().

Yes, relevant code should do that. And we already do it at a couple of 
places (e.g., folio_expected_ref_count()).

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-06-12 12:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-09 13:27 Harry Yoo
2025-06-09 14:12 ` Harry Yoo
2025-06-09 14:22 ` Vlastimil Babka
2025-06-10 12:38   ` Harry Yoo
2025-06-10 13:03     ` Vlastimil Babka
2025-06-10 13:17       ` Harry Yoo
2025-06-12 12:44         ` David Hildenbrand [this message]
2025-06-09 16:06 ` Christoph Lameter (Ampere)
2025-06-10 12:39   ` Harry Yoo

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=65505f1f-90e7-4cf5-9e81-0036892a505a@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=harry.yoo@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --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