Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp916206ybh; Tue, 10 Mar 2020 10:43:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvW8pbMp6IE+P9Qa8UzO0tg9v3OKJm/jnqWCnEbFW4MULAeTX5YJQz2LYo6WVwbh5MPPU4i X-Received: by 2002:aca:fcd6:: with SMTP id a205mr2070455oii.28.1583862180294; Tue, 10 Mar 2020 10:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583862180; cv=none; d=google.com; s=arc-20160816; b=PeLf+KZrOEg6B3JqLGPJfA6pLcdNlind/MDKBNTjKEL0JYL/2Uq4Ur3EJ1O/e4dJpt KlwlyIrKBDZ7esN5+NaXywnBu/UIDiTsaAFxHJGV8nHinP9xZeu4tkjkWIdseylBES4p mMUuyN+5hs3pOOl98dkc5McwKeJR3dQhixqGdzKCMzGPlx3tr91f6be5sU2VPLvCbXA0 /golmu2T2O2TdFeLKAGqK3zx6O4MNXVRvLq/QnuoOyPuXFlwd+FOqanvsuul5gl79f7o egaR/yIflEqE6ZvsxTlll3YpOHqPRj0FwvjMxnxr+JwIgQJnjI2iQfjbfCBXjyEBLnrk lulQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=k2TPWmwJ3LuGZV9degtM5H3I2TZ2CPy5p7AlAPeRGQE=; b=NaZ9y/gHJd8K/Rqi1DQOj+7ZSvMKJRNI1EqBC6XQCgw0pJ6kZ4oE77nshqEP2CA0Gj zHeqseOq4UEJ1A2gJuym1LBU/qrxqoAuoNpfNHWpM4A12RXVKXxbkIM5HmUQCUOWDzjU S1wRC6SMnhXlAlIvW5cKw+rGGol4UWvy4y2Dz63m0uZIVqVmiLg5uX7Ry9AEE1BEcFwv vJ9lNwyt2XgqNC7AbSBbMzrki+/0zxWpL08j1USWsD0hmzC6BKPfAI/0+GfAJd3Y6oS/ fMKMX1hGfyI+OhT+CDiTFqyGOOpzNJPq2lxrCM6FTFCqSqBsVbeIAQbsfFvl9rul6AOV vkmg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13si7914445otr.94.2020.03.10.10.42.47; Tue, 10 Mar 2020 10:43:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbgCJRmX (ORCPT + 99 others); Tue, 10 Mar 2020 13:42:23 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51792 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgCJRmX (ORCPT ); Tue, 10 Mar 2020 13:42:23 -0400 Received: by mail-wm1-f65.google.com with SMTP id a132so2387165wme.1 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=W93Bg46Fb9qIpdOV+LxzBmqm/qyGH2vDt8DwdjKis/6NfnL7sl+cG4W2Yx++/YeqyI QLf2FG4pmtv0IDKiaxfKYhXgewVLMuyUJ+6BCczxNGd54RIjPPD5Qz/XkW/w4Rv0CzoR CZOFI0zd6Oqx8qMVgUin3ZN+UoVDfk4vr2YB9N1nSxdH5pxCBJg8aPDj8LOtzdEoraQB tXfJN/hGxvPE3nCaGiwn0Y2SKJZOV/TmogVZcwwtesO7Lf5CLA3FEwKPxo7p5m8Dq2SN fsb+PAB2JkM2LcUjd5ixUsKJBibRh6TM2Tplw7M93Ds+wJP9P0lghvj8DDL+5srUw0Ig zEQA== X-Gm-Message-State: ANhLgQ3ikvlFB88PQzvUY7MqrOvJZph2NqC0QSaj3OHrYivvEUv1Gell waq9k6Y1BwUibXSzbFwGOuU= 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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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