Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4431042imb; Wed, 6 Mar 2019 13:15:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyNKqWgo8AZLfw1l9C84CyEasJN1VWilK4SVsGC6KHamFrqMMmNrha06yKxEtjJ+DgxA6Ll X-Received: by 2002:a17:902:2a29:: with SMTP id i38mr9086880plb.110.1551906925816; Wed, 06 Mar 2019 13:15:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551906925; cv=none; d=google.com; s=arc-20160816; b=Hexr1nxQHLS31fAGS7cy6obJYb+Pr1ss1H9T5WGYbIYGrOfrP5157Tet3wKVj9QER6 ZOi9WXtRRMqq6nCvRQXD79+qjMvLbZrbUhxWsyej3wnslNZe1fir+EFPf6vj94HJvJ31 AajTH11CNI7VHgOzhH57OgF2xjU3Hd9fBaYknFjYNQ1RJQDilMDjq9Byev2Fn6d3/XOW PKtpISWZD8k5m/FHDY2uK3hsf0ZO3Vzgo13D/R20iE8kCqoQ4+uvy6/widaeGJzBKTEH 55rZTafbT7Wm65HYZhdhNnXFd2SiO1mTQ4hHmx69Jjdnu5VouwRIkjdNsfEmAuw/XCj1 f3tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=KzrXqJ9dWlFcqjSEWj9nrNesYCPQkjv/4JeaeHLXinM=; b=lWH/OphZgRUoJAWUnYxP1hxw+/8r/eQ84Ho9P6MRpt1w7j7uHCFL23BDtU26Ooq+zq GcFxlpFxb5wG3yUebEijYdbcSipgEWS5qtvavGH1DIixeevgALq49wCBbQl4Zcxc+Ju6 wRTRFEE4+sCej0FI9I3FG2ZjkEw88wayFQLYyDG8BeQGrl1wIxwDw2A3iL47Taf4W9Vp T4XXUi9m0P1+uBfMD85JmhkyKJfM9VOyJH9xVV/h9BvslIILkZHWAEbKnAdIa1/d7JtU JkAMZhc7xVuYoxTzXLtEi4PAitTLzuAAOIUEuIT1yUenZYpHHx30QNu2sTfVIn5NbcQd jUzA== 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 e67si2473326plb.107.2019.03.06.13.15.10; Wed, 06 Mar 2019 13:15:25 -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 S1730468AbfCFUIz (ORCPT + 99 others); Wed, 6 Mar 2019 15:08:55 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:34259 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbfCFUIz (ORCPT ); Wed, 6 Mar 2019 15:08:55 -0500 X-Originating-IP: 79.86.19.127 Received: from [192.168.0.11] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 9B140FF806; Wed, 6 Mar 2019 20:08:07 +0000 (UTC) Subject: Re: [PATCH v5 4/4] hugetlb: allow to free gigantic pages regardless of the configuration To: Dave Hansen , Vlastimil Babka , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Martin Schwidefsky , Heiko Carstens , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Mike Kravetz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org References: <20190306190005.7036-1-alex@ghiti.fr> <20190306190005.7036-5-alex@ghiti.fr> <7c81abe0-5f9d-32f9-1e9a-70ab06d48f8e@intel.com> From: Alex Ghiti Message-ID: <82a3f572-e9c1-0151-3d7d-a646f5e5302c@ghiti.fr> Date: Wed, 6 Mar 2019 15:08:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <7c81abe0-5f9d-32f9-1e9a-70ab06d48f8e@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/6/19 2:16 PM, Dave Hansen wrote: > On 3/6/19 11:00 AM, Alexandre Ghiti wrote: >> +static int set_max_huge_pages(struct hstate *h, unsigned long count, >> + nodemask_t *nodes_allowed) >> { >> unsigned long min_count, ret; >> >> - if (hstate_is_gigantic(h) && !gigantic_page_supported()) >> - return h->max_huge_pages; >> + /* >> + * Gigantic pages allocation depends on the capability for large page >> + * range allocation. If the system cannot provide alloc_contig_range, >> + * allow users to free gigantic pages. >> + */ >> + if (hstate_is_gigantic(h) && !IS_ENABLED(CONFIG_CONTIG_ALLOC)) { >> + spin_lock(&hugetlb_lock); >> + if (count > persistent_huge_pages(h)) { >> + spin_unlock(&hugetlb_lock); >> + return -EINVAL; >> + } >> + goto decrease_pool; >> + } > We talked about it during the last round and I don't seen any mention of > it here in comments or the changelog: Why is this a goto? Why don't we > just let the code fall through to the "decrease_pool" label? Why is > this new block needed at all? Can't we just remove the old check and > let it be? I'll get rid of the goto, I don't know how to justify it properly in a comment, maybe because it is not necessary. This is not a new block, this means exactly the same as before (remember gigantic_page_supported() actually meant CONTIG_ALLOC before this series), except that now we allow a user to free boottime allocated gigantic pages. And no we cannot just remove the check and let it be since it would modify the current behaviour, which is to return an error when trying to allocate gigantic pages whereas alloc_contig_range is not defined. I thought it was clearly commented above, I can try to make it more explicit.