From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A647C433E0 for ; Fri, 10 Jul 2020 03:14:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7A8F42072E for ; Fri, 10 Jul 2020 03:14:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Ihv/yPG2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A8F42072E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B6E2F6B0002; Thu, 9 Jul 2020 23:14:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B20866B0005; Thu, 9 Jul 2020 23:14:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E7766B0006; Thu, 9 Jul 2020 23:14:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 870906B0002 for ; Thu, 9 Jul 2020 23:14:23 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D98C78248047 for ; Fri, 10 Jul 2020 03:14:22 +0000 (UTC) X-FDA: 77020697964.30.cave27_06027a526ecb Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id AB8CD180B3C8E for ; Fri, 10 Jul 2020 03:14:22 +0000 (UTC) X-HE-Tag: cave27_06027a526ecb X-Filterd-Recvd-Size: 4290 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Fri, 10 Jul 2020 03:13:57 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06A3Cvpt191184; Fri, 10 Jul 2020 03:13:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=LVkgz0YdmriXPrbU9G10n342hyOtAHH8iV0FCyOgr6k=; b=Ihv/yPG23iLYzP7Sg4l7IKpuF48Y+S4YSCIhUkuBczEoUrwWvjH8yMBtf9UiCjjU9ZAa XYuPcPOI/6YxDu+PQa/XBZIWB8JuvlxTkcgp40H4WeqdJERFZp2ptJx8hdEptohb1NPg MYXqm2xiEBpz5I0N9p0lqWKfyJJdqpGoVb3NSKljyJ38ASxOotjKvp70iByDi675KI+a jDG3HmP8PK6ioZaITSmrBQiKTOjCPoaw4DgelpOGuUwxU8IFZxeG7c5tKWsypSKcZB/g XYza1L1TNbvzB4dPNx04UIXW4GYD8c48CyQkMpe4k93IsKgp6vwAX48a2p1oXSaqM6/i kQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 325y0an2c5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 10 Jul 2020 03:13:43 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06A34NbP087260; Fri, 10 Jul 2020 03:11:42 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 325k41gxqw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Jul 2020 03:11:42 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06A3Be8I009396; Fri, 10 Jul 2020 03:11:40 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Jul 2020 20:11:40 -0700 Subject: Re: [PATCH v4] mm/hugetlb: avoid hardcoding while checking if cma is enabled To: Barry Song , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, Jonathan Cameron , Roman Gushchin References: <20200710005726.36068-1-song.bao.hua@hisilicon.com> From: Mike Kravetz Message-ID: Date: Thu, 9 Jul 2020 20:11:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200710005726.36068-1-song.bao.hua@hisilicon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9677 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007100017 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9677 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 malwarescore=0 clxscore=1015 impostorscore=0 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007100018 X-Rspamd-Queue-Id: AB8CD180B3C8E X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 7/9/20 5:57 PM, Barry Song wrote: > hugetlb_cma[0] can be NULL due to various reasons, for example, node0 has > no memory. so NULL hugetlb_cma[0] doesn't necessarily mean cma is not > enabled. gigantic pages might have been reserved on other nodes. > This patch fixes possible double reservation and CMA leak. > > Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages using cma") > Cc: Mike Kravetz > Cc: Jonathan Cameron > Acked-by: Roman Gushchin > Signed-off-by: Barry Song Thank you! Reviewed-by: Mike Kravetz -- Mike Kravetz