Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1427886

Re: [PATCH] mm/huge_memory: fix the memory leak due to the race

From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/huge_memory: fix the memory leak due to the race
Date 2016-06-21 17:40 +0200
Message-ID <rMvWr-7DO-29@gated-at.bofh.it> (permalink)
References <rMuH0-6Vn-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm/huge_memory: fix the memory leak due to the race zhongjiang <zhongjiang@huawei.com> - 2016-06-21 16:20 +0200
  Re: [PATCH] mm/huge_memory: fix the memory leak due to the race Michal Hocko <mhocko@kernel.org> - 2016-06-21 17:00 +0200
  Re: [PATCH] mm/huge_memory: fix the memory leak due to the race "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-21 17:40 +0200
    Re: [PATCH] mm/huge_memory: fix the memory leak due to the race "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-06-21 18:40 +0200
      Re: [PATCH] mm/huge_memory: fix the memory leak due to the race zhong jiang <zhongjiang@huawei.com> - 2016-06-22 05:10 +0200
      Re: [PATCH] mm/huge_memory: fix the memory leak due to the race zhong jiang <zhongjiang@huawei.com> - 2016-06-22 12:10 +0200

csiph-web