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=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 1106EC10F27 for ; Tue, 10 Mar 2020 17:42:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CD5E420727 for ; Tue, 10 Mar 2020 17:42:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD5E420727 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 72F086B0005; Tue, 10 Mar 2020 13:42:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6DF966B0006; Tue, 10 Mar 2020 13:42:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CD626B0007; Tue, 10 Mar 2020 13:42:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 445366B0005 for ; Tue, 10 Mar 2020 13:42:23 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0BEE8180C90AC for ; Tue, 10 Mar 2020 17:42:23 +0000 (UTC) X-FDA: 76580171766.02.hour20_14bc7fcab6562 X-HE-Tag: hour20_14bc7fcab6562 X-Filterd-Recvd-Size: 4628 Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 10 Mar 2020 17:42:22 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id 6so2375211wmi.5 for ; Tue, 10 Mar 2020 10:42:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=k2TPWmwJ3LuGZV9degtM5H3I2TZ2CPy5p7AlAPeRGQE=; b=DuJxtaPgoXriHSy0IoJsl2EIVP8SmaAfABLXeAvSG1D1jlUBC4iyD/TX8cn05JAHJG mB9DclYVd1m2waAYoWaIP+LtozUEfffV3YPDLyIZ4JpMFCY1B1uANSYZCAvCp+X/Ymfo tZqNx+feTIEs5omIUT14g5K4OVNRa4dAmQCDDeDhrb/w0MO3V+59ExPNvp3AMoxqoYV1 UoArGvp50FrHVtAdlPJ6ToqBjFd2A1Xb/4uXu/So2y7FwnRGAghL46Gf1dfOZrigqeWv QitZGBDFNT4zxdF3GBXq1npsdFmf1iQEh631nnem0Bb7gdsKscD84/D65XFQz3DklxLc oPog== X-Gm-Message-State: ANhLgQ1T1yRSFjzOTDiLrkM+76EmosAAtbIaMDBELa3VkEP0rqSYHl6S DBYohr2EwzRAUagUYuZMhF91ZZRo X-Google-Smtp-Source: ADFU+vuvv2lxXdtAYfZdMNvZ2GO3kBSkzQ+7+qf18vTcO8YHUI6ebiZmsHgrY2OR2MqwT2yVJIKF5w== X-Received: by 2002:a1c:b657:: with SMTP id g84mr3165060wmf.107.1583862141358; Tue, 10 Mar 2020 10:42:21 -0700 (PDT) Received: from localhost (ip-37-188-253-35.eurotel.cz. [37.188.253.35]) by smtp.gmail.com with ESMTPSA id c2sm5068246wma.39.2020.03.10.10.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 10:42:20 -0700 (PDT) Date: Tue, 10 Mar 2020 18:42:19 +0100 From: Michal Hocko To: Mike Kravetz Cc: Roman Gushchin , Andrew Morton , Johannes Weiner , linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org, Rik van Riel Subject: Re: [PATCH v2] mm: hugetlb: optionally allocate gigantic hugepages using cma Message-ID: <20200310174219.GY8447@dhcp22.suse.cz> References: <20200310002524.2291595-1-guro@fb.com> <20200310084544.GY8447@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue 10-03-20 10:38:24, Mike Kravetz wrote: > On 3/10/20 1:45 AM, Michal Hocko wrote: > > On Mon 09-03-20 17:25:24, Roman Gushchin wrote: > > >> +early_param("hugetlb_cma", cmdline_parse_hugetlb_cma); > >> + > >> +void __init hugetlb_cma_reserve(void) > >> +{ > >> + unsigned long totalpages = 0; > >> + unsigned long start_pfn, end_pfn; > >> + phys_addr_t size; > >> + int nid, i, res; > >> + > >> + if (!hugetlb_cma_size && !hugetlb_cma_percent) > >> + return; > >> + > >> + if (hugetlb_cma_percent) { > >> + for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, > >> + NULL) > >> + totalpages += end_pfn - start_pfn; > >> + > >> + size = PAGE_SIZE * (hugetlb_cma_percent * 100 * totalpages) / > >> + 10000UL; > >> + } else { > >> + size = hugetlb_cma_size; > >> + } > >> + > >> + pr_info("hugetlb_cma: reserve %llu, %llu per node\n", size, > >> + size / nr_online_nodes); > >> + > >> + size /= nr_online_nodes; > >> + > >> + for_each_node_state(nid, N_ONLINE) { > >> + unsigned long min_pfn = 0, max_pfn = 0; > >> + > >> + for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { > >> + if (!min_pfn) > >> + min_pfn = start_pfn; > >> + max_pfn = end_pfn; > >> + } > > > > Do you want to compare the range to the size? But besides that, I > > believe this really needs to be much more careful. I believe you do not > > want to eat a considerable part of the kernel memory because the > > resulting configuration will really struggle (yeah all the low mem/high > > mem problems all over again). > > Will it struggle any worse than if the we allocated the same amount of memory > for gigantic pages as is done today? Of course, sys admins may think reserving > memory for CMA is better than pre-allocating and end up reserving a greater > amount. Yes the later is my main concern. It requires to have a deep MM understanding to realize what the lowmem problem is. Even though who might be familiar consider it 32b relict of the past. I have seen that several times wrt. unproportional ZONE_MOVABLE sizing already. -- Michal Hocko SUSE Labs