From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 9B2CD3D646E for ; Mon, 11 May 2026 16:49:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778518163; cv=none; b=GDukQ6T4YLz5sjVpdsw0QDJKJntHmLOpzQLUQIHiKr5IESLI8TPB8bcQkHvOI8AI1Z/vBLJFFqjfmR5PapI4NwCOgd2IkzzIV8+9byZuMw/XVd8wj4AFwFllO+8yaU6fPs9bpSYTDdRzhDhiF4FSRZ8U7MOCrd/XVzMkbIeK7oQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778518163; c=relaxed/simple; bh=bTzOhtuzX/YUPm6Cbh1uu2XgHkk/mBxRenqPsIU5K6Q=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Iz7M6slMxUWUoHzM9x8YwH9o64HqJB45pux8seiIRhBRWvnkjEiooeyMDXeA3fLTHwS6mFOdHtfJWynMfG5X1ccmMcC7QgBT5zeFXXDW6T3EtXOI5rLnued+tTOGitMAElgK0fPuiOM5qWB3WMGvzX2y4UBtEGi11dEoWhifnzI= 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=OIEsZu4N; arc=none smtp.client-ip=209.85.221.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="OIEsZu4N" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-4497a0e3acaso4336112f8f.0 for ; Mon, 11 May 2026 09:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778518160; x=1779122960; 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=u5JRk3Gs5cW/rB1bt3fcvkhvfAgO2Qm/GtAi3vtMAZg=; b=OIEsZu4NkUWgzPeCgvE5luLJ5tW551UsnpEgEJ6ND5JagNUqWlyv6S1NYphMRcx/2f Xs7uNBipbZcP3PXF3ZIHChX8wgiZKQ225iqHmDqFUg3Nn2b1gKDwgtk4XujGotNiAyk6 /+pul6B3J/SokgaK0HOXeK7q6yV8MpIAz7Rj0cwMXCBlWg1xuU99BjV2uGIRQfCL7pis 7RppDnXlOMGk7Gt6h4EdMVVSHExEH0T/t4h3mQt/SIwMz68FsIYuEy3RczlkvpNYZSwg hbb34gH1a2OXnyzgHeVBxIzIarPBHsql0xZfttSkOhigfNyfwoop8AS0keHuXmjFoITu iWyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778518160; x=1779122960; 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=u5JRk3Gs5cW/rB1bt3fcvkhvfAgO2Qm/GtAi3vtMAZg=; b=SCl8wUqROTXH40HenfKq6FpXBAAUZejzfMlOSordFrvXVN+k9NoPeNfnqUeaz/yoYO n97/XPJxMNr2r4pUHpwDCMPwHJ63/B2+Sh7Z5i2qRTGZzMR/QTRuLg7hu1TTKRx/+6W+ 5zwp6TmT05/yqDrWeck0F5jUdKiAF276dlkZgvCApcEJhL3lmVe9mq6OhyYsCpytvumW TsRVAl52TVxUDi3zF86A60imRWYro7o5pDQP2kPo7F24Jtnm7FykYd9ryif1Poh/diCq BagbEeUD2m1i6aG0O2GmklH130tZNv5xQ+/uZj3OipQV2SmzZ9mfc1qVAgIf0+njTMGc 5OEQ== X-Forwarded-Encrypted: i=1; AFNElJ9p2UQqC4sO6X/JJY8pKYovDOuTPpAuz5x28kCqviEE88Xh7aHraOYHy3i4BgJNfGP2J4GrjgYQpdPHHR8=@vger.kernel.org X-Gm-Message-State: AOJu0YwU6NerX751SST5GYyIbV6/gDAzX7QlSy+tmb22SdoBL+xC/cD+ i1cyuCIXqwB/vCGfIjGGzkQJnuhvfxlHbfMYgNlMmxofHDKKx9XRxwBW9Hi5ELll5rAc1jTL1tu cChGrnS1beQaJNQ== X-Received: from wrrg13.prod.google.com ([2002:adf:fc8d:0:b0:449:9039:96bf]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:420e:b0:455:544d:68c9 with SMTP id ffacd0b85a97d-456a401aa22mr16802688f8f.25.1778518159355; Mon, 11 May 2026 09:49:19 -0700 (PDT) Date: Mon, 11 May 2026 16:49:18 +0000 In-Reply-To: <016c8bef-57ef-44ef-bf60-86dbfd368dcd@kernel.org> 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> <20260320-page_alloc-unmapped-v2-10-28bf1bd54f41@google.com> <016c8bef-57ef-44ef-bf60-86dbfd368dcd@kernel.org> X-Mailer: aerc 0.21.0 Message-ID: Subject: Re: [PATCH v2 10/22] mm: introduce freetype_t From: Brendan Jackman To: "Vlastimil Babka (SUSE)" , Brendan Jackman , Borislav Petkov , Dave Hansen , Peter Zijlstra , Andrew Morton , David Hildenbrand , Wei Xu , Johannes Weiner , Zi Yan , Lorenzo Stoakes Cc: , , , , Sumit Garg , , , Will Deacon , , "Kalyazin, Nikita" , , "Itazuri, Takahiro" , Andy Lutomirski , David Kaplan , Thomas Gleixner , Yosry Ahmed Content-Type: text/plain; charset="UTF-8" On Mon May 11, 2026 at 3:34 PM UTC, Vlastimil Babka (SUSE) wrote: >> +/** >> + * __get_pfnblock_freetype - Return the freetype of a pageblock, optionally >> + * ignoring the fact that it's currently isolated. >> + * @page: The page within the block of interest >> + * @pfn: The target page frame number >> + * @ignore_iso: If isolated, return the migratetype that the block had before >> + * isolation. >> + */ >> +__always_inline freetype_t > > 'static' too? Yup thanks > >> +__get_pfnblock_freetype(const struct page *page, unsigned long pfn, >> + bool ignore_iso) >> +{ >> + int mt = get_pfnblock_migratetype(page, pfn); >> + >> + return migrate_to_freetype(mt, 0); >> +} >> + >> +/** >> + * get_pfnblock_migratetype - Return the freetype of a pageblock >> + * @page: The page within the block of interest >> + * @pfn: The target page frame number >> + * >> + * Return: The freetype of the pageblock >> + */ >> +__always_inline freetype_t > > And this is declared in a header so the __always_inline is not really > applicable? > (seems we should fix up get_pfnblock_migratetype too) Um, I think it probably still forces inlining in calls within the same translation unit? Anyway I am pretty meh about this, I suspect humans and compilers are equally bad at making this decision, I was just trying to be consistent with the code it's replacing. >> + /* >> + * Fallback to different migratetypes, but currently always with >> + * the same freetype flags. >> + */ >> + freetype_t fallback_ft = freetype_with_migrate(freetype, fallback_mt); >> >> - if (!free_area_empty(area, fallback_mt)) { >> - if (mt_out) >> - *mt_out = fallback_mt; >> + if (freetype_idx(fallback_ft) < 0) >> + continue; > > How can this happen? Is it preparatory? Oops, yeah looks like I need to clean up how this happens in the history and clarify the commit messages. In a later patch I add an optimisation where we avoid having freelists for freetypes that never arise in practice. And in those cases freetype_idx() returns -1.