linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: jane.chu@oracle.com, Liu Shixin <liushixin2@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Muchun Song <muchun.song@linux.dev>,
	Kenneth W Chen <kenneth.w.chen@intel.com>,
	Kefeng Wang <wangkefeng.wang@huawei.com>,
	Nanyong Sun <sunnanyong@huawei.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: hugetlb: independent PMD page table shared count
Date: Tue, 17 Dec 2024 12:55:32 +0100	[thread overview]
Message-ID: <c9e45248-089e-4041-8f7e-98203a0831cf@redhat.com> (raw)
In-Reply-To: <a4e938ec-ed63-41bf-8c5b-a3697a0fea04@oracle.com>

On 16.12.24 19:33, jane.chu@oracle.com wrote:
> On 12/14/2024 2:44 AM, Liu Shixin wrote:
> 
>> The folio refcount may be increased unexpectly through try_get_folio() by
>> caller such as split_huge_pages. In huge_pmd_unshare(), we use refcount to
>> check whether a pmd page table is shared. The check is incorrect if the
>> refcount is increased by the above caller, and this can cause the page
>> table leaked:
> 
> hugetlb and THP don't overlap, right?  how does split_huge_pages() end
> up messing up huge_pmd_share() ?
> 
> Am I missing something?
> 

If first grabs a reference to then check if it's a THP. So we can end up 
grabbing anything temporarily.


In general, we'll have to be smarter about what we try grabbing, but 
handling races for now is tricky.

-- 
Cheers,

David / dhildenb



      reply	other threads:[~2024-12-17 11:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14 10:44 Liu Shixin
2024-12-15  5:11 ` kernel test robot
2024-12-15  5:11 ` kernel test robot
2024-12-15  7:45 ` kernel test robot
2024-12-16 15:34 ` David Hildenbrand
2024-12-17  2:02   ` Liu Shixin
2024-12-17 11:56     ` David Hildenbrand
2024-12-16 18:33 ` jane.chu
2024-12-17 11:55   ` David Hildenbrand [this message]

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=c9e45248-089e-4041-8f7e-98203a0831cf@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jane.chu@oracle.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liushixin2@huawei.com \
    --cc=muchun.song@linux.dev \
    --cc=sunnanyong@huawei.com \
    --cc=wangkefeng.wang@huawei.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