From patchwork Mon Dec 5 09:17:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 9460685 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 C483560236 for ; Mon, 5 Dec 2016 09:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFD3224DA2 for ; Mon, 5 Dec 2016 09:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A43F826242; Mon, 5 Dec 2016 09:20:51 +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 3EC9824DA2 for ; Mon, 5 Dec 2016 09:20:51 +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 1cDpQZ-0001i8-Q0; Mon, 05 Dec 2016 09:19:15 +0000 Received: from mail-db5eur01on0066.outbound.protection.outlook.com ([104.47.2.66] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cDpQF-0001Uq-Rw for linux-arm-kernel@lists.infradead.org; Mon, 05 Dec 2016 09:19:00 +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=z7xGeUFTo2k67D+BFoQfpi4Nk5Hg2LWkQcyqsxUPhaQ=; b=qRKXa8KuiCyRLgNbV502AfmLTAm4rcVOr2Tn0rUyqpxssFn2qMnOkh0Ntb8T7XhXYqlLuvb1XZQcXcbDgMi2tLmxYMjeR3//n+YAexK0nh8C9hW5V3B/cTklk4mzo4RNw5iVPEL78rwUbDrycdaxQ3wFDby3/n+UZnaIRA7fVdE= Received: from DB6PR0801CA0064.eurprd08.prod.outlook.com (10.169.219.32) by VI1PR0801MB1856.eurprd08.prod.outlook.com (10.168.68.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9; Mon, 5 Dec 2016 09:18:32 +0000 Received: from AM1FFO11FD006.protection.gbl (2a01:111:f400:7e00::178) by DB6PR0801CA0064.outlook.office365.com (2603:10a6:4:2b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Mon, 5 Dec 2016 09:18:31 +0000 Authentication-Results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; kvack.org; dkim=none (message not signed) header.d=none; kvack.org; 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 AM1FFO11FD006.mail.protection.outlook.com (10.174.64.68) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.734.4 via Frontend Transport; Mon, 5 Dec 2016 09:18:31 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1097; 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, 5 Dec 2016 09:18:02 +0000 From: Huang Shijie To: , Subject: [PATCH v3 3/4] mm: hugetlb: change the return type for some functions Date: Mon, 5 Dec 2016 17:17:10 +0800 Message-ID: <1480929431-22348-4-git-send-email-shijie.huang@arm.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1480929431-22348-1-git-send-email-shijie.huang@arm.com> References: <1480929431-22348-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)(189002)(199003)(5003940100001)(92566002)(8676002)(106466001)(356003)(47776003)(246002)(4326007)(39850400001)(50226002)(36756003)(39840400001)(5001770100001)(305945005)(48376002)(86362001)(8936002)(189998001)(7846002)(50466002)(39410400001)(6636002)(7416002)(626004)(38730400001)(77096006)(39450400002)(50986999)(26826002)(76176999)(33646002)(104016004)(6666003)(2950100002)(5660300001)(2906002)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0801MB1856; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD006; 1:aAc9ekWxU7UYawbwEaSFFbtzmzOSInCqqtLTdimlArHv6o9mZBACGcs7vK9liyp9FYnd7y109zCdGODGcDsy7y6bIq8n1fgwRpDDy1jwdTLxzDKrwzqJ8rC4zLqCNVC4YhFD4bMyL+0OJrZNTJzFqWkQX8F3kW42eN4bCgqSBOrHhK7r3+53pv2hWORBVF313Yn9njIX+vldjx2Q9h9AmOXli5DqxOL7Utesq5Kr06KpxonPrL6nUJJfcLqr1orpJm5EJgcIBgS1lSH5NHcYLjs9zetuhZehe7ZPHtGxhcF11IhDcEAKy6gXSllbHBd2BnfGyk/POiF4Vxo4WeZze0DmRZliZwbdHKJbkVT59Gvx8qoDMol/eLQ8xUDoemgGxBvR74UYu1neFKpfX8MQAi8s3aAI8jPXPJbdkNfejBRMufeFXlQctvYaUgKqrGJLcF5CQhngAiDOpNom3jR8aSJqzAW5NgPusg+YMn8Rz+y8ntMqpdjJiS5gxtMViG3n21F+GJ7SrIe0CJ9WtSHidBGIbPhs/n3r00wv6MJC38RWeUIQboKZoZ/QyukMR4Jn3e7a2jLk9/b8UCUvEWg3RJ5POawkkgO9HaE2omPKXqd6xxuXn6T0vzimHU1nzw8KWVA98nTTzIZnn1ebMR+XmfATx6zHPSv/CByVkM6QWro= X-MS-Office365-Filtering-Correlation-Id: 28b73051-5040-46ea-0583-08d41cefae82 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:VI1PR0801MB1856; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1856; 3:OmkdUI38fBEoljxK2LqXAY8UxuG1tKANhf55P1RVAEBPJU7o+W96RS7wu1bC0jqW6n2cYdG+DV+YT6qOKHxsG9d1ZS5ykQ4RMYPk4/EypMh0a/SRfFeui62Ag4eGjRawPgMgVy6/hNgAqH4pzL69CcIZ4w/MOwADJ4ivQFt1RuVICO4VUCR3mUyEcO0xAaibwHTREmG8nPThj497uwdrwsHa62E9SsX73dLCOnI0ck43rXbarbAKSvOuUzgM/Y77YyQFJNC0TNeKPQDU7i2/R5nHCpD/8CwRWefyeh6sppoBiz2MQQZ3eJ+59MLsGwv7x52KvkelVkH0qIHvgV57RxRzXG0U0I/hRkaqmnthCGa65x21nIShRY3GLaZeujK0pNYbLiBDTC7yOqD5Dg+law==; 25:mnzEGwNm+EvbdI0/0lZLQMTn5UuF0yIdpxJ52SxdnHsh6O0XLfBIfbhDz4NZxvg7aHW5S5EfynDk6y6tR/qvRplE6/ojoxuylBEVqnAuBT3RlPkEazuUtr4z5xLI8goHTHL/9xAMIoQWkT4tuqv1BHzvd1LAP6e61kvcOvTwTSyvb4/xGqArda3UUxt6/zNEw5Bb2vjThUMjTQZ3APfC1dQlv6bMI9APXIqEQR6BErWpyMTZ4ihuKr+sObDhbtruw1fTCEydsUIj7j/3nJnvp1dVqfXFVSrvBpEgx5TEB1tfyC9O6s7UV1EZqoOhi9aa8W/AH6KmVnff0P9ngkAbySgIBrrcP6m13r6tE/4/cOE50E82yjPmr1Oe3AT//c5M4Z2ckfcdX93/K4fr+3aUqT2iUZonBNvLx+EwwhY+Xy+iI39qgFSYSZMqcRojg21y50fQcuikTx4xuuwJtxSBkg== X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1856; 31:BED0MmbvTcYyhOuqd6awmuXq6Awyk/Fm7cacltkoh0WMEq5YnOnrfINQFKoYr5+RD9N8WWSnYNH1XJD60ZXTkeAeWEm9P/8bQ6+a3MLqZt5aUc86mka5w6wk0Sy6e7mas9nfo2SHCJqmSvjdxCLHEArGFunFWcu02le57wOjEyn3QD+qd39++6Uraqlz9LhsbODPqaaGC/xTejVmSXfRoXCjvMuMtV6YsaF2X6Q4V4SXr5Rd5hzGOZhCYcEP0JK5L/td0veJKA4O/wobumDWVlT1MBipBlN9ppuEl/3ucY0=; 20://ek7gBACmIp33/9RIWfwlEuwlZ6tpy317XcWJyjrxIlYvKS+Hue2CPhZcKSnez5k/y36r8uNnOibu+pBmYJL59R+9es9HW62U+FaSPY1l+KgRm0bQxjv/X/IF7K2f0IKoSAL6fjYC/WJi6X5JMEWZC8WaYAf9/T89qkGIcvaJyH+zFLqLVrDtZ+/nW+39X9TcFOCMBZQ6PT2tUeGTTt3R5CSmj7wkI6v+hr/yTyfY4xQr1BJOGPB7Izz3EkxRZO NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13013025)(13024025)(13023025)(13020025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(6072148); SRVR:VI1PR0801MB1856; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1856; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1856; 4:UrXckpSHWq46D5d8avxxCDCEb+a/l/r0yhqLjiMOysLyLYPL/yKRqYbyQXhVmvxYthPNpe1DqlNE9temXcXeXsAWZt6NWtOHZl7umBZR5+4SoOy7/Rq7raaDrffnM6nptzd766te8je0eb/hTlzIMp8DOfxYGiJYnGhiMb4OmgNvngmkECXj5jo8929E66eOauvhFhboi3J7tDSXd8E9cuJ+uH8HYlYFlVA5D1xot6oaZ3xBknJKIBO/9hRMa9mndfxim99QMiZLwtvdXucXED689NyXqdL6ZnL/uUdoMc/K1Q4SuK6bygSIgmHKZTJh7TE43CDmktmREDQKLiSZvG02JmXmLOxCzBLsQKNotWTAT6S57uau7FFNpwOmzL1Xq+7qkspd8pELBPhW8XPKRSGsAZ7Wt6lgGB5uB7LmbY/cd43S6Xaofd8UYQ2AuLD+WGixBTCbmqNtJr6zBHA6GAWhBYenr+52sjKy8ZtT4IVrBZLloX9V0Jsb1sTx94faTC8+tXfYdI2aAIOLPT/tfaSEbE59fPMUp9K2J1FZfPF6FvQ82EtEmCjHfv0PXvffq2WXA0Rnt8aNxyT04ezTmKOUHFoGxsPzzcL9or9/B3WNkN5PhYaIWdpT8A/c+lqi20VNC4jbVI74ZxNlYHlRwpw21rKw1oNyhqfYqAKEBpVcVg+PhZK6UHONxk5PhhGmFeyh8+SAeSbBJS5qvmlkvw== X-Forefront-PRVS: 0147E151B5 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0801MB1856; 23:X8nY3GH6LRj/WawX/P5pJPAT1QCkSZDuXdrsct6?= =?us-ascii?Q?qmEoX4dxFItjEp90D5kJlVBVKqC1MVCMxRuU0ZuKjFZxoHlWHq8RZ+Wb2K3E?= =?us-ascii?Q?A++XylQEJR0jt8NfVhLfwgwJ8KekBGEOTv3+x7tCixEqH0O6LiVZEyzAm0nU?= =?us-ascii?Q?rNTIE3S3gOGPnBf2eKFYe+48oyVcw78qpt9omkBdPbaZGquyImCvhHJLGc7Q?= =?us-ascii?Q?jpba3prVzAFZnJsnOkx9JVpvfObWPrfBIPG3jan8gNvbxbM6Ww6eTa1ELmwc?= =?us-ascii?Q?MQrbxITH8EA5ES46CB/NL1dlQx0lBH2cq3VWhgBlhAT/Q+eVBOhNUVQg+6zM?= =?us-ascii?Q?PHLLfOPkj5k7pHloU2IbMKWXtpdwmkRuVZwp1aB+VGPuFw4IJTgDfeuiWCie?= =?us-ascii?Q?SQfNnyfQ2OJsTqSc2bJPoybIKSOCJDZJZ62VOFXTAujJPR/kiFrvaX7tBM99?= =?us-ascii?Q?yUW5CZ9l2c6asrsFgtQnfwlVp3eI+M+7zb4vVKxR8yjeHjsMab8YLhXswnkO?= =?us-ascii?Q?q/qskPlyyWpJEqn0XbO5ifrnlw/Th/6NEMl7mwB7VEOgbIsIonsQ2vo5ZUED?= =?us-ascii?Q?URDUvKWLCGi3JacXuyMC3n7FJxWfPq5Qz6ziLd1wcU58V6OYxNfLO7ToIGwT?= =?us-ascii?Q?2lvOrg8ca64d8s6nbLyprD9j/l/+36RZGHzk7Ot6Zpm9MwsxlyRP/ZRgyJG8?= =?us-ascii?Q?E4jrO1tuHmV64C5sTzwUDT6MMKfdS5WR3ZiZoaxTk4hq660EPqgdU5eIoBU5?= =?us-ascii?Q?DJnGmTdMqM3YCIp7TBljM0B3+ElS0Vyo75xL3joz+VhNc6nlDJxRV+5zLp8q?= =?us-ascii?Q?ht5PX/K63PFFe3lcjY/DnOHGA/+HHHVaQsfotBp8Ld93ejHyOLNoSNozblvv?= =?us-ascii?Q?FY9aGhCmOfjJBusR/zxQH5CbnX8ZZJ8MTMUdYpIkbX5iVvLMLPkA3JzXRtm7?= =?us-ascii?Q?CTPi2MMkwMD8b3LBTJPSc937C66ApjXiNFtXuKslKt8dq8QvU/LpqHZnjHZj?= =?us-ascii?Q?TWeFf9pCwNr1UyHN8znHygGmg754csa5YRjjf36GwgLvWYuSVdg6C3IUvX/I?= =?us-ascii?Q?MvM1Kgx5ebf13uEwws4faYk6rdfIb?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1856; 6:mdHqrT1kQkusLhIkRj3bKkenH8obuUirBXse7TLSA38lWoa9ZExKNsZIg+F6vpuFVbYxFb6Q2NsapQNpBJmUCQX3DK9sLOdwxc1ksnLA8xznAXaxkrRtL4P8QBOKTbHilMhzXvJf7tUaE3HyuOO+RrJ9u9HIksDe5KoV496JdqS790gl/NP/ac7EXgL+i29+vlKPR98JvB8MjtUmF/txF4IzviOBQmKl0MKYfK8xl81UUmSF5ZYOt9d0uQr2x539R6CbS7S4eQ80D4YXWZJ1Jh2/fs8JitZVMk8KYt4ULBk+AmH739oTwwPqREXbqU1UlnlcX79H/bt0IiE7CKrfHNNiggrcfLtwo6at1OiF7wK/nQ5Vt4aO3EhH+FtuQun/OQk/64V9EMAT9cvTPgcw5qZH5tE0MxX8YA83rvboo/w9CcKIrYVTemiZEFQO8mmlZwPrp4NZhsX/zERroDi2Pg==; 5:zr6gmQHpjstd7MHel3M/inskK4ZvDJmAuS6/2OvAvhGgtFGm88HjX3We33Sd+8RcVYi8278bdrNcTd+Vsr/r7mzrivdsC1EpKJvd/Aa9a3G/+pzUmAKq1OaQGtTqqhm+maWzestz9DkaMtpGGTCvPESTIu87iU2HbsnYN5d1z70=; 24:DfpFXgAydrJWdRbghwl9yamm/cseHSP5NsXCu4/ptMEVs89e+Si2nLWj78kRApotxPhrMR7cUc301FcwStjPAq1bW239+KglInVkGQRDXXM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1856; 7:hlq0+1BdOFI3xADkeSRyt7a5zoPlH/3XWYfNr0+pCwiKvb5rJ8BcqiNcUn7wVkvXlU0LTNcPjWiLBPR+uyOvacX3+2uj1CaUZD7zXsndr31gsCkk7lm22OQrcTClRMpCK0ubN5ACFGY/Jz6kSnbVWUbm82A9hEAb5QKgynbHBDp8zv6EAYpMN7MZpwVfA9gZMcoLfiZWAvmMK1hNT4P7GWSohzflzDPQFFCq36CMgWjWfBjC459hXwUcnvo3uSsowhigWzpxlC7uoDUpNq2WpsCSUO4ScsLfEpj/o8ie4r9PyIefsHn2tlJVjhmjjN1Vsr+FIni4SXd4Qh8p1ewXowaxrv2pLhpjcyn4VtokSKg0h5JrNmw+S7Ha8Mh0g8h7sHgk+xvji1KX8LMyk5Lzg7rW07ycSM8r/fxDGI8ooJkJ4q4B54fwVeDKxVBVoaPgNbPnC60VtNVgBdSCp91M2g== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2016 09:18:31.4104 (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: VI1PR0801MB1856 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161205_011856_609757_B399A8A4 X-CRM114-Status: GOOD ( 12.64 ) 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, vbabka@suze.cz, 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 changes the return type to "struct page*" for alloc_fresh_gigantic_page()/alloc_fresh_huge_page(). This patch makes preparation for later patch. Signed-off-by: Huang Shijie --- mm/hugetlb.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b7c73a1..1395bef 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1148,7 +1148,7 @@ static struct page *alloc_fresh_gigantic_page_node(struct hstate *h, return page; } -static int alloc_fresh_gigantic_page(struct hstate *h, +static struct page *alloc_fresh_gigantic_page(struct hstate *h, nodemask_t *nodes_allowed, bool do_prep) { struct page *page = NULL; @@ -1157,10 +1157,10 @@ static int alloc_fresh_gigantic_page(struct hstate *h, for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { page = alloc_fresh_gigantic_page_node(h, node, do_prep); if (page) - return 1; + return page; } - return 0; + return NULL; } static inline bool gigantic_page_supported(void) { return true; } @@ -1173,8 +1173,8 @@ static inline bool gigantic_page_supported(void) { return false; } 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, bool do_prep) { return 0; } +static inline struct page *alloc_fresh_gigantic_page(struct hstate *h, + nodemask_t *nodes_allowed, bool do_prep) { return NULL; } #endif static void update_and_free_page(struct hstate *h, struct page *page) @@ -1387,26 +1387,24 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid) return page; } -static int alloc_fresh_huge_page(struct hstate *h, nodemask_t *nodes_allowed) +static struct page *alloc_fresh_huge_page(struct hstate *h, + nodemask_t *nodes_allowed) { - struct page *page; + struct page *page = NULL; int nr_nodes, node; - int ret = 0; for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { page = alloc_fresh_huge_page_node(h, node); - if (page) { - ret = 1; + if (page) break; - } } - if (ret) + if (page) count_vm_event(HTLB_BUDDY_PGALLOC); else count_vm_event(HTLB_BUDDY_PGALLOC_FAIL); - return ret; + return page; } /* @@ -2321,9 +2319,10 @@ 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, true); + ret = !!alloc_fresh_gigantic_page(h, nodes_allowed, + true); else - ret = alloc_fresh_huge_page(h, nodes_allowed); + ret = !!alloc_fresh_huge_page(h, nodes_allowed); spin_lock(&hugetlb_lock); if (!ret) goto out;