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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58B4CC433F5 for ; Mon, 4 Oct 2021 13:01:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10F8261872 for ; Mon, 4 Oct 2021 13:01:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 10F8261872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7551C940010; Mon, 4 Oct 2021 09:01:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7036E94000B; Mon, 4 Oct 2021 09:01:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CB66940010; Mon, 4 Oct 2021 09:01:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id 4F00694000B for ; Mon, 4 Oct 2021 09:01:25 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EF29E8249980 for ; Mon, 4 Oct 2021 13:01:24 +0000 (UTC) X-FDA: 78658766088.04.E72C606 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf01.hostedemail.com (Postfix) with ESMTP id 79082507AAD5 for ; Mon, 4 Oct 2021 13:01:18 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 319A91FDE4; Mon, 4 Oct 2021 13:01:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1633352462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OUdZ/nUYlMda2qgf/QTNrmYQhSZjUvD2BVvzV1p93qg=; b=PlAvfOCalzYQ013C27JLg5Vy+Z/vf/uiwSxm/Bu7hjNt8wwEbE5U/Zfb4Q5zNo6sYv8ILY C2BPI/WuFfsZ0g92iMgEb9/0NuTXgirsFWkBAwQenu8AN1XMDIFExA7ukjd7YB3pRyXBVb CsCEXhrrDH6uOD1RH2MPnr7KI2MyyQM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1633352462; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OUdZ/nUYlMda2qgf/QTNrmYQhSZjUvD2BVvzV1p93qg=; b=j7d7WR2b8JODNDoPphHnSSXZWwz4S5Hp3n8mb1sh/dtyIw6HKEitN96ypyum4uBT9GH0X3 OIkN4WfZ7Tn5WBBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5136313CEE; Mon, 4 Oct 2021 13:01:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wPEiDw37WmGKPAAAMHmgww (envelope-from ); Mon, 04 Oct 2021 13:01:01 +0000 Date: Mon, 4 Oct 2021 15:00:59 +0200 From: Oscar Salvador To: Mike Kravetz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Michal Hocko , Zi Yan , Muchun Song , Naoya Horiguchi , David Rientjes , "Aneesh Kumar K . V" , Andrew Morton Subject: Re: [PATCH v3 1/5] hugetlb: add demote hugetlb page sysfs interfaces Message-ID: References: <20211001175210.45968-1-mike.kravetz@oracle.com> <20211001175210.45968-2-mike.kravetz@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211001175210.45968-2-mike.kravetz@oracle.com> X-Rspamd-Queue-Id: 79082507AAD5 X-Stat-Signature: sne7bqrs8f11nqkytq64epir6tx5w3wd Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=PlAvfOCa; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=j7d7WR2b; spf=pass (imf01.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.29 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspamd-Server: rspam06 X-HE-Tag: 1633352478-162565 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 Fri, Oct 01, 2021 at 10:52:06AM -0700, Mike Kravetz wrote: > -which function as described above for the default huge page-sized case. > +The demote interfaces provide the ability to split a huge page into > +smaller huge pages. For example, the x86 architecture supports both > +1GB and 2MB huge pages sizes. A 1GB huge page can be split into 512 > +2MB huge pages. Demote interfaces are not available for the smallest > +huge page size. The demote interfaces are: > + > +demote_size > + is the size of demoted pages. When a page is demoted a corresponding > + number of huge pages of demote_size will be created. By default, > + demote_size is set to the next smaller huge page size. If there are > + multiple smaller huge page sizes, demote_size can be set to any of > + these smaller sizes. Only huge page sizes less then the current huge s/then/than ? > static void __init hugetlb_init_hstates(void) > { > - struct hstate *h; > + struct hstate *h, *h2; > > for_each_hstate(h) { > if (minimum_order > huge_page_order(h)) > @@ -2995,6 +2995,23 @@ static void __init hugetlb_init_hstates(void) > /* oversize hugepages were init'ed in early boot */ > if (!hstate_is_gigantic(h)) > hugetlb_hstate_alloc_pages(h); > + > + /* > + * Set demote order for each hstate. Note that > + * h->demote_order is initially 0. > + * - We can not demote gigantic pages if runtime freeing > + * is not supported. > + */ > + if (!hstate_is_gigantic(h) || > + gigantic_page_runtime_supported()) { Based on the comment, I think that making the condition explicit looks better from my point of view. if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) continue; > + for_each_hstate(h2) { > + if (h2 == h) > + continue; > + if (h2->order < h->order && > + h2->order > h->demote_order) > + h->demote_order = h2->order; > + } > + } > } > VM_BUG_ON(minimum_order == UINT_MAX); > } > @@ -3235,9 +3252,29 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, > return 0; > } > -- Oscar Salvador SUSE L3