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 0FE74C02198 for ; Mon, 10 Feb 2025 18:30:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D8F0280005; Mon, 10 Feb 2025 13:30:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 888D9280001; Mon, 10 Feb 2025 13:30:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 776F5280005; Mon, 10 Feb 2025 13:30:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5A322280001 for ; Mon, 10 Feb 2025 13:30:17 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 13559160441 for ; Mon, 10 Feb 2025 18:30:17 +0000 (UTC) X-FDA: 83104874874.17.D139D55 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by imf26.hostedemail.com (Postfix) with ESMTP id 2D956140006 for ; Mon, 10 Feb 2025 18:30:15 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="bXWnDZ/h"; spf=pass (imf26.hostedemail.com: domain of fvdl@google.com designates 209.85.160.170 as permitted sender) smtp.mailfrom=fvdl@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1739212215; 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=8HfKPJSfxCZGKLo5/pj9wiJiaiKmqK3oi4ISbP/v9Uc=; b=fhrNeTAdNbjnMbSgVdAy7gQkQDqd8BQCYinSCl4zGRuk89xOhS82lygzuRC143FAk7ZvZS 3EsZjKfFWPH9x08e9WULtm4V7tx4MqNaenKqqNVRWSreWO66l7Ay7LiBs1KDNyioeGMPOT aWyFmN0zksxn4kZIoj3i2n4Mg4SXnAs= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="bXWnDZ/h"; spf=pass (imf26.hostedemail.com: domain of fvdl@google.com designates 209.85.160.170 as permitted sender) smtp.mailfrom=fvdl@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1739212215; a=rsa-sha256; cv=none; b=Bvr4sT/Ymilu2IUcyS9IwnYdRf2mE4i9wkRTcNRNm2NZkC+LI6p/pynuRXMGfmFpQSyE3t ltu9DfgFvaItVU0LQo4PeZUPhHDxxs1Tw8G1VLq1RVlqYdbp82ZYwWuiyptqFHzf+xfS2U vMTir/XeSD41p81/mAwKQf2Te0pWcvo= Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-4718aea0718so19951cf.0 for ; Mon, 10 Feb 2025 10:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1739212214; x=1739817014; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8HfKPJSfxCZGKLo5/pj9wiJiaiKmqK3oi4ISbP/v9Uc=; b=bXWnDZ/hbl7BVN++1uzmSvmkBmxWkNNJYRZiqoSJ+osi5EauO6/wP2f7r2DRbCkJyA K8PY9NAORP3qny0cKm8k7dGXluSpSy2Aj6vzgwYotalzyonatghNkNQApRCd9bnHeiDK KHGpjsS06TF2dcQY7DxCoDpXMvzp5HBkA1zIaCyLiOLhT5Imz22CQuCpqkCECWwWTDr4 z4rd+THQB1vQ/3q2Vk/JRUcmwauFCMKiU9DH7syOUk2y46ynlWtQrGGhYc1skUUyDCKE Q4+5OtTUjMvI+eXA2dDSo2rK+1XDONBUn2LrpoXYPs57dXxLMBP0ksEg5iBwOCr7TM+E sDbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739212214; x=1739817014; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8HfKPJSfxCZGKLo5/pj9wiJiaiKmqK3oi4ISbP/v9Uc=; b=k0tWKYsmpc1N6VveFrOe2zI+CwKwOvCt9f2lNMOZ0+ZEaEE4oxauLSekeN/SaJfMaz /2kfDjrvXT5MBcIXp9ldHrrGVW64Sa1N6kj6NVKmEyKX/pSxxKmvR2e2Xkq0gQ1baYBE Yc1xSVvOV6gJGgH/IMgMCzBexI6xadyC54SV2jePpi8ut5cPQHQ2xAweQMWKwWzMIL5h 7n/1r8zbWyIc6aa3jqf8Rborhrk+mbv8fwSlrkh72BU/ZMSkrbuOiQir+jaQTGkJLLXH +4pk9St/6N5Xy/xvcJZDjbzjRDu1NMAicilb0lmr8eWwoA0qnfUzgs10AyVWBF9NQ99q UwhQ== X-Forwarded-Encrypted: i=1; AJvYcCVa2lCvJ18cqRfazyN1MJ4fwLn4Z1RhJTivwJcLRdzzgNxDnwD/xsSScun/nVU5JrXiNrolmMz4XQ==@kvack.org X-Gm-Message-State: AOJu0YyonFCOMMz+QUqb/mW4bjVV0PPsZoN8Z7vQDWJedmbpx/hal4c8 nwGzGRnltNjfoGQ8kz+iVE+Mc8cmW3YcXq8xstRvp8m6eDcext0vatSyv5R/De5uz1rVBxTMr24 AntSxQrK7XSKpkqt48Tlkf1Sniheg/Fbwcq+s X-Gm-Gg: ASbGncsEeVbIUFuoqCcP17V2QQK7I/4o4dHGA+FazTfxy5Wo3XqRZkqFuwrRyC9R4Bm ak/0ogbGWqJs+wsFYYz+KVcSviryhpu5sBoufKYpfptYffUaMGkFFXP9+B20162KIjObUzg== X-Google-Smtp-Source: AGHT+IE607kxRT73YhIc7XgFAfGUhK1Un8bVHLN/F4SZKoqCfdUPo+DWBx7ZLraHfaUBrpN29qbeV9fcVwe023Cx4E4= X-Received: by 2002:ac8:528c:0:b0:471:94c0:f403 with SMTP id d75a77b69052e-47194c0f5b2mr3914951cf.16.1739212214169; Mon, 10 Feb 2025 10:30:14 -0800 (PST) MIME-Version: 1.0 References: <20250206185109.1210657-1-fvdl@google.com> <20250206185109.1210657-6-fvdl@google.com> In-Reply-To: From: Frank van der Linden Date: Mon, 10 Feb 2025 10:30:03 -0800 X-Gm-Features: AWEUYZkUNDu2MopHDliIrU8DLEoNOPJxGfK5Mwq14RQDp0x5MQOJjSzyHx4lLZo Message-ID: Subject: Re: [PATCH v3 05/28] mm/hugetlb: fix round-robin bootmem allocation To: Oscar Salvador Cc: akpm@linux-foundation.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yuzhao@google.com, usamaarif642@gmail.com, joao.m.martins@oracle.com, roman.gushchin@linux.dev, Zhenguo Yao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2D956140006 X-Stat-Signature: nftxb5gz118kb1dyfhtechpngzw8mws8 X-HE-Tag: 1739212215-534227 X-HE-Meta: U2FsdGVkX1/MHRx6nFaCJYd6nenbfNJru6BVXLrfJVGfw5DWWqTiorGtrQdkp3t9jDHmA0GB92HYe51ZlkmvAOgpKM7ZSF+3FRloWsFodo5xVb/dzNSTpZeHbeyod+0xFxTsfQu8VtjXfSut/VI+0Qer6avcJXIaa2KgL0mV5soaGLasPoZ7W9/us+DmzZBKB4HOdwKs79j5kCk7wLCRF14dqbcPcfk75KMCTuvA0d9L0AwcxMW7OwUOn/3YqLN4ScCfCPY8b0IGZu2mZx76dxBA6SeIEkYxh2fYen9E9LVLTnQy/sNjyn8S2mVM+pMJrlfm6ltX6jkC/COjuClQRMvwIAe8LYAzZ7Qq6oka5NunGLOKxzEOTPWjgnqa1C/3bh2xJvRIwmi39dTF9NBcOsNN35PX1Xe6Uha8e8oodwzdAJawwp/jd6PbjsxdhRPzu9xDbF1jrIP4aY1nKQhqgzVMj6cUB78oA2mrUfVh85DX4ulOAk4EpBMXIqCWfsb9iftBaebygGQr/+ZlJD7bAahbLxN1Cjwmcbd6tp0XwI4KrncH/QkZHwraJCoUFyiLkw1UqBydhskixOVn+gXgKQ+162+oeLtt70eKV5afIt0ZUlltt2VLZn+FqwzCbTDdHVQhe2k37G/7W6/68VaWEmPM0ViXnHggyfTtfSL9GeyJ/3ys8qY9dT033N9yBRmreEwUw7J7rmJ6jh/YqAA1AyBPx9P1QReW8PYcEp1ik/jjPaitmySO2GcdrRPfS22B1kf3EeKQMSuESpE1voZVPZ9eDOxlBftm1cl2ibGoJ9gK270BkJh2eGkRsld2FZT5VlISIl7Ng9lglYaQTBEk+dxGlEBH8gmOBiVjWrUxVHpUfNoTOw6i6u8FD3GAybyODmY3Z+uPDPmsi/84tIDvhsI/xfER4FoYRR6/UQE2cbGlheMMF/jaI0zQRRynX2rIoJV+uwcGILAMtECEMzM 8hGF2CcE U4e9K0MZVQAlRH4Ae8hELLyKiY2CPPUuqh+UNOOobOB7Rv6WNl7c4k2+qK8PRr3AmtsIBnrer5/a4dNKQxynUS3aLlWKwMv3xSpjme6D0W4xSn4MAcAJnkvhb6ZHCsC6HVI5d8shrBzLkWQAO3J9TI36AXQMFjWmV3M626I70DwbBKa41VZ3NF7r9XR9omq2/SYwu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 Mon, Feb 10, 2025 at 4:57=E2=80=AFAM Oscar Salvador = wrote: > > On Thu, Feb 06, 2025 at 06:50:45PM +0000, Frank van der Linden wrote: > > Commit b5389086ad7b ("hugetlbfs: extend the definition of hugepages par= ameter to support node allocation") > > changed the NUMA_NO_NODE round-robin allocation behavior in case of a > > failure to allocate from one NUMA node. The code originally moved on to > > the next node to try again, but now it immediately breaks out of the lo= op. > > > > Restore the original behavior. > > Did you stumble upon this? > > AFAICS, memblock_alloc_range_nid() will call memblock_find_in_range_node(= ) with > NUMA_NO_NODE for exact_nide =3D false, which would be our case. > Meaning that if memblock_alloc_try_nid_raw() returns false here, it is be= cause > we could not allocate the page in any node, right? Hmm.. this patch is from earlier in the development when I stumbled on a situation that looked like I describe it. However, you're right, there is really no point to this patch. I mean, it's harmless in the sense that it doesn't cause bugs, but it just wastes time. The problem I saw might just have been caused by my own changes at the time, which have been re-arranged since. I was probably also confused by the for_each, which isn't really a for loop the way that it's used in this function. Looking at it further, it's actually the node-specific case that is wrong. That case also uses memblock_alloc_try_nid_raw(), but it should be using memblock_alloc_exact_nid_raw(). Right now, if you do e.g. hugepages=3D0:X,1:Y, and there aren't X pages available on node 0, it will still fall back to node 1, which is unexpected/unwanted behavior. So, I'll change this patch to fix the node-specific case instead. Looking at it, I also need to avoid the same fallback for the CMA case, which will affect those patches a bit. So, there'll be a v4 coming up. Fortunately, it won't affect the patches with your Reviewed-by, so thanks again for those. - Frank