linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: 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:56:41 +0100	[thread overview]
Message-ID: <d863bcc8-ce96-4095-b4ef-4a0da73e985e@redhat.com> (raw)
In-Reply-To: <00edd087-8df6-343a-95bf-ca23381085a8@huawei.com>

On 17.12.24 03:02, Liu Shixin wrote:
> 
> 
> On 2024/12/16 23:34, David Hildenbrand wrote:
>> On 14.12.24 11:44, 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:
>>
>> Are you sure it is "leaked" ?
>>
>> I assume what happens is that we end up freeing a page table without calling its constructor. That's why page freeing code complains about "nonzero mapcount" (overlayed by something else).
> 
> 1. The page table itself will be discarded after reporting the "nonzero mapcount".
> 
> 2. The HugeTLB page mapped by the page table miss freeing since we treat the page table as shared
>      and a shared page table will not be to unmap.

Ah, the page table still maps something, that makes sense. So we're 
leaking that indeed.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-12-17 11:56 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 [this message]
2024-12-16 18:33 ` jane.chu
2024-12-17 11:55   ` David Hildenbrand

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=d863bcc8-ce96-4095-b4ef-4a0da73e985e@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --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