Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1048184ybh; Tue, 10 Mar 2020 13:31:34 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvPuOcJewvfmiJ+sUzndU/OdZw0wbPsvuUh0XJcpvCC8LkDzjgY1kv1A+0nBjFIhMvXfYhY X-Received: by 2002:a05:6830:22ce:: with SMTP id q14mr438502otc.298.1583872294463; Tue, 10 Mar 2020 13:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583872294; cv=none; d=google.com; s=arc-20160816; b=SGrdks0myHZSYBe4Veou4V/jwebMcKOfLx2O006ntnh7JdyeTe5yfDaTWkMzxGv6Wm yA4RchVNx09D1D5SnUp13GZhsUtWzBduTy4zY/v0cfejirk43D0B1e5bnmoAMObTpdZb 0bjpuw0e57Q3mkE2gb6ViaOGomBv19zleLB6tbyC+h31dfQUHNqZjU/mdbH6TiP/c1lW L7Ni97t9QMbBQpx8FPM7ItNB2Z4IJYOGESSxpQePLRCsJl1Z9UyQnJjaDXQD99RCow4p NdgzEAs8Gl3pzfUUS3/XcrHebvRqPo7/3YDmMQnLLgA8xw3Jp+JTu1vuimFnvKIOIMv3 hg8Q== 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=DrfQ0lB3dy1nzGMLhPPmHwa4L9kAgVtVba/L2Jsmdtc=; b=WpTWhJpXF2ZMeUusYyRkMMDGnOUbUAMnuXokVV+AjI3fSbe+hBpU58Fr/1SQuT+wRm PxVZIUgRSjxUeTtkyzNsI6yXJMy+GM5Q9G1ODi91y4h6hRWdsbpTLFhrvGxXC7qWSvV5 8SxL+vh0wEo4e5Y2QSNeIifnMUW9KAiyGSf1SNvbiZRo6pKi2wGLO/VNBPu11WmKnyrp GFqYJSWZFGa7cDQ9S03cVMLWlBE1/fTq45dMhSqtIVgnPeNBBXwZ2bMKLd5rxKltR1fg mkLpgLXpwdVxEABmm99dY6K9KB6uMJbVoIy8nwayWwlLq4F4Ia9qCagJ1zzJpTjeZgtj XfQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=IrBzzs8j; 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 x2si5893806oie.56.2020.03.10.13.31.22; Tue, 10 Mar 2020 13:31:34 -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-2020-01-29 header.b=IrBzzs8j; 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 S1727496AbgCJUab (ORCPT + 99 others); Tue, 10 Mar 2020 16:30:31 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:50790 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbgCJUab (ORCPT ); Tue, 10 Mar 2020 16:30:31 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02AKORGc030331; Tue, 10 Mar 2020 20:29:44 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=DrfQ0lB3dy1nzGMLhPPmHwa4L9kAgVtVba/L2Jsmdtc=; b=IrBzzs8ja+WkDjS+PadjAa5HAdZ3GsdJGKbZCYkN1OoGMkd0kgfBsitjBZ/ck3u5D173 k0vq02Aj9PBql4kCUc6rToEluwe5qGpJGMz5pWGbNzpMSMgYyOAPl9VfZXW+OeIuqTvK liX7D0xXUuRXeqWd9uQrrbaoG66Tu0JWwdBw36e7L4wSgseiPZjIx5hP1fmW6+V0ISw0 5ZkkabdSSa4KlLSj9bJMEVNF9Xw63sQXlq58sM3rgpGMj3MMwiw5OFVbifaBHv1B/HhS zLGMkXuKPMNklG/CfAzjc8eDqTmvnUL2jG52ru+/Tlz6MID0P4n0pnGOAfo++noVr2h6 XQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2ym31ufx1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Mar 2020 20:29:44 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02AKTa8r061306; Tue, 10 Mar 2020 20:29:43 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2yp8ptredq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Mar 2020 20:29:43 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 02AKTCb8021082; Tue, 10 Mar 2020 20:29:12 GMT Received: from [192.168.1.206] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 10 Mar 2020 13:29:12 -0700 Subject: Re: [PATCH v2] mm: hugetlb: optionally allocate gigantic hugepages using cma To: Rik van Riel , Michal Hocko , Roman Gushchin Cc: Andrew Morton , Johannes Weiner , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org References: <20200310002524.2291595-1-guro@fb.com> <5cfa9031-fc15-2bcc-adb9-9779285ef0f7@oracle.com> <20200310180558.GD85000@carbon.dhcp.thefacebook.com> <4b78a8a9-7b5a-eb62-acaa-2677e615bea1@oracle.com> <20200310191906.GA96999@carbon.dhcp.thefacebook.com> <20200310193622.GC8447@dhcp22.suse.cz> <43e2e8443288260aa305f39ba566f81bf065d010.camel@surriel.com> <57494a9c-5c24-20b6-0bda-dac8bbb6f731@oracle.com> <4147bc1d429a4336dcb45a6cb2657d082f35ab25.camel@surriel.com> From: Mike Kravetz Message-ID: Date: Tue, 10 Mar 2020 13:29:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <4147bc1d429a4336dcb45a6cb2657d082f35ab25.camel@surriel.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=9556 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003100119 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9556 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2003100118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/10/20 1:15 PM, Rik van Riel wrote: > On Tue, 2020-03-10 at 13:11 -0700, Mike Kravetz wrote: >> On 3/10/20 12:46 PM, Rik van Riel wrote: >>> >>> How would that work for architectures that have multiple >>> possible hugetlbfs gigantic page sizes, where the admin >>> can allocate different numbers of differently sized pages >>> after bootup? >> >> For hugetlb page reservations at boot today, pairs specifying size >> and >> quantity are put on the command line. For example, >> hugepagesz=2M hugepages=512 hugepagesz=1G hugepages=64 >> >> We could do something similiar for CMA. >> hugepagesz=512M hugepages_cma=256 hugepagesz=1G hugepages_cma=64 >> >> That would make things much more complicated (implies separate CMA >> reservations per size) and may be overkill for the first >> implementation. >> >> Perhaps we limit CMA reservations to one gigantic huge page >> size. The >> architectures would need to define the default and there could be a >> command line option to override. Something like, >> default_cmapagesz= analogous to today's default_hugepagesz=. Then >> hugepages_cma= is only associated with that default gigantic huge >> page >> size. >> >> The more I think about it, the more I like limiting CMA reservations >> to >> only one gigantic huge page size (per arch). > > Why, though? > > The cma_alloc function can return allocations of different > sizes at the same time. > > There is no limitation in the underlying code that would stop > a user from allocating hugepages of different sizes through > sysfs. True, there is no technical reason. I was only trying to simplify the setup and answer the outstanding questions. - What alignment to use for reservations? - What is minimum size of reservations? If only one gigantic page size is supported, the answer is simple. In any case, I think input from arch specific code will be needed. -- Mike Kravetz > Allowing the system administrator to allocate a little extra > memory for the CMA pool could also allow us to work around > initial issues of compaction/migration failing to move some > of the pages, while we play whack-a-mole with the last corner > cases.