From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a2-smtp.messagingengine.com (fhigh-a2-smtp.messagingengine.com [103.168.172.153]) (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 3C17F40911F; Sun, 16 Aug 2026 22:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.153 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786920458; cv=none; b=c4KyG5AmXjXuPohwVFla3RU/DEPAHRQTJw7q6aelnmbsFyoMZsA29ahQsIOO6V9FcDRJ0Krq3uE4w3ywCEdGNyvGLqis9UKxTKAK1NHKvp55Mtd3hKfVvfka2BBz99NLpG4HI6ZQ6B3S8OCydjzb0tfKn9LJLQ07+xKfMjpYQ4Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786920458; c=relaxed/simple; bh=QED0ivctn/g84zHlwg3dHaWIpmZRCAVoxxfhuvqzEtM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pZ946IOl7s0PPpkoPHQf5odbxN1egVfGcjrUzOLwDlMZdcIM2hq+dTYsuPhMTwpwGEQ0dNHwJm9l5YzJVC+/ZyUBc+llsnFCGUI+mekuNw5B7flbO9X+DT+qJfXntqoLf7SRW5uMVX2C10wwOD2XVSIXtO/ONPjmUZUEBKGNsms= 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=nG9tow1d; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=BOnDi6ps; arc=none smtp.client-ip=103.168.172.153 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="nG9tow1d"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="BOnDi6ps" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5785714000F8; Sun, 16 Aug 2026 18:47:36 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Sun, 16 Aug 2026 18:47:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1786920456; x= 1787006856; bh=UyrP/wXPOBJTdhoFE5YGqbURIEa1HSuJzV4RfAXPajU=; b=n G9tow1dkQz77VjVwwF3jcgHCENpHOmT8atxbCLLECcSiWMcmK6RFYtDpUvqxkL9w CDUp/5852TW8lhwrZBw4LnSUM49QS+ubiCBuP/Oc7zR+MnT7KO093rX60nzUsC8k WF259W3rgsUCWMJnwYpO7w3ilcTCjCDYsbN844W1SHCtSPPG2qstrHMDxqNHsLlJ H4Gkc9DevfM9JdR2snF+2PuW8JDFOhRAEBUlmzRJd7C3w7d5o8CPVFsE1fyzWzBQ rHcAlP72IyQuA3Oa18FluUCvGMft6PBoqd3uurqhboVAcG32GFWXZl/UT3Umx44e sLOTkOswIKKnPFy5hb0FA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm3; t=1786920456; x=1787006856; bh=U yrP/wXPO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5p5dipgHyieJ7AirBkuIwt+OgA/k+nC52hzYouNJCAlA X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 16 Aug 2026 18:47:35 -0400 (EDT) From: Kiryl Shutsemau To: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, nico.pache@linux.dev Cc: 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, kas@kernel.org, jannh@google.com, willy@infradead.org, pfalcato@suse.de, rostedt@goodmis.org, mhiramat@kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [RFC PATCH 42/57] mm/collapse: allow error injection into the freeze Date: Sun, 16 Aug 2026 23:45:54 +0100 Message-ID: <20260816224609.308019-43-kirill@shutemov.name> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260816224609.308019-1-kirill@shutemov.name> References: <20260816224609.308019-1-kirill@shutemov.name> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Kiryl Shutsemau (Meta)" The freeze refuses a candidate for reasons a test cannot arrange: a co-mapper appearing between the two sweeps, a GUP-fast pin, writeback. What the round does then -- the candidate drops out, its neighbours carry on, the region goes back to selection at a lower order -- is worth exercising on purpose. Tag collapse_freeze_candidate(), noinline so fail_function can find the symbol. ERRNO is the only injection type for a function that returns a value rather than a pointer or a bool, so an injected result is a negative errno. It only ever reaches cand->result, where every caller compares it against SCAN_SUCCEED and finds it unequal, which is the refusal the test wants. Tracing prints it as a number, having no symbol for it. A forced return happens at function entry, so this reaches the refusal, not the freeze's own unwind path. Assisted-by: Claude-Code:claude-opus-5 Signed-off-by: Kiryl Shutsemau (Meta) --- mm/collapse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/collapse.c b/mm/collapse.c index 952e3f62d920..76a53616b240 100644 --- a/mm/collapse.c +++ b/mm/collapse.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include /* x86 flush_tlb_range() uses hstate_vma() */ @@ -937,7 +938,7 @@ static enum scan_result collapse_check_candidate(struct vm_area_struct *vma, * collapse_freeze() issues the ranged TLB flush over everything that froze * before dropping the ptl. No copy may run before it completes. */ -static enum scan_result collapse_freeze_candidate(struct mm_struct *mm, +static noinline enum scan_result collapse_freeze_candidate(struct mm_struct *mm, struct collapse_candidate *cand, pte_t *pte) { const unsigned int nr_pages = candidate_nr_pages(cand); @@ -1085,6 +1086,7 @@ static enum scan_result collapse_freeze_candidate(struct mm_struct *mm, collapse_unfreeze_candidate(mm, cand, pte, nr_saved, nr_frozen); return result; } +ALLOW_ERROR_INJECTION(collapse_freeze_candidate, ERRNO); /* * Raise the two barriers on the sources of every candidate: migration entries in -- 2.54.0