Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp128333imj; Wed, 13 Feb 2019 05:52:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IYg5HsudS2csAAl+sX/YBGlpo15S8wgP7oUNTsJvOPatzZu7moZ3Fk35xFnyO1jTQXhxl2O X-Received: by 2002:a17:902:e307:: with SMTP id cg7mr615702plb.255.1550065979439; Wed, 13 Feb 2019 05:52:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550065979; cv=none; d=google.com; s=arc-20160816; b=wkOTLPVL6/gSgqGyEEpUU5FlsRlO8kc8m5nkNThB6T+b92/GANp1T9xLZTjwDAbKzj NkMFf7oQxB/mLEXYdlRpZlLJx2R9P7R65RmrUIHYeIQIlbuIWmqhx9VpTiEkWOtfVx6V w02IIC4NI4d3y8Kh46TfnQ373xAsngc3vRqTtRev+p3bM0gUvPVqniOm8KsYmUypdGei S1MY98xmWsoXpHGIENvWTzU6si7dMCkBI6aG908UOay7FjIZfhA31TTskTpSxt3ndycY cYwK3LSPyUTxUHREr8qiGof2AYPCunR9CPcqd4kyXr2p7RTkosd9ZMVL2vbgCIcSoSZD BS/Q== 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; bh=BCV6CTHpDJTmmb+R3vkluxUBhHXsiIaPsOO9jAvnwyY=; b=bgUeEBMtA0zAtLm1ePmxA5k+2cxlssvEGlsnWijdD4Y1kK7LvIxJ/g+qOeAQwlxa0X j+d8d61UqB3qExoA/jZ5N7FH85jJ/ChxqVEsceDu1O8HhGCkkWVrQGMOvq+JTtUWaG3S Z+KgedezH/D6Z1QWBj+5XFnULpRKD1obyDRfDkoEm2pM3k08YctzT9jCZhxNIycyEtq2 2ON1nI20eylVUGqaATi58UE2prrGQTbTbpO/Xp/AU9+aFgJgG5vMhgb0+V28DuYHDo7Z VFhEQ2OvaEvqQwVj5YFbS/sCqvyLVynVnaElU8CqDdc41/ku0tL4n9AiaeCrLQPly39l vo7Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l85si769897pfi.272.2019.02.13.05.52.43; Wed, 13 Feb 2019 05:52:59 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391875AbfBML1d (ORCPT + 99 others); Wed, 13 Feb 2019 06:27:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:44960 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727977AbfBML1d (ORCPT ); Wed, 13 Feb 2019 06:27:33 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2EF02ABAC; Wed, 13 Feb 2019 11:27:31 +0000 (UTC) Subject: Re: [PATCH] hugetlb: allow to free gigantic pages regardless of the configuration To: Alexandre Ghiti , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Martin Schwidefsky , Heiko Carstens , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Alexander Viro , Mike Kravetz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: linux-riscv@lists.infradead.org, hch@infradead.org, Alexandre Ghiti References: <20190117183953.5990-1-aghiti@upmem.com> From: Vlastimil Babka Message-ID: <16a6209c-868b-8fd5-a70a-6e0e1ecb62d4@suse.cz> Date: Wed, 13 Feb 2019 12:27:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190117183953.5990-1-aghiti@upmem.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/17/19 7:39 PM, Alexandre Ghiti wrote: > From: Alexandre Ghiti > > On systems without CMA or (MEMORY_ISOLATION && COMPACTION) activated but > that support gigantic pages, boottime reserved gigantic pages can not be > freed at all. This patchs simply enables the possibility to hand back > those pages to memory allocator. > > This commit then renames gigantic_page_supported and > ARCH_HAS_GIGANTIC_PAGE to make them more accurate. Indeed, those values > being false does not mean that the system cannot use gigantic pages: it > just means that runtime allocation of gigantic pages is not supported, > one can still allocate boottime gigantic pages if the architecture supports > it. > > Signed-off-by: Alexandre Ghiti I'm fine with the change, but wonder if this can be structured better in a way which would remove the duplicated "if (MEMORY_ISOLATION && COMPACTION) || CMA" from all arches, as well as the duplicated gigantic_page_runtime_allocation_supported() something like: - "select ARCH_HAS_GIGANTIC_PAGE" has no conditions, it just says the arch can support them either at boottime or runtime (but runtime is usable only if other conditions are met) - gigantic_page_runtime_allocation_supported() is a function that returns true if ARCH_HAS_GIGANTIC_PAGE && ((MEMORY_ISOLATION && COMPACTION) || CMA) and there's a single instance, not per-arch. - code for freeing gigantic pages can probably still be conditional on ARCH_HAS_GIGANTIC_PAGE BTW I wanted also to do something about the "(MEMORY_ISOLATION && COMPACTION) || CMA" ugliness itself, i.e. put the common parts behind some new kconfig (COMPACTION_CORE ?) and expose it better to users, but I can take a stab on that once the above part is settled. Vlastimil