From: zhong jiang <zhongjiang@huawei.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: mhocko@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/huge_memory: fix the memory leak due to the race
Date: Wed, 22 Jun 2016 10:55:24 +0800 [thread overview]
Message-ID: <5769FE1C.9070102@huawei.com> (raw)
In-Reply-To: <20160621152920.GA7760@node.shutemov.name>
On 2016/6/21 23:29, Kirill A. Shutemov wrote:
> On Tue, Jun 21, 2016 at 11:19:07PM +0800, zhong jiang wrote:
>> On 2016/6/21 22:37, Kirill A. Shutemov wrote:
>>> On Tue, Jun 21, 2016 at 10:05:56PM +0800, zhongjiang wrote:
>>>> From: zhong jiang <zhongjiang@huawei.com>
>>>>
>>>> with great pressure, I run some test cases. As a result, I found
>>>> that the THP is not freed, it is detected by check_mm().
>>>>
>>>> BUG: Bad rss-counter state mm:ffff8827edb70000 idx:1 val:512
>>>>
>>>> Consider the following race :
>>>>
>>>> CPU0 CPU1
>>>> __handle_mm_fault()
>>>> wp_huge_pmd()
>>>> do_huge_pmd_wp_page()
>>>> pmdp_huge_clear_flush_notify()
>>>> (pmd_none = true)
>>>> exit_mmap()
>>>> unmap_vmas()
>>>> zap_pmd_range()
>>>> pmd_none_or_trans_huge_or_clear_bad()
>>>> (result in memory leak)
>>>> set_pmd_at()
>>>>
>>>> because of CPU0 have allocated huge page before pmdp_huge_clear_notify,
>>>> and it make the pmd entry to be null. Therefore, The memory leak can occur.
>>>>
>>>> The patch fix the scenario that the pmd entry can lead to be null.
>>> I don't think the scenario is possible.
>>>
>>> exit_mmap() called when all mm users have gone, so no parallel threads
>>> exist.
>>>
>> Forget this patch. It 's my fault , it indeed don not exist.
>> But I hit the following problem. we can see the memory leak when the process exit.
>>
>>
>> Any suggestion will be apprecaited.
> Could you try this:
>
> http://lkml.kernel.org/r/20160621150433.GA7536@node.shutemov.name
>
I fails to open it. can you display or add attachmemts ? :-) thx
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-06-22 2:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 14:05 zhongjiang
2016-06-21 14:32 ` kbuild test robot
2016-06-21 14:37 ` Kirill A. Shutemov
2016-06-21 15:19 ` zhong jiang
2016-06-21 15:29 ` Kirill A. Shutemov
2016-06-22 2:55 ` zhong jiang [this message]
2016-06-22 9:52 ` zhong jiang
2016-06-21 14:37 ` Michal Hocko
2016-06-21 14:42 ` kbuild test robot
2016-06-21 14:57 zhongjiang
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=5769FE1C.9070102@huawei.com \
--to=zhongjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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