Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753898AbdD0LIs (ORCPT ); Thu, 27 Apr 2017 07:08:48 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55477 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965770AbdD0LH0 (ORCPT ); Thu, 27 Apr 2017 07:07:26 -0400 Subject: Re: Freeing HugeTLB page into buddy allocator To: Naoya Horiguchi , Anshuman Khandual References: <4f609205-fb69-4af5-3235-3abf05aa822a@linux.vnet.ibm.com> <20170427055457.GA19344@hori1.linux.bs1.fc.nec.co.jp> Cc: "wujianguo@huawei.com" , Linux Memory Management List , Linux Kernel Mailing List From: Anshuman Khandual Date: Thu, 27 Apr 2017 16:36:20 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170427055457.GA19344@hori1.linux.bs1.fc.nec.co.jp> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17042711-0040-0000-0000-000003101BDE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042711-0041-0000-0000-00000C881C2B Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-27_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704270188 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1499 Lines: 42 On 04/27/2017 11:24 AM, Naoya Horiguchi wrote: > On Tue, Apr 25, 2017 at 02:27:27PM +0530, Anshuman Khandual wrote: >> Hello Jianguo, >> >> In the commit a49ecbcd7b0d5a1cda, it talks about HugeTLB page being >> freed into buddy allocator instead of hugepage_freelists. But if >> I look the code closely for the function unmap_and_move_huge_page() >> it only calls putback_active_hugepage() which puts the page into the >> huge page active list to free up the source HugeTLB page after any >> successful migration. I might be missing something here, so can you >> please point me where we release the HugeTLB page into buddy allocator >> directly during migration ? > > Hi Anshuman, > > As stated in the patch description, source hugetlb page is freed after > successful migration if overcommit is configured. > > The call chain is like below: > > soft_offline_huge_page > migrate_pages > unmap_and_move_huge_page > putback_active_hugepage(hpage) > put_page // refcount is down to 0 > __put_page > __put_compound_page > free_huge_page > if (h->surplus_huge_pages_node[nid]) > update_and_free_page > __free_pages > > So the inline comment > > + /* overcommit hugetlb page will be freed to buddy */ > > might be confusing because at this point the overcommit hugetlb page was > already freed to buddy. > > I hope this will help you. Surely does. Thanks Naoya.