On Wed, 10 May 2017, Vlastimil Babka wrote: > 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 :/ OK, thanks for the clarification. julia -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>