From nobody Sat Apr 4 06:08:32 2026 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 2549C3E867B for ; Fri, 20 Mar 2026 18:23:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774031040; cv=none; b=MhA2X8hkb2RdgChIFbh3kFNCdNk6tbgdoycbuZhXEQnXDILF3rNcOQ4j40hGRrU9G1HXWuLRY3Hwhz2DjyNgC5RvUitwQM5ZDdREsxs9wmR2gB8arxtaaa+V8mVJt7EqwCMoWOESlHRw4k/LcS2LC0HT1JrCEMDSNiZ4zuvj23s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774031040; c=relaxed/simple; bh=w6wTzjvaLwQgAS56hyXkVZU2yeUpFAwyTpIfgbVqlUg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IQve1x0tNDEC+ftZxeJ8NufC66SSzcW7wSiQxuK/Lo/iUIFLmjUDQLdDhKOVQiSSACCgWlPE2yCBcaXk18Vek0fJRoHMxMXc0+Q6uZeYHI8V1mNRdGkCDJOS7xvpmbNlRwQ9jPwqEp478aoERR3WY2Ixny+4UsD08Drv6xVK48s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JPwzBw+e; arc=none smtp.client-ip=209.85.128.74 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--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JPwzBw+e" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-485c45885e6so31980455e9.0 for ; Fri, 20 Mar 2026 11:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774031037; x=1774635837; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lGMhbZxFIgAxdlzkjZ1cKVDZiAbKLAwKMpahCpzEzEo=; b=JPwzBw+epFIAOgMP+qagYE90y8Q+U5I6ia1BYr1oDMSGnj3Z6ro+0pqt7BvSRZNnSf V9FS+8yJWUQ3lQspQCg4Hw4S6lKsoaEDHalM+SWbBkaT0pCZAzZ9XkZSljDBPALJ0Bqo wjUKGUShpgw6Du5RQW/Q0AlAyaZ3HRnuWor4a1GJTTuLdXXG/D1zDm8ugohhLQlWH7rS gD4crHMRfFg9sIdlYTBZl9wA+nUpAHWwDnEG7SOVeoFZjmTVByJkr37PLeBLgFOVWdKZ w/oU+NiKcOXUJpwRdYeOlbbr8JnFIGAr++6Wekq45+Rcz2Aqm45LPI2sUqMKcMbT89fp YYGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774031037; x=1774635837; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lGMhbZxFIgAxdlzkjZ1cKVDZiAbKLAwKMpahCpzEzEo=; b=Wnb6MvAgmdpoIiBlBEl8Im+cUZsxf1UUhq3LA1EvoWY9rqIhfI7QYy2ReNN2FTt8w9 Nr6Rk1bdkkHV7PCN1GsoDetsbsBT5yKz9yM3MfswsS9CcNmeEfINxHEcXP7jsiNKDnTI S5MY9iYC/JkcQlFB8MY75mVmmXFwJR4f+gLcQbwYtk+Ndxrz2hArfrphtYrKy/D4n0Xz 55GdhPWhePnM7+sInx93zDmOT4G3H7R5GSw46uKCjJtWZ5Wf2Wd+gL/RWU8C2L36XOUm C61wl7B/2FYzCl7BIQwIoyYu9725YSvz9XN2Lvcx5arXY7OZzjk9l17JJWa50zqJeaW3 1qVA== X-Forwarded-Encrypted: i=1; AJvYcCXfzjVeBHT9PG7IHGbk/MtyqY9+8tm7J82/+5Q7eqZPKE/2ScHfenKAXpwbft91rMT5z8QGHx29ppNoAFA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxq8EVN7mm3zEoWxlpHapbMAZMv67JbRlRwKbXG6a0NmU2Q58UR Dan7cPkhusU6HDur+IRkvB1ggLZF4EF2MAJImnYK9OKPiCz/TsY10W64dazRBRNpnLd/GWBsPEW INfOEfLXQ70oZoA== X-Received: from wmro8.prod.google.com ([2002:a05:600c:3788:b0:485:39cc:2a07]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:19d4:b0:485:54cd:6e4e with SMTP id 5b1f17b1804b1-486fee0b723mr55394755e9.18.1774031037278; Fri, 20 Mar 2026 11:23:57 -0700 (PDT) Date: Fri, 20 Mar 2026 18:23:37 +0000 In-Reply-To: <20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com> X-Mailer: b4 0.14.3 Message-ID: <20260320-page_alloc-unmapped-v2-13-28bf1bd54f41@google.com> Subject: [PATCH v2 13/22] mm: rejig pageblock mask definitions From: Brendan Jackman To: Borislav Petkov , Dave Hansen , Peter Zijlstra , Andrew Morton , David Hildenbrand , Vlastimil Babka , Wei Xu , Johannes Weiner , Zi Yan , Lorenzo Stoakes Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, x86@kernel.org, rppt@kernel.org, Sumit Garg , derkling@google.com, reijiw@google.com, Will Deacon , rientjes@google.com, "Kalyazin, Nikita" , patrick.roy@linux.dev, "Itazuri, Takahiro" , Andy Lutomirski , David Kaplan , Thomas Gleixner , Brendan Jackman , Yosry Ahmed Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable A later patch will complicate the definition of these masks, this is a preparatory patch to make that patch easier to review. - More masks will be needed, so add a PAGEBLOCK_ prefix to the names to avoid polluting the "global namespace" too much. - This makes MIGRATETYPE_AND_ISO_MASK start to look pretty long. Well, that global mask only exists for quite a specific purpose so just drop it and take advantage of the newly-defined PAGEBLOCK_ISO_MASK. Signed-off-by: Brendan Jackman --- include/linux/pageblock-flags.h | 6 +++--- mm/page_alloc.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flag= s.h index e046278a01fa8..9a6c3ea17684d 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -36,12 +36,12 @@ enum pageblock_bits { =20 #define NR_PAGEBLOCK_BITS (roundup_pow_of_two(__NR_PAGEBLOCK_BITS)) =20 -#define MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BIT(PB_migra= te_2)) +#define PAGEBLOCK_MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BI= T(PB_migrate_2)) =20 #ifdef CONFIG_MEMORY_ISOLATION -#define MIGRATETYPE_AND_ISO_MASK (MIGRATETYPE_MASK | BIT(PB_migrate_isolat= e)) +#define PAGEBLOCK_ISO_MASK BIT(PB_migrate_isolate) #else -#define MIGRATETYPE_AND_ISO_MASK MIGRATETYPE_MASK +#define PAGEBLOCK_ISO_MASK 0 #endif =20 #if defined(CONFIG_HUGETLB_PAGE) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 018622aa19006..d16f7b7bdf282 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -362,7 +362,7 @@ get_pfnblock_bitmap_bitidx(const struct page *page, uns= igned long pfn, #else BUILD_BUG_ON(NR_PAGEBLOCK_BITS !=3D 4); #endif - BUILD_BUG_ON(__MIGRATE_TYPE_END > MIGRATETYPE_MASK); + BUILD_BUG_ON(__MIGRATE_TYPE_END > PAGEBLOCK_MIGRATETYPE_MASK); VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page); =20 bitmap =3D get_pageblock_bitmap(page, pfn); @@ -466,7 +466,7 @@ get_pfnblock_freetype(const struct page *page, unsigned= long pfn) __always_inline enum migratetype get_pfnblock_migratetype(const struct page *page, unsigned long pfn) { - unsigned long mask =3D MIGRATETYPE_AND_ISO_MASK; + unsigned long mask =3D PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK; unsigned long flags; =20 flags =3D __get_pfnblock_flags_mask(page, pfn, mask); @@ -475,7 +475,7 @@ get_pfnblock_migratetype(const struct page *page, unsig= ned long pfn) if (flags & BIT(PB_migrate_isolate)) return MIGRATE_ISOLATE; #endif - return flags & MIGRATETYPE_MASK; + return flags & PAGEBLOCK_MIGRATETYPE_MASK; } =20 /** @@ -563,11 +563,11 @@ static void set_pageblock_migratetype(struct page *pa= ge, } VM_WARN_ONCE(get_pageblock_isolate(page), "Use clear_pageblock_isolate() to unisolate pageblock"); - /* MIGRATETYPE_AND_ISO_MASK clears PB_migrate_isolate if it is set */ + /* PAGEBLOCK_ISO_MASK clears PB_migrate_isolate if it is set */ #endif __set_pfnblock_flags_mask(page, page_to_pfn(page), (unsigned long)migratetype, - MIGRATETYPE_AND_ISO_MASK); + PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK); } =20 void __meminit init_pageblock_migratetype(struct page *page, @@ -593,7 +593,7 @@ void __meminit init_pageblock_migratetype(struct page *= page, flags |=3D BIT(PB_migrate_isolate); #endif __set_pfnblock_flags_mask(page, page_to_pfn(page), flags, - MIGRATETYPE_AND_ISO_MASK); + PAGEBLOCK_MIGRATETYPE_MASK | PAGEBLOCK_ISO_MASK); } =20 #ifdef CONFIG_DEBUG_VM --=20 2.51.2