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 B9933C369BA for ; Wed, 16 Apr 2025 17:07:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 452AF6B0088; Wed, 16 Apr 2025 13:07:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 401406B008A; Wed, 16 Apr 2025 13:07:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A46F6B008C; Wed, 16 Apr 2025 13:07:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0E5A96B0088 for ; Wed, 16 Apr 2025 13:07:44 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4A65D5A418 for ; Wed, 16 Apr 2025 17:07:44 +0000 (UTC) X-FDA: 83340538848.26.AFB7B48 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf13.hostedemail.com (Postfix) with ESMTP id E44732000F for ; Wed, 16 Apr 2025 17:07:41 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dj77Dvru; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of luizcap@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=luizcap@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744823262; a=rsa-sha256; cv=none; b=uowX1J2DQrEYEr2gO9lFkkAe+EB3UQePFQp5kPhgBpsfGdxae+WQL/YNi6KYIRc0YRxecN O0GA4HDTH4wPXQ80QL41M4DRpakPEa4nUjkOHkq0XSV/BHM8GSGrspbaak05xwDmYF+gZ/ ik1BWbuCxqoLpNPFMXSp+uRRGJsH0ss= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dj77Dvru; dmarc=pass (policy=quarantine) header.from=redhat.com; spf=pass (imf13.hostedemail.com: domain of luizcap@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=luizcap@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744823262; h=from:from:sender: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:dkim-signature; bh=Txu9eKRV5VXcx2F1SZgPKBUc9BS7eNXHTCkAiBh6fWQ=; b=mwANEOKhmwxIBS+P8zQ/DWRrFXHcidHEdEWLi9VvOzv7odp1EdBytPXrD/zLvTWdN5eMSx I2UYoxQH2tX5E82VB8kngDwQ6fZl2Mk29zhorPTSSurdQa039czQQUzaCcW3aqkvoXZ4Ti 6np6FfypiGWWYgeSCkZ7jxMQ/vmlyXA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744823261; 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=Txu9eKRV5VXcx2F1SZgPKBUc9BS7eNXHTCkAiBh6fWQ=; b=dj77Dvruwg1X8eddlmHZSzoZeQZJ8TnXBGB8fW5/4JAyYQPOtFH8zQtqvPduT4RRMdjlim mJFKJ75XhZIgXG/2rPfbsI17WJ2cYa88EER9pZmPz6EBVodAtppww0l1k3x+lwKaWBwdq7 aEVseAuiXYbmpUcQup+c/VpoVr3NNDk= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-jVpfDRu3P5aoTAUnSfsqgw-1; Wed, 16 Apr 2025 13:07:40 -0400 X-MC-Unique: jVpfDRu3P5aoTAUnSfsqgw-1 X-Mimecast-MFC-AGG-ID: jVpfDRu3P5aoTAUnSfsqgw_1744823259 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-af98c8021b5so6731083a12.2 for ; Wed, 16 Apr 2025 10:07:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744823259; x=1745428059; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Txu9eKRV5VXcx2F1SZgPKBUc9BS7eNXHTCkAiBh6fWQ=; b=qqJJr8MsJFXPG/0Xg3nBjDYgVxglOX2lZGt6EYjV9NfR6fV/eJzGEMxpWwlT4W1FYk vVST9p5XBK8fdkx7glr2JRw6E6Df/RpOCNv7Ey9rqZGemnFLyR/+JIueoSg/aoobpZtC Xp2Fe+31ALBewl34Hi/CS1KFEjaHtChEIVQhGvCfRFOLRuUv+q9av3HB9RUKQ56FWeVn x/1qalHDQp+cRMUnSAFGpVQQFQc6D33vuOxwzy3zeS89toiQ7Bp3qR487XfQ4DvipGFr HuaEH7eDn5G2bBpoHC0tPEx6yIDVjkLysDvDsc89ZodteQXUqVSLVkf2vopyD8NKh6Hp 0wFw== X-Forwarded-Encrypted: i=1; AJvYcCXx499KljrBV58dHenNsZavrsd5G9v7A+Cw5ICIrn8XNSupW0e4tmo+E49JCdNXcLImAqBZ54Dj7g==@kvack.org X-Gm-Message-State: AOJu0Yw7a4GHFHdYh59n3mkm6MR4N+CQKOHtMdbCtnrZhlvU5wqrWqX0 g/a/BkC7yglwfrs+mOmf6wZuNnF6aOKl7n1M9/uXZCVAsq9Ni2xMSAckkCQ6bpBSH0vg+txEbX2 1x3vDMRcSUEB+mISiOzhRjqXCwOLZhAU5qQfJpv1+2bBNFeV5 X-Gm-Gg: ASbGnctnyIR6twOziMh/xTzT91XCFtv46ernpjKVxFsiGZm0FUAMLKQ+OfYwBp9jDNv 36DBm81wdkxeOzErgMGxKJh5e/5PCngOWf5y8OLCwXTp18zttBXc4tXlDWGyJWNBo3xpndJ4EMN teZaeJndpuhDF2eYYJFjD1ANJtP1A2BbHGmqdse9zZf2giIfDTtPEk9o8wLAWCRdj36El9fS+rg WGcfKNqkX/Gkxg0jNQDvG78A6JTkpsWpzSM4hopSi99a3TQ9tCifQg+aADM7+OHWoO4LzLZ3lio RdpnJM9GD1/Zag== X-Received: by 2002:a17:903:17cb:b0:220:e896:54e1 with SMTP id d9443c01a7336-22c35916b8cmr41994655ad.26.1744823259016; Wed, 16 Apr 2025 10:07:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjE78Hd0NX2VKlmOvNMX/n/qLF921XEQIoPT7tUDRXgP5obufv6p3oZKxPjd6NKh3lVTqfRw== X-Received: by 2002:a17:903:17cb:b0:220:e896:54e1 with SMTP id d9443c01a7336-22c35916b8cmr41994295ad.26.1744823258688; Wed, 16 Apr 2025 10:07:38 -0700 (PDT) Received: from [192.168.2.110] ([70.53.200.211]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c33ef10e1sm16765735ad.16.2025.04.16.10.07.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Apr 2025 10:07:38 -0700 (PDT) Message-ID: Date: Wed, 16 Apr 2025 13:07:22 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm/hugetlb: use separate nodemask for bootmem allocations To: Frank van der Linden Cc: akpm@linux-foundation.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de References: <20250402205613.3086864-1-fvdl@google.com> From: Luiz Capitulino In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: zBGEaHK4cqTrsXw3bBE8UI50MyqYNmkOL7z17w277Tc_1744823259 X-Mimecast-Originator: redhat.com Content-Language: en-US, en-CA Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Queue-Id: E44732000F X-Rspamd-Server: rspam04 X-Stat-Signature: hgeky89oc7hr8j6nik8swkrftq5qzyaa X-HE-Tag: 1744823261-145322 X-HE-Meta: U2FsdGVkX19X5DbUmYj3a6GhPprfSDMEJJm4ltGB0f4dT4bitoOaKk3IzbZzVAduAZRLFjHGGjynuJhI26ReQD76jnKQ0ccnHgHRcERSKVmf+uRzZ5osBDKX29ObGIlNGzg3jZjowDqfrbH+nxPosTxNdo1oRzDndo8ddDj0B3Lep747ZGwoAuezZizsACC/cHgiykk3BpMjC2FQ5hLmSoOQic48KLEQkPs80vl/PqgH2UJAAgw3q9YpWnHMw6ULjRmoCRi7GsXCDqabgTmLRm5RIesR6if3rtlmRv/bWHQZQ0GqU/gYMdSobuLBgvjOWKMlK3nt5KwfuMTGaXNLSZ26Ga4/AK9WUlZRb5G7L72RQVucAgcPd7qKimTgXLKuaaaGcbElF2+ObF84Qpv9H/G+Hbzh81s7HzgBTimPWcuTJypyGTIRpqFoFN6WHtvXMaxahgZcMlJ9DHiZ1uSi6/NL1fvRzpEvjVQFMf+KsTodOT+K8wo6/yDG1J/fbLInT0YgdqQJjGUbLaY67e9wO/NiDOaB2Amfur2HPo9Bg2SFI0x2RdaJcw1H+pwQuA44ksLPMufbj/oU7vBAJUqcTDuG3Gedmc+/PLabsgXRsXfh8WnAKU9VnqKnOdAdwMZOIpJ5XE3UYr7Ou8bLB6f1lEXai0SPF5qEJyMpWXPbK6ybphWTbX41KFjdKEMUxDFsJqTZmwXANv/xV3LJnlFJKz3q1XmCBVU9dK/EcwW+xhURR4T5PqYvm5zVrgJi2IKnZmQ7IS6Rd9UoKvW8raKm60ZQr0gjjWjy1UHnwfKwn3aDNNlI01w3na0N3HNDsJygLPZ6/Mvn+SgUVxLbSPrUEBhyZGmCky8wufn+PXYg5bnUQBjSat/4iDhJXrZmRj4Fz3FF8lybuuR/lT3Jw6q1J4WyeGNVXDixBQozSTWKGYYlytL1Ru+oz8jwA1st2HlVf+lhD3blCfCR0SnDpvS v50ROW4a atW7c1mtvq9hFj1le5hzjceqs67POo6D9X9+A0Gk6GjAEofR4esdtOWWt0/vxLFgYR5vk0K3hED+YRoPBWNsr/vt3ood0l0cSkMoe3NS+kCfcfgxn+Q7kBnk/JXhpEfr0zXm6rEd5uzaY98nlCY+vCGawhvWpWWNhTt3Qn+BGsSD/PVLoC22PZSFuTbJr5xmgTxRRtDcbJGsK+RDHNvxHPLLbt+EaLoa3vEF1AP8wVL9Tbxi5nBo/7IPRhiWZ/gRJ2bT25aw2t7FkmIfIP4xuCjlTQ1HqatN0Da1cxFrJ4r/zYY5sd+D5G6RDnA4nE981QvmvwNlXZXHN5JS0fl5A6+WYoXiLXhOH7GQMc/hoimUSk+I3DRK69AKb9hLdv857ByoUT/CCS+rv2aGKuTdBOQUn/9D/nEs07jIfYbByRziobJDlIGR3tOGIRg== 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: List-Subscribe: List-Unsubscribe: On 2025-04-16 12:32, Frank van der Linden wrote: > On Tue, Apr 15, 2025 at 6:08 PM Luiz Capitulino wrote: >> >> On 2025-04-02 16:56, Frank van der Linden wrote: >>> Hugetlb boot allocation has used online nodes for allocation since >>> commit de55996d7188 ("mm/hugetlb: use online nodes for bootmem >>> allocation"). This was needed to be able to do the allocations >>> earlier in boot, before N_MEMORY was set. >> >> Honest question: I imagine there's a reason why we can't move >> x86's hugetlb_cma_reserve() and hugetlb_bootmem_alloc() calls >> in setup_arch() to after x86_init.paging.pagetable_init() (which >> seems to be where we call zone_sizes_init())? This way we could >> go back to using N_MEMORY and avoid this dance. >> >> I'm not familiar with vmemmap if that's the reason... >> > > Yeah, vmemmap is the reason. pre-HVO (setting up vmemmap HVO-style) > requires the hugetlb bootmem allocations to be done before > sparse_init(), so the ordering you propose wouldn't work. > > I originally looked at explicitly initializing N_MEMORY earlier, > figuring that all that was needed was having memblock node information > available. But there seems to be a history there - N_MEMORY indicates > that buddy allocator memory is available on the node, and several > comments referenced the fact that zone init and rounding may end up > not setting N_MEMORY on NUMA nodes with a tiny amount of memory. There > is also code that sets N_MEMORY temporarily in > find_zone_movable_pfns_for_nodes(). > > Some of the commits went back a long time ago, and I can't quite judge > if the comments still apply without looking at the code more. So, I > chickened out, and did a hugetlb only change to fix the hugetlb > issues. Oh, thanks for the full explanation. Since the new hugetlb init has to happen before sparse_init() then this patch is fine by me and I appreciate your concern in not changing/regressing the user visible behavior. Reviewed-by: Luiz Capitulino > > But it does seem like setting N_MEMORY can be cleaned up a bit, it's > definitely something to follow up on. > > - Frank >