From patchwork Mon Nov 14 07:07:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 9426667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 71DBF60484 for ; Mon, 14 Nov 2016 07:12:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64664288FA for ; Mon, 14 Nov 2016 07:12:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 590FC2890F; Mon, 14 Nov 2016 07:12:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 00B0F288FA for ; Mon, 14 Nov 2016 07:12:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c6BPE-00028B-7z; Mon, 14 Nov 2016 07:10:16 +0000 Received: from mail-eopbgr50084.outbound.protection.outlook.com ([40.107.5.84] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c6BOL-0000se-BN for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2016 07:09:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GVQvIHcwB3PPeCyKWiD2FIyxYauXEN+y9MnLCQlGvPA=; b=f+uFO/MaZG318axVop6P++/q4011Xe3EB8XLIazguBRMLl8OIo/dC3a+NHYMVKOmdCgU1P4adTaomYKSfbwuF0ULBOQsusHcT/apJTRIzNmW/dri0z9wZJrRYaRIb6GvKNSKgMzd9jt8ombxAjlwr+lcM4V5LQNaaD/gZfg5eXw= Received: from AM2PR08CA0034.eurprd08.prod.outlook.com (10.162.32.44) by VI1PR0801MB1791.eurprd08.prod.outlook.com (10.168.67.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.721.10; Mon, 14 Nov 2016 07:08:56 +0000 Received: from DB3FFO11FD015.protection.gbl (2a01:111:f400:7e04::133) by AM2PR08CA0034.outlook.office365.com (2a01:111:e400:843e::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6 via Frontend Transport; Mon, 14 Nov 2016 07:08:56 +0000 Authentication-Results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; oracle.com; dkim=none (message not signed) header.d=none;oracle.com; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 217.140.96.140 as permitted sender) receiver=protection.outlook.com; client-ip=217.140.96.140; helo=nebula.arm.com; Received: from nebula.arm.com (217.140.96.140) by DB3FFO11FD015.mail.protection.outlook.com (10.47.216.189) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.721.5 via Frontend Transport; Mon, 14 Nov 2016 07:08:56 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1075; Count:13 Received: from sha-win-210.shanghai.arm.com (10.1.2.79) by mail.arm.com (10.1.105.66) with Microsoft SMTP Server id 14.3.294.0; Mon, 14 Nov 2016 07:08:37 +0000 From: Huang Shijie To: , Subject: [PATCH v2 2/6] mm: hugetlb: add a new parameter for some functions Date: Mon, 14 Nov 2016 15:07:35 +0800 Message-ID: <1479107259-2011-3-git-send-email-shijie.huang@arm.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479107259-2011-1-git-send-email-shijie.huang@arm.com> References: <1479107259-2011-1-git-send-email-shijie.huang@arm.com> MIME-Version: 1.0 X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:217.140.96.140; IPV:CAL; SCL:-1; CTRY:GB; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(336003)(199003)(189002)(36756003)(86362001)(106466001)(26826002)(104016004)(5003940100001)(586003)(246002)(8676002)(305945005)(356003)(189998001)(7846002)(50226002)(8936002)(5001770100001)(50466002)(48376002)(47776003)(77096005)(33646002)(5660300001)(6636002)(2950100002)(626004)(92566002)(76176999)(2906002)(50986999)(87936001)(4326007); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB1791; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD015; 1:Ikxx6ye9VSzQH7ROLOXUlk2JzvaxdT0KpvyziTDHesywShOBRwBvFMLk0A0JZkdq2Ow37kTnjQqYzSzgpff77+20Y7TLRHZDi21CLxUXix0oSUJe/i0LKUmIAAtWzx7UN7JkL7CGGQ3hcbrT0GBDlB2DFWFZjT2o65xL+0IJeV8NW0E7XBTydn3rAUgxjdel2Ww/A3V8nsUHhsa0J0u+vgFT3ej6rngqKKUZVEbHIyLrsxWtWNYDDr76RK7SsbeMtP/tph9PgxJ2DM90v7Isf9gA6rsPd+vlMYCgxMIRHKGr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iQM4NlVRjimxZ/41BpV8+EJplj8Lt0gGaV7U4oKfqMUcnHxjgWUB3Ybu+c6BhZF/4atyWmWlTQcHzeUvY51jDAUfJjFJW4Uo/y5XwOsxvpBozJXE/xVzfvUnfKbs+U+aryVpYpiv2mDgX68zhbsldIpxY0dOCHZnmuhAAZCrgRqMQ3qpbws0D7/gxQ+tbE9ZNv7Q9lzmXVXnV9FsQbpb9ZjMA+diIohcbEJpCWVgV26SNJybIo/wXU5ZdAAo= X-MS-Office365-Filtering-Correlation-Id: dbff12da-51c4-4721-8833-08d40c5d1978 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:VI1PR0801MB1791; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1791; 31:4gku2hWSAo9g8kLJzqkuc4IPEJvsJ9SQHeFyFlxjUiwF5NjRNMp3yc0SP5xueYoPvTa6/SRhJl8TEUDtkq6ZbTbN+I4Gq9ZEDQWXZBi6e+jfk+CPQjvoqba3JtuHxznXUxlD36LacYT5xWX3EchpG1m//DQy3kaG41lBxzKcg4nTHf5FQPSIBVGTX6aq5KMp/wgJDCAGVUC+7w/YNRXZJkybvovDdqfsbEKH+eZqWGNKWIVIyWuvOIQaHgVQ1WsWHOKmt4d63RtzvHudrvSYWA==; 20:gDpvhV7wxg2QG4d+x+oeXDtURq3grd1Nkx5gaVHVen1fNfNSndtWonr01hvUjtLbRvY+9fNeEoHNzrqXFemWOkGbvuyin/15JrrrpIdyKCOeZ7/cwn4YsX09bJVEhQD1zfI+F8AdzmMp6FFVDP0rFB+ojGNSJw3Bv5wVtjY8UI/2GYDVFNrE/olYCaVM6aMHMkyCnYmmY2+IzBeOtIVs5853RjpFNfJ8kLuGQmGfOFtzY8LQN0D2M1wNO9QD04ah NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13024025)(8121501046)(5005006)(13023025)(13020025)(13013025)(10201501046)(3002001)(6055026); SRVR:VI1PR0801MB1791; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1791; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1791; 4:VO2kRlhQR5ErhLalhLOmCQXNpze5Gf+9A/bqrLvkO4OADE51FgrA1sDRgQy7yHAphON5DHAtr+nPH5KfYp17+yq63c4O/S97q/0KWDkFM3MlBOy9uGx+dtiNgYp1wflpg1H1XQqO6kCI3rXZfKc38jyWAZZU4wm4O3GaWrRmvHB4ANbs8H0g7BMieoRXsXtpMo5nFOdJgHHowtr3aVkgGZTt0P6Dg4qb6i9tFnFYsfvFXRCzJOr3tCvWPthvWSj2350j4CV/GZZJ1MgNVf2WrjZGPXDX9Sn4G1ya3yJVkLfXNsYGzvY2nPxXu8jVFtj/S2PedC29UPfaz7jgf/PQMW+h17AdJb1SbFLDBg2Jt0LnHLWNglf15YQyvE4EjDfLfl7q98TzV02+BxAkMuEE+YcpRQYhI2ahNA4vbTW3NbzL8sIKM4mWw5BJ7FWP3lJjTbms+su9MH3haXW/KzBcx5u7EkLfmQt7AKMIynYrV92RNAPtNElSAFV6Jhze2hzfTuN2pn7oKrog1FbAdwda8S/pWQpGscx3k+VdzqxqOLY= X-Forefront-PRVS: 0126A32F74 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1791; 23:BL5BWRoLfPTi//bk/388oAMkziu4/CBfWwgYeJI?= =?us-ascii?Q?POFqs/la1UJZY2Krq6hzj8O1qL/54hzBRyQlHUER+2fmME7KN/P0WTi4l5gX?= =?us-ascii?Q?R3IFzSqeL3NEgaqyzwy1oQleDcRtZymLvA4TBHZG7VuUfs/Uvetw9xPt/LmL?= =?us-ascii?Q?Yzb06EYQ+S1CVwJ34oC32eQMrwsvKwNMu09XfSUOBq1eG7tLTG4BKXS+3+P6?= =?us-ascii?Q?5Qp2yHo6P+guppWJDyjLA7aZY8tgH5dU3G3OP/rvum/bzh3QRsJrqNdz6MK+?= =?us-ascii?Q?iirBaZiyFuy2ga45C4NCkVAY1nBpFCky9vG5WNKGa+mvIHI5+nH72nHvJHgl?= =?us-ascii?Q?m/dDvyldsu8x4Q2wmKopzyU/lSp1iLovxgxBSQBIW7AZ4K2hyA8cn6ThFyl3?= =?us-ascii?Q?3QUlSjfMRwHQA0YcW9LLLNKKwMQG6MjUtCjm8Fr6ZmV+pRVA3cUvLzUyJlWA?= =?us-ascii?Q?hTrIJ90AsNY370lSIdHkKDVFjWwiMNulhJJCgbtPnF1rxw6GuQF4euoh1pyr?= =?us-ascii?Q?MN1E/CGyCNlVW9f2yBZBWHXMZROtcw3j/T3Ftri4UcT0jzgqs4tbgWouRV68?= =?us-ascii?Q?jvPY61Rjnz2hq/cL2OWruhwYPZ5EobGS2OKUmckcTmBLnWjnH08BKJFsfTKI?= =?us-ascii?Q?YHFncY+uJxfE8HtlU83rbXtcnXHG/L0vsHseRXQXnlL8ih/uFAhhMoVFX7jT?= =?us-ascii?Q?1v+S842qli+bscR8o3C1I8zo341UsCYsPEwKfsX2ueom1NGWRkbIVdDJTBfD?= =?us-ascii?Q?3DqN+6BP7FOutEABorxovHJPNvxAyNTvifG+NkQh8bNMRbgvqlbsccFoCsQI?= =?us-ascii?Q?a52nzX0lJS/OJZQiBrAUJ293qlUDiWMekP6PZb0fvfEfaY033RR1b2PP04Fn?= =?us-ascii?Q?n4TgvwpFM7YhrZvEN5u8vusDb3OACeQEEaEUwIe7lFQfOe+7bI+mTqKVP2zW?= =?us-ascii?Q?mBfrVlVb0wGx6CGyJ4J2FU3khcRAzNqJlSEhEJRiPfw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1791; 6:iQ0uJ98iKhKXpljNzrhOBOOPLbx09zAmbOUJyHrGJF/JxShWhbIrEOxj5IddX2hayCutGs62LrF/RjFDVYfFNlE8RgmbT+4v3/RwnHXm836x8euszp7tghxKhL6rLloK9o2FErxuri+kfOoL0CDD/5T33/KDHozIuGgG0AGTw95F+CnfdGltTXW462NDkN5wuOxubj2YxTt54YwcQPRriEGiXElUjk5LdB0UGb/br6ruSNIcYdroKP4Fbnwbjv7mCVWli4iCRvOeghwf6aC1nv4JO7aNovzBDlv6rQHd3g0mt6Hunuf2jNUlz5YwGI74TWPaigyqTuIaafyP1z039NRQ0n4MoY6z0LGU17gTDoN8Mp7XmA/nikbwTR/d14Dr; 5:FcZenvnD+DmllHaON2mBBdLW4S3JY7i2NLAPflpQdkQ05FvwgMiQ8AWSXoyYeAFber50ioKap2ACHI/59863rcVsbwrr1+/RoHTlSrC4PbYqN3dntULYEB1QjMJnpbRpdkDKj3CYFoe+8zlcQxID7Q==; 24:GkySgzcaH3wvVaDjD2i1cMsIk/OMPMmfEr7qFW4bDkIIqfGGMFhdlcLKJnWphQFwSaQlwcxUW8QUzy6Shv8MimehwS/vf2YevfXNmhCWDDU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1791; 7:97ayamLzf+/xyXwuEcbo0AcONumNjZ28cyWsTPSAqWgzOZVNKZk2gOPtlx3lIv1MZvWWpg5eXg5RRhkhlh8xOnZdhvz+bzvmHGxNbyzFytM3nR4J+Qs5082l2Nf5pWoX0F+3QKmWBIubG5lBdNUca3vnzt7lTSrP1/f560mwySofUysOpHIvcU35JlS/jYUWfYKXPGNja4j4ekGILx+cy5sxfg4rrzMHS9xGnoTgpVwzd1fDtiqyyRjtNasV9EasKvq3YNxbiVkWms8NUt7duUFkUmFm2zk9T+Q4AM96ChZ4oNBth/gErkPVBFn3ao23dEitcQaTBW5tXkUvZqKmXk5gHNtT0PxSVM5eWt9W67A= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2016 07:08:56.2407 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1791 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161113_230922_118142_7F424D23 X-CRM114-Status: GOOD ( 12.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, kaly.xin@arm.com, mhocko@suse.com, kirill.shutemov@linux.intel.com, steve.capper@arm.com, will.deacon@arm.com, linux-mm@kvack.org, aneesh.kumar@linux.vnet.ibm.com, Huang Shijie , n-horiguchi@ah.jp.nec.com, nd@arm.com, gerald.schaefer@de.ibm.com, mike.kravetz@oracle.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a new parameter, the "no_init", for these functions: alloc_fresh_gigantic_page_node() alloc_fresh_gigantic_page() The prep_new_huge_page() does some initialization for the new page. But sometime, we do not need it to do so, such as in the surplus case in later patch. With this parameter, the prep_new_huge_page() can be called by needed: If the "no_init" is false, calls the prep_new_huge_page() in the alloc_fresh_gigantic_page_node(); This patch makes preparation for the later patches. Signed-off-by: Huang Shijie --- mm/hugetlb.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 496b703..db0177b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1127,27 +1127,29 @@ static struct page *alloc_gigantic_page(int nid, unsigned int order) static void prep_new_huge_page(struct hstate *h, struct page *page, int nid); static void prep_compound_gigantic_page(struct page *page, unsigned int order); -static struct page *alloc_fresh_gigantic_page_node(struct hstate *h, int nid) +static struct page *alloc_fresh_gigantic_page_node(struct hstate *h, + int nid, bool no_init) { struct page *page; page = alloc_gigantic_page(nid, huge_page_order(h)); if (page) { prep_compound_gigantic_page(page, huge_page_order(h)); - prep_new_huge_page(h, page, nid); + if (!no_init) + prep_new_huge_page(h, page, nid); } return page; } static int alloc_fresh_gigantic_page(struct hstate *h, - nodemask_t *nodes_allowed) + nodemask_t *nodes_allowed, bool no_init) { struct page *page = NULL; int nr_nodes, node; for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { - page = alloc_fresh_gigantic_page_node(h, node); + page = alloc_fresh_gigantic_page_node(h, node, no_init); if (page) return 1; } @@ -1166,7 +1168,7 @@ static inline void free_gigantic_page(struct page *page, unsigned int order) { } static inline void destroy_compound_gigantic_page(struct page *page, unsigned int order) { } static inline int alloc_fresh_gigantic_page(struct hstate *h, - nodemask_t *nodes_allowed) { return 0; } + nodemask_t *nodes_allowed, bool no_init) { return 0; } #endif static void update_and_free_page(struct hstate *h, struct page *page) @@ -2313,7 +2315,8 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, cond_resched(); if (hstate_is_gigantic(h)) - ret = alloc_fresh_gigantic_page(h, nodes_allowed); + ret = alloc_fresh_gigantic_page(h, nodes_allowed, + false); else ret = alloc_fresh_huge_page(h, nodes_allowed); spin_lock(&hugetlb_lock);