Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2146922lqa; Tue, 30 Apr 2024 09:14:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXv2nSyRUX7s4TJR7biGq6uhdUagy2RJgSgoGP0PBlVdSvVyBfdpHUccyiSxGeOyWnrrREWI20eyna1GUUV045YP0VKTxJBw1zBD30gIg== X-Google-Smtp-Source: AGHT+IH9fM2+m8TBOY6dqm7QX/73lbBG7L/Kn/Fbg3bBNTxpIxMEvTqSj+atmnF5OvtBZ5nFBcJI X-Received: by 2002:ac8:5d89:0:b0:43a:cfec:a67e with SMTP id d9-20020ac85d89000000b0043acfeca67emr3768133qtx.45.1714493690856; Tue, 30 Apr 2024 09:14:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714493690; cv=pass; d=google.com; s=arc-20160816; b=tkyMvsHLytUXrIzsZJa70xN78O4KyapVOOEs8xkFWaLhAHfnFwlqBoO1UsSLxYIGql r4GIFzRBA5TNnr4gWJWTi1kjzSIZ6wiNCu10fpiqILEGbue2R88Lr/cn5tTFmoO6XTls qeDVY7UwT0qsVVhUYg9dHQtCIg5YG9mhpupdr1lWIFv+fEbx0oo20MDqBlNFcaFyTI7r Zcn7qehRbuaC6MG+mBIjQEzIAQI9/hH2UmrVjxsOugcINGbYwzFNRRSMBePxuYxdbwRl uaobaW+NfhhiCwV6Qzy2hyQZBjySxGDAtWZitgLEbPONmwE6ijUjVeFwXL1helKmxbMs 7ldA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=HIciEpuWNLnk1gns0ydqprcy+C4ILYsBvN54hbVxkpI=; fh=L7HKdfrIHfxl/a9aXp8hMYanvzQ1B9Wi91kIqfzwdQM=; b=j0gf6sRFpGuxkIEVOKpckZuAnczdBokOMIBqeh6zCRG5TqCWhRiuOMsZPN5fa8GYV9 rS1lHLsQLefDsOm+1ccGYFC5hj58hbfd0sezvawOVTXtXvKeJF8DPjOYzZ0jE3ZXRLdB J6nNVomMKMRjYlGzZKEFG2Sz7FBsigUGaZD5QdXJKLjOiqPzjHtdkzMVu+pDs8YExhqq L3Lv1vGExrYL8RIYLvjksGyNFiv5JISJZON9qOy7XztixAGZ1P9XxP/e/ebAGwX4GGII jDhpNZPNpYnw6i8c8NJ8sV4MnUUKplK4qHgl2g7OEgjofAmJfq71N3XJhyLUkluOAOj6 8Qew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mceUQrBv; arc=pass (i=1 spf=pass spfdomain=flex--fvdl.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-164343-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164343-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id hg23-20020a05622a611700b0043663accfb4si29221237qtb.426.2024.04.30.09.14.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 09:14:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164343-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mceUQrBv; arc=pass (i=1 spf=pass spfdomain=flex--fvdl.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-164343-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164343-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 945C51C21DFC for ; Tue, 30 Apr 2024 16:14:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AFE3176FA3; Tue, 30 Apr 2024 16:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mceUQrBv" Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 121B41527B1 for ; Tue, 30 Apr 2024 16:14:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714493686; cv=none; b=H8kHmUYNm8HSlmaKN8zTX7niSEQH2ssdUCStq9Waq+V2zjRODdsARJJO6fMKD0vCO4LV8WOovySl6IZSmpI1sRuekDHav7MuOBEhG4S0owgLrDaxlaNv5Dm5oe8BBI8sNcTybLHb8k8Re66qcvgpOIzTq8qnYkYEZpWK+q3LxSc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714493686; c=relaxed/simple; bh=4sVE14YqM1ge48W7lF6thDauNbOqwVTnPNy511jrKVw=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=DosWbSNbaFQkRAADQsrLZZpCeWNAwQy+2MEWMFrPfT0LnulS1nqdmS/6exklHEf/VaOBDpEe0Y8o6lHF+j/T6P7jwGOqVKOROEy9+B/Xwrz9BOCYz9bR9deUzM4s0GJZzqgVJCbiOz0kGbZ+/hAluuExzktQnV+3qDZffBn/p/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--fvdl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mceUQrBv; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--fvdl.bounces.google.com Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-1e8f59d1d9bso65763455ad.1 for ; Tue, 30 Apr 2024 09:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714493684; x=1715098484; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=HIciEpuWNLnk1gns0ydqprcy+C4ILYsBvN54hbVxkpI=; b=mceUQrBvPUcvm7jJSpgCc+9Rqt+5dBpodo7S4Y1gZUh3SJTCLrvP4faT53lyDZsM88 Shk/QG5vhLJLek2Czkc6EgRnD4GJ/oYzcIc1woA5w9sftvpr2/a/mb8zL0xEONToWOAt R/xfoi3QHcy4m3MkksDnqNtPM/yZma7xwiunv8kIxU/cxuJ8l75GXiCUAUS81P1rlfr9 IqNiqK3fy1oWq9PbfmA6KotwepJwmkC6LmdwdsBDEUOKK2zFU6optnuj9ZMpuppcd3n8 6mOdgk+d4LLpQMvMYOmUVFWdABK1Y6IyGZq/4rZdSwKo15/TMFxoet5QsXTbbF/ekyiW BHbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714493684; x=1715098484; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=HIciEpuWNLnk1gns0ydqprcy+C4ILYsBvN54hbVxkpI=; b=V8uDEowLK/U2lunbikFrmUnu7KGfRPkxYClqcHap08+8ijQGtSaOs2K4Nn4NtDcz7l RxXDhIOFEEJ/dTC8F26yB0ZmEqsb55KByrGshUJ1hIoOGtxmESPUVJKuHUmG3MatMILG x7nHZbe5e52pa2Xuh9iBflSm/uEois6uOL+5cIMeRLoofMunSn/znWFIF6kQYXQouz4Z I3XcnnvKNaT79M7OWC7R6Hl9kZrbYOJfftUuR+8F7eNTHRgoCD7xE8Ff8mHbeOOhDG5m xrW3VnJT4dcx5F31wssngqR9woR3QtSykatatNamRkLwMHMv/YgwWMZPFCFt6wTgfI7F EJ2g== X-Gm-Message-State: AOJu0Yxx5FsktRW7eKgKvsQaGLIrE/RW6y/Iqk4uemVFdmE7WSFYyfeu uhEEAzj6KvjowRhHDfXtOw8ke02qzUqLVdHl5OEd06m/9GFwrqhwNY6zHby/bJS+K7H2Eg== X-Received: from fvdl-cloudtop.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:46ab]) (user=fvdl job=sendgmr) by 2002:a17:902:d4ce:b0:1e8:37ea:d17 with SMTP id o14-20020a170902d4ce00b001e837ea0d17mr1158848plg.1.1714493684169; Tue, 30 Apr 2024 09:14:44 -0700 (PDT) Date: Tue, 30 Apr 2024 16:14:37 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.0.rc0.197.gbae5840b3b-goog Message-ID: <20240430161437.2100295-1-fvdl@google.com> Subject: [PATCH] mm/hugetlb: align cma on allocation order, not demotion order From: Frank van der Linden To: linux-mm@kvack.org, muchun.song@linux.dev, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, Frank van der Linden , Roman Gushchin Content-Type: text/plain; charset="UTF-8" Align the CMA area for hugetlb gigantic pages to their size, not the size that they can be demoted to. Otherwise there might be misaligned sections at the start and end of the CMA area that will never be used for hugetlb page allocations. Signed-off-by: Frank van der Linden Cc: Roman Gushchin Fixes: a01f43901cfb ("hugetlb: be sure to free demoted CMA pages to CMA") --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5dc3f5ea3a2e..cfe7b025c576 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7794,7 +7794,7 @@ void __init hugetlb_cma_reserve(int order) * huge page demotion. */ res = cma_declare_contiguous_nid(0, size, 0, - PAGE_SIZE << HUGETLB_PAGE_ORDER, + PAGE_SIZE << order, HUGETLB_PAGE_ORDER, false, name, &hugetlb_cma[nid], nid); if (res) { -- 2.45.0.rc0.197.gbae5840b3b-goog