From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795978838; b=xkejtIJE+WB2Bxb8N/3aC3QbMgtT1zJveeatr4s/eQ9gmKlJcqBfNOpBYX6OROw/GhPH 1QUoop2TCslNJ1sQpN7ca3zxEaIO/g1/IgnfQNrWa7bJdu3sK3bDmBGJNGad7VRg4U7YP NivyReJ+0hetzBZwyQZKXGNv6wFa1H/JhYyRvf6+xhp9krG0PiL5ziWj0Q99EgH7NeCMr ETpZj1TRspEDeqJ1kT5UycxGdggXz30gBV0WjZFZCz4yP2SY7bxmUeLofs12mWp7jhIB+ pqG0lYs+97vRmjHLE0FdVGwaqQk4q8hZjU4LqJJu/hDl7NzsdUMQm2VAdCjEmGtpxIA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795978838; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=XDJ78fT82IhwxxkKBzzqdWH4IRI7+Uvfo9On7dtyJtQ=; b=pWCiUrihd9ucuRlT4TORfZJKUFuVjGtFq1tXVbpS5B1dllz/WLsrXVB23wcYwa7afMos 6o7bqNezVAK6mqrOcUdYecedkl1wqiDsgexWr5RDfRC94FPHvp68n9xKKo4u4yFydezyl 7gze2r5+O78YvjJe74NMzsmPR2P1aUEeWTNzYmWka/5zBLzbQm5Evr+GiP4gwmkpnN4Mo 0AQ0xOdSIuIOX99y1EM3OjnzOTuEMd71rjN5XEl1rBbURDNeBNY6XssFfKUkmdNHdCIP5 YrBG58YOO8T6w6/cKGevQPUMf7B1eHgwv43yAyvSk7qhpPq7uxOf4I6ZruY4S2s5yww== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bEjObD9Z; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4848A606A323 for ; Sun, 29 Nov 2026 19:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bEjObD9Z Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8F2F1F0089B; Sun, 29 Nov 2026 19:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795978837; bh=XDJ78fT82IhwxxkKBzzqdWH4IRI7+Uvfo9On7dtyJtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bEjObD9ZyoHrsdUh7V3DEMF/lhg2lm+RIWVEB/l3yy7I8RA76B7UDhGw9l9niUMh8 D9hcr9SQbUSpOS633PQnv4srPJTiNmgUSxB0/vhbpjTp1SzGPeUcSZyXT6o6CAWD6M tK8TmIRzsZfR8A3xlK3a2ZFodMqHdSDs6lzjgvZJgNVh4xDz+0pHh5DKP3ACZ2JfYO gWNbrAT+7sdwKHXY1z8HTDnm848QlV6DI1DfhbvASAUHPw+Fl7+4rHSpAf5adzqqFK e66aqmgk5A/2T4DPiS6z5i94GHCve13rrs+8m3xopE877vfQNCxDES0mapQz/gC60a VoOFA161i1HIA== From: Sasha Levin To: stable@vger.kernel.org Cc: Sasha Levin , syzbot+16bf7cd0ebeb1de93aa5@syzkaller.appspotmail.com, Lance Yang , Pedro Falcato , "David Hildenbrand (Arm)" , Zi Yan , Baolin Wang Subject: Re: [PATCH 6.1.y v2] khugepaged: fix readahead lock inversion in collapse_file() Date: Sun, 29 Nov 2026 13:59:53 -0500 Message-ID: <2026-11-28-1-daily-reply-0026@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261127081556.31348-1-lance.yang@linux.dev> References: <20261127081556.31348-1-lance.yang@linux.dev> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit > We need to release those folio locks before starting readahead. On a page > cache miss, roll back first, populate the collapse range, and retry once. Both the 6.1 and the 5.15 backport retry with the same huge page ("goto retry") after collapse_file() has already inserted it into the page cache. These trees lack a2e17cc2efc7 ("mm/khugepaged: maintain page cache uptodate flag"), which keeps the new page out of the page cache until the collapse succeeds. So a racing lookup can hold a reference to the locked, not-uptodate page and wait on its lock; the rollback unlock_page() can hand it the lock, and the retry then re-locks the page with __SetPageLocked() and sets ->mapping again. Two tasks then hold PG_locked, or a waiter treats the not-uptodate THP as a normal page cache page. This is from reading the code, not reproduced. Could you respin: either free the huge page and allocate a fresh one before retrying, or do the readahead after the rollback and return SCAN_FAIL without a retry? -- Thanks, Sasha