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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74371C433EF for ; Fri, 11 Feb 2022 10:05:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C73DB6B0078; Fri, 11 Feb 2022 05:05:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C23B76B007B; Fri, 11 Feb 2022 05:05:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B120C6B007D; Fri, 11 Feb 2022 05:05:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0225.hostedemail.com [216.40.44.225]) by kanga.kvack.org (Postfix) with ESMTP id 9E5976B0078 for ; Fri, 11 Feb 2022 05:05:28 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 602B08D8C8 for ; Fri, 11 Feb 2022 10:05:28 +0000 (UTC) X-FDA: 79130066736.31.0D7CF8B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id AC1FF40006 for ; Fri, 11 Feb 2022 10:05:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644573927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iDBJz+J7At0lHvNivPpkfEo3xX4xigHr8rowGNN+x/8=; b=Awrcqa+7tucxy+LbpDK8wYKTyXfmBrDsTxfo/teiPK6fxQpUYHNuzaKTW6xVza7+XOREeO UueGO9zhFizajz4gf7YWgIbwDcr5AodnwD1Omj7H+uXIr/t7yLRcuPzxXluJYx8Va3Izfq 3E57ZSLp1j2acYsNUGKyWGKr7oSJiiw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-8-3wQP2RKcNMK60oOeKHrxJA-1; Fri, 11 Feb 2022 05:05:19 -0500 X-MC-Unique: 3wQP2RKcNMK60oOeKHrxJA-1 Received: by mail-wm1-f70.google.com with SMTP id r187-20020a1c44c4000000b0037bb51b549aso2175068wma.4 for ; Fri, 11 Feb 2022 02:05:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=iDBJz+J7At0lHvNivPpkfEo3xX4xigHr8rowGNN+x/8=; b=KoqhGlLtC3EQEh/JNv0k0zhnF9cWBxU2FRrglZ2EmuLO6BYyvLMGM/tMViXRWdaBSi yHDsMz3LCshFzFvu5r1Kvnf5tcqiHn7I/xWZ5qy94VO8M4p3geWjtipMBrmJpby8It7J gMjkstaALiTSq8kK0QT9vBw2Su9/mCIR/+6Qzv8GvHSrig7zcUORJ/GS10kGhRDtIIlT gblP+ZvLjyXKPMspggcdsZenjP3VqxIch9GG2lCngTXRqEmffyg/Fo5R2bgwb2sVAYAv 1d+xUWrUHJi7s3dRNHvKsyTeGe0RBse0c/xDjcqlHNunTb8CZLAlK+JS7av9v16JWKSC gMkQ== X-Gm-Message-State: AOAM533idUbGd10jZsG7AfTJkzmEKsv+EGbZnmZIUEoQqHV2YdrSlynD jiwfgKQTJnlaXUXhXJ5aLyF2h7vhRmjVdOezQQjkTTfuGzCobPAY68/uCcbNMAgpvDrfQLa1uYN ANPj1oEXxmpg= X-Received: by 2002:a7b:ce90:: with SMTP id q16mr807643wmj.91.1644573911277; Fri, 11 Feb 2022 02:05:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvvH30T/fd9dexmufkRE14FGkVltTX6czel7n80ccomwXSyWDJdKl0cDY0hVJgHSvsXxds1w== X-Received: by 2002:a7b:ce90:: with SMTP id q16mr807614wmj.91.1644573910935; Fri, 11 Feb 2022 02:05:10 -0800 (PST) Received: from ?IPV6:2003:cb:c70c:aa00:4cc6:d24a:90ae:8c1f? (p200300cbc70caa004cc6d24a90ae8c1f.dip0.t-ipconnect.de. [2003:cb:c70c:aa00:4cc6:d24a:90ae:8c1f]) by smtp.gmail.com with ESMTPSA id w8sm21132702wre.83.2022.02.11.02.05.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 02:05:10 -0800 (PST) Message-ID: Date: Fri, 11 Feb 2022 11:05:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v2] powerpc/mm: Update default hugetlb size early To: Aneesh Kumar K V , linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au, Christophe Leroy Cc: linux-mm@kvack.org References: <20220211065215.101767-1-aneesh.kumar@linux.ibm.com> <831ee5f6-8605-02d2-b7e5-543aec4857c3@redhat.com> <05d6615a-50c7-1b23-1bab-0e0b64dd4e81@linux.ibm.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <05d6615a-50c7-1b23-1bab-0e0b64dd4e81@linux.ibm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: AC1FF40006 X-Stat-Signature: i3f1psnoiz4c6pybkdwjx1udorx7m4sr X-Rspam-User: Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Awrcqa+7; spf=none (imf07.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1644573927-245297 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 11.02.22 10:16, Aneesh Kumar K V wrote: > On 2/11/22 14:00, David Hildenbrand wrote: >> On 11.02.22 07:52, Aneesh Kumar K.V wrote: >>> commit: d9c234005227 ("Do not depend on MAX_ORDER when grouping pages by mobility") >>> introduced pageblock_order which will be used to group pages better. >>> The kernel now groups pages based on the value of HPAGE_SHIFT. Hence HPAGE_SHIFT >>> should be set before we call set_pageblock_order. >>> >>> set_pageblock_order happens early in the boot and default hugetlb page size >>> should be initialized before that to compute the right pageblock_order value. >>> >>> Currently, default hugetlbe page size is set via arch_initcalls which happens >>> late in the boot as shown via the below callstack: >>> >>> [c000000007383b10] [c000000001289328] hugetlbpage_init+0x2b8/0x2f8 >>> [c000000007383bc0] [c0000000012749e4] do_one_initcall+0x14c/0x320 >>> [c000000007383c90] [c00000000127505c] kernel_init_freeable+0x410/0x4e8 >>> [c000000007383da0] [c000000000012664] kernel_init+0x30/0x15c >>> [c000000007383e10] [c00000000000cf14] ret_from_kernel_thread+0x5c/0x64 >>> >>> and the pageblock_order initialization is done early during the boot. >>> >>> [c0000000018bfc80] [c0000000012ae120] set_pageblock_order+0x50/0x64 >>> [c0000000018bfca0] [c0000000012b3d94] sparse_init+0x188/0x268 >>> [c0000000018bfd60] [c000000001288bfc] initmem_init+0x28c/0x328 >>> [c0000000018bfe50] [c00000000127b370] setup_arch+0x410/0x480 >>> [c0000000018bfed0] [c00000000127401c] start_kernel+0xb8/0x934 >>> [c0000000018bff90] [c00000000000d984] start_here_common+0x1c/0x98 >>> >>> delaying default hugetlb page size initialization implies the kernel will >>> initialize pageblock_order to (MAX_ORDER - 1) which is not an optimal >>> value for mobility grouping. IIUC we always had this issue. But it was not >>> a problem for hash translation mode because (MAX_ORDER - 1) is the same as >>> HUGETLB_PAGE_ORDER (8) in the case of hash (16MB). With radix, >>> HUGETLB_PAGE_ORDER will be 5 (2M size) and hence pageblock_order should be >>> 5 instead of 8. >> >> >> A related question: Can we on ppc still have pageblock_order > MAX_ORDER >> - 1? We have some code for that and I am not so sure if we really need that. >> > > I also have been wondering about the same. On book3s64 I don't think we > need that support for both 64K and 4K page size because with hash > hugetlb size is MAX_ORDER -1. (16MB hugepage size) > > I am not sure about the 256K page support. Christophe may be able to > answer that. > > For the gigantic hugepage support we depend on cma based allocation or > firmware reservation. So I am not sure why we ever considered pageblock > > MAX_ORDER -1 scenario. If you have pointers w.r.t why that was ever > needed, I could double-check whether ppc64 is still dependent on that. commit dc78327c0ea7da5186d8cbc1647bd6088c5c9fa5 Author: Michal Nazarewicz Date: Wed Jul 2 15:22:35 2014 -0700 mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER indicates that at least arm64 used to have cases for that as well. However, nowadays with ARM64_64K_PAGES we have FORCE_MAX_ZONEORDER=14 as default, corresponding to 512MiB. So I'm not sure if this is something worth supporting. If you want somewhat reliable gigantic pages, use CMA or preallocate them during boot. -- Thanks, David / dhildenb