linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Julia Lawall <julia.lawall@lip6.fr>, zhong jiang <zhongjiang@huawei.com>
Cc: akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
	hannes@cmpxchg.org, mgorman@techsingularity.net,
	linux-mm@kvack.org, kbuild-all@01.org
Subject: Re: [PATCH v2] mm: fix the memory leak after collapsing the huge page fails (fwd)
Date: Wed, 10 May 2017 08:48:25 +0200	[thread overview]
Message-ID: <951ad516-b8da-8277-d4ad-141ba3b47bec@suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.20.1705101421530.20213@hadrien>

On 05/10/2017 08:25 AM, Julia Lawall wrote:
> 
> 
> On Wed, 10 May 2017, zhong jiang wrote:
> 
>> On 2017/5/9 23:43, Julia Lawall wrote:
>>> Hello,
>>>
>>> I don't know if there is a bug here, but it could e worth checking on.  If
>>> the loop on line 1481 is executed, page will not be NULL at the out label
>>> on line 1560.  Instead it will have a dummy value.  Perhaps the value of
>>> result keeps the if at the out label from being taken.
>>>
>>> julia
>>   Hi, Julia
>>
>>    it has no memory leak.  so my initial thought is not correct. but I do not know you mean.
>>    The page is local variable.  it aybe a  dummy value. but it should not cause any issue.
>>    is it right? or I miss something.
> 
> I had first been thinking that the if branch was referencing page.  In
> that case, if page were a dummy value, then there could be a problem.  But
> now I see that the branch does not refer to page.  So the question is
> just, if the loop on lines 1481-1491 is executed, is it correct to execute
> the code put_page(new_page)?  Or will result be SCAN_SUCCEEDED in that
> case?

That loop is under "if (result == SCAN_SUCCEED)", so yeah. It also ends
with "*hpage = NULL;", so the put_page(hpage) in khugepaged_do_scan()
won't apply. I see no problem besides the very non-obvious code :/

--
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>

  reply	other threads:[~2017-05-10  6:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09 15:43 Julia Lawall
2017-05-10  5:55 ` zhong jiang
2017-05-10  6:25   ` Julia Lawall
2017-05-10  6:48     ` Vlastimil Babka [this message]
2017-05-10  6:50       ` Julia Lawall

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=951ad516-b8da-8277-d4ad-141ba3b47bec@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kbuild-all@01.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=zhongjiang@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