Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5137531ybp; Mon, 14 Oct 2019 16:12:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEOC5R/ktX1HPw61v8yfwG4jjfjc7o9bL8IRAY6AADu/u8rkXk14z8uywZMd8DbKTpjr6S X-Received: by 2002:aa7:cb55:: with SMTP id w21mr30403136edt.163.1571094728771; Mon, 14 Oct 2019 16:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571094728; cv=none; d=google.com; s=arc-20160816; b=UoG/mp1HFoZErWXvPD7vdkH88MseYrBrlzW0n7EndBixIKAjCq0pIbfKKMgUHno3se gkTySipBJ6FF3wmvWBNOLhhq1C0McmEXRdLvM8QxZa7fo5NM9ZNMszk5O/BSCforkomg YLOZE/oO5764dTDxQN7QmnQeFSCsbctM7I1dCH3L1ixuwCzUKcOgtg3dM8HEfK0kcNQO LlBEZlUM8tnb165nl/gtSyC3TjzjgavY1vCkevS5WRSvyGsLj3VKWFT0BvZbFtgPVj4M +Dk6bTgOObT5QJWtWl8+EOlRea+C3waUX3qZ4zuU2LDgI/IU2GAeHEENuzLt2FLjzgSK d1yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=HVDimIMycCCpWVsATfl1aEnKFHWQ4XRLe41kiA9Q/7Q=; b=lJf0n0lX0FDy9T2qUjKQZZNh/9JYgRYY5ee7Q6WgYCTfafe/ar8X04McDV3cEvTCRY 2Xm+aZd1KShaXmsPXLnmKmQOmbw4x6kPWJg4tDSv5Q22XsC6Of0C7V7XqSADPI9MtVNS 0IUUvT+hfOT1XoI+gV2ArAJUyLdFEYGs9CwbeJEloo2zFpE6Nfy7PvkydJngVKV86ppG D4kB8FfURw5vBLUKQuljSSLjZGtEyYjVHa/DXBPoF1QVPNdT/UGSZXOGk8QoDkt8WVVr 8Z72KwVBd/9AxTzLy3FrdT0/kyEZ0deGrGqIlpJ4GXvL70Xe0a2lio1lwVEChwXvxfwy nRsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=fqTzwBDx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si13121780edc.231.2019.10.14.16.11.44; Mon, 14 Oct 2019 16:12:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=fqTzwBDx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388783AbfJNSZj (ORCPT + 99 others); Mon, 14 Oct 2019 14:25:39 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:47808 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731216AbfJNSZi (ORCPT ); Mon, 14 Oct 2019 14:25:38 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9EIJ7R9086769; Mon, 14 Oct 2019 18:25:33 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-2019-08-05; bh=HVDimIMycCCpWVsATfl1aEnKFHWQ4XRLe41kiA9Q/7Q=; b=fqTzwBDx2jq4AsRlWzgxzF7niVnbAde76n7hxnp8CcSnzRFc8mkfDEX79aHCcu5hLPXS o75bDsXzcyyTOAsKyAOiP+YkH0T/0sBHODuZ/AJlCmun5f9m9X/1qEII/coQ3mXyYhRB QBRDEigK33rfpZh79aJfDEm4vt+47EKSibOXSyvWDWlOOX2hM5GiLw8VtSl+jKcOQaFG K9MQk2sNpT2TT3y3VHAUhKqYBIL+ijN6Yz3lb+PwJFI7PU2YK1pT/KyhQdzA3XMxcP3e JOsxpXBF4YzNjLABsQSs59A7udfmfaZknIiGCmoFlz+yppzQFr31tvi4v84KZ75I+tQl lA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 2vk6sqard2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Oct 2019 18:25:33 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9EII7uV022325; Mon, 14 Oct 2019 18:25:33 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2vks079bvy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Oct 2019 18:25:32 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x9EIPWUD001806; Mon, 14 Oct 2019 18:25:32 GMT Received: from [192.168.1.222] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 Oct 2019 18:25:32 +0000 Subject: Re: [PATCH] hugetlb: Add nohugepages parameter to prevent hugepages creation To: "Guilherme G. Piccoli" , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, jay.vosburgh@canonical.com, kernel@gpiccoli.net References: <20191011223955.1435-1-gpiccoli@canonical.com> From: Mike Kravetz Message-ID: Date: Mon, 14 Oct 2019 11:25:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191011223955.1435-1-gpiccoli@canonical.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=9410 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910140150 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9410 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910140150 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/11/19 3:39 PM, Guilherme G. Piccoli wrote: > Currently there are 2 ways for setting HugeTLB hugepages in kernel; either > users pass parameters on kernel command-line or they can write to sysfs > files (which is effectively the sysctl way). > > Kdump kernels won't benefit from hugepages - in fact it's quite opposite, > it may be the case hugepages on kdump kernel can lead to OOM if kernel > gets unable to allocate demanded pages due to the fact the preallocated > hugepages are consuming a lot of memory. > > This patch proposes a new kernel parameter to prevent the creation of > HugeTLB hugepages - we currently don't have a way to do that. We can > even have kdump scripts removing the kernel command-line options to > set hugepages, but it's not straightforward to prevent sysctl/sysfs > configuration, given it happens in later boot or anytime when the > system is running. > > Signed-off-by: Guilherme G. Piccoli > --- > > About some decisions took in this patch: > > * early_param() was used because I couldn't find a way to enforce > parameters' ordering when using __setup(), and we need nohugepages > processed before all other hugepages options. I don't know much about early_param(), so I will assume this works as you describe. However, a quick grep shows hugepage options for ia64 also with early_param. > * The return when sysctl handler is prevented to progress due to > nohugepages is -EINVAL, but could be changed; I've just followed > present code there, but I'm OK changing that if we have suggestions. It looks like you only have short circuited/prevented nr_hugepages via sysfs/sysctl. Theoretically, one could set nr_overcommit_hugepages and still allocate hugetlb pages. So, if you REALLY want to shut things down you need to stop this as well. There is already a macro hugepages_supported() that can be set by arch specific code. I wonder how difficult it would be to 'overwrite' the macro if nohugepages is specified. Perhaps just a level of naming indirection. This would use the existing code to prevent all hugetlb usage. It seems like there may be some discussion about 'the right' way to do kdump. I can't add to that discussion, but if such an option as nohugepages is needed, I can help. -- Mike Kravetz