From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from flow-a7-smtp.messagingengine.com (flow-a7-smtp.messagingengine.com [103.168.172.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED406436BEA; Mon, 7 Sep 2026 13:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.142 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788786683; cv=none; b=oSrn2HE6Y+Saur+ZdB6FwBnG6IDPgBze6r024fkXikUlBVXLxN2oB+ei6RmErQZyDLOE63Xvvoj7YiOWsCpXMRNtfm2wZGyJTBV0WUD8bRpFqafA44N435IkoZFey2jvoAG4W92AjI4yCm55ybmzgT/uc3uJW7VQ16Grj9oMP5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788786683; c=relaxed/simple; bh=tA0OMRv8oj06En5/BWfSVzQAOrbI0aJi40goniR2kr8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aZ+KD3OX46ko/hQd/pvAOmDMcrgrFDNthDg7g2PjXQzh9Cscw2v1BAPDq5CpKuElLoOzM4AskIIcXbMUagKyxIOcPVDO1LoI/EM7Wj1cq8tTyXImvoAPh8Fd2TkG7xZ+OncL73cKEMLVB3ja6Id7Ju3NtzHrNMqXQIoR6ulNm78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name; spf=pass smtp.mailfrom=shutemov.name; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b=Y+kYpxzC; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=qN686EEZ; arc=none smtp.client-ip=103.168.172.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shutemov.name Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shutemov.name header.i=@shutemov.name header.b="Y+kYpxzC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="qN686EEZ" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailflow.phl.internal (Postfix) with ESMTP id 3B9701380129; Mon, 7 Sep 2026 09:11:18 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Mon, 07 Sep 2026 09:11:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1788786678; x= 1788793878; bh=e0j3fsVumRKOaqygse+y9YlCuGTHtFBd6bkppJhg5aQ=; b=Y +kYpxzCmkaObMDKsElaKybkYiQgDFAOfumjkiK0v6gqCc7U5sXGsc22hXru8gl+d JzI96FZcZ/XPyC6fLhv+xxX4U9Nanr6s7UlcXP5h/AnnAuGbgNSUYcHQcbBcHLja FdW7ylO/d9rw1Huk9KhQOZk51SAFDvTZ7ODcfddfK7WM1JKshD+bvne+CmRYOh24 6H6L88Ld5HHTMkx4G7QovqMsd0R10eyIQoCZyXtwxFU7qJ4CESxo70tA1DE+nJZq zqbzRzwNXRpYZCAxY0FlB1GE2EQVjW3+OTZFufIRIhWI8Rct/RRuMTkAmkHsevlL bIr0g8waGjTv4pzBVrlKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1788786678; x=1788793878; bh=e0j3fsVumRKO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SqnZWkAy0cOjIp5wlxFg X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Sep 2026 09:11:16 -0400 (EDT) Date: Mon, 7 Sep 2026 14:11:15 +0100 From: Kiryl Shutsemau To: "Lorenzo Stoakes (ARM)" Cc: akpm@linux-foundation.org, david@kernel.org, nico.pache@linux.dev, baolin.wang@linux.alibaba.com, baohua@kernel.org, dev.jain@arm.com, hughd@google.com, lance.yang@linux.dev, liam@infradead.org, mhocko@suse.com, rppt@kernel.org, ryan.roberts@arm.com, shuah@kernel.org, surenb@google.com, usama.arif@linux.dev, vbabka@kernel.org, ziy@nvidia.com, usama.anjum@arm.com, agordeev@linux.ibm.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 09/19] selftests/mm: add folio-order detection self-check Message-ID: References: <20260815015901.1236937-1-kirill@shutemov.name> <20260815015901.1236937-10-kirill@shutemov.name> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Aug 18, 2026 at 11:30:06AM +0100, Lorenzo Stoakes (ARM) wrote: > On Sat, Aug 15, 2026 at 02:58:51AM +0100, Kiryl Shutsemau wrote: > > From: "Kiryl Shutsemau (Meta)" > > > > The khugepaged mTHP tests detect collapse results with the vm_util > > folio-order helpers rather than smaps AnonHugePages, which only sees PMD > > mappings. If those helpers are wrong, every case built on them is wrong > > the same way, and nothing says so. > > > > Check them directly. For every anon THP order the kernel supports, fault > > memory in with only that order enabled. Require the helpers to classify > > the backing as exactly that order: not a neighbouring order, and 4K-backed > > memory as order 0. > > > > Run it in the thp category, ahead of ./khugepaged, so a broken helper is > > reported as itself rather than as a collapse failure. Verified on x86-64 > > 4K (orders 0, 2-9) and arm64 64K (orders 0, 2-13). > > > > The test needs ALIGN(), which hmm-tests.c and migration.c each defined > > privately. Move it to vm_util.h and drop both copies. > > Also: > > uffd-unit-tests defines ALIGN_UP()... > > And really you probably want to match the kernel convention of ALIGN() > defaulting to align-up (for some reason) and name this ALIGN_DOWN() to be > consistent and avoid confusion BUT... Hm? It is align-up: #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) It matches kernel definition. pkey-helpers.h has ALIGN_UP(), ALIGN_DOWN() and two pointer variants of its own. Folding those onto the vm_util.h one is worth doing, as a follow-up rather than in this series. -- Kiryl Shutsemau / Kirill A. Shutemov