linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dev Jain <dev.jain@arm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com,
	vbabka@suse.cz, jannh@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, ryan.roberts@arm.com,
	anshuman.khandual@arm.com, aneesh.kumar@kernel.org,
	yang@os.amperecomputing.com, david@redhat.com,
	willy@infradead.org, hughd@google.com, ziy@nvidia.com
Subject: Re: [PATCH] mm/vma: Do not register private-anon mappings with khugepaged during mmap
Date: Thu, 6 Mar 2025 13:14:26 +0530	[thread overview]
Message-ID: <ca1a6d9d-bc0e-4c3a-a9bf-da06801903e0@arm.com> (raw)
In-Reply-To: <20250305223856.bc1a0c90339cf0d353e8be34@linux-foundation.org>



On 06/03/25 12:08 pm, Andrew Morton wrote:
> On Thu,  6 Mar 2025 12:00:37 +0530 Dev Jain <dev.jain@arm.com> wrote:
> 
>> We already are registering private-anon VMAs with khugepaged during fault
>> time, in do_huge_pmd_anonymous_page(). Commit "register suitable readonly
>> file vmas for khugepaged" moved the khugepaged registration logic from
>> shmem_mmap to the generic mmap path. Make this logic specific for non-anon
>> mappings.
> 
> Please fully describe the userspace-visible effects of this bug.

Apologies.

The userspace-visible effect should be this: khugepaged will 
unnecessarily scan mm's which haven't yet faulted in. Note that it won't 
actually collapse because all PTEs are none.

Now that I think about it, the mm is going to have a file VMA anyways 
during fork+exec, so the mm already gets registered during mmap due to 
the non-anon case (I *think*), so at least one of either the mmap 
registration or fault-time registration is redundant.

> 
>> Fixes: 613bec092fe7 ("mm: mmap: register suitable readonly file vmas for khugepaged")
>> Signed-off-by: Dev Jain <dev.jain@arm.com>
> 
> Thanks, I'll add cc:stable.



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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06  6:30 Dev Jain
2025-03-06  6:38 ` Andrew Morton
2025-03-06  7:44   ` Dev Jain [this message]
2025-03-06  8:18 ` Lorenzo Stoakes
2025-03-06 14:32   ` Dev Jain
2025-03-06 16:10     ` Lorenzo Stoakes

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=ca1a6d9d-bc0e-4c3a-a9bf-da06801903e0@arm.com \
    --to=dev.jain@arm.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=anshuman.khandual@arm.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=ryan.roberts@arm.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=yang@os.amperecomputing.com \
    --cc=ziy@nvidia.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