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=1795978839; b=iUck8c6YgVNvD97OI5swQXkTIWZ1TwxCeykWk0KJVGOGERdNeV0CjCnoxfgcJEDXyVWr mmohuZTc46uCK18uGA1nuomq1qw22Dl6OSCypCp5D/4PFSVdynbf7L7Tvv31iDzbgBoxN jmrq5mnyeF5ThsYKRA7/awy16RH1opLAlfKCSilcN5cNmnuWgT/J9g4xaimOV48OHUtvn Wep9S3e63jOBUCtjKfZymQMNj86ml1Wj4VLII+lRbGMxrE7STsHsXbtci9w0ujvEaubFF 5rnSiu03B8KoWS8/LgWfAy+SWwYn6waYgEgXoZP3qDiFk8zI1+aJn4l9pv/8Y0WWfKw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795978839; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=6vgc3jKYI3SfRGBvZ15GoSyLKltSv+p4bLtPRHaktFg=; b=F71O9wwC3dBL5K4np1YtRx9JSuUe+TA6JG3PtBOQ7BnC1se+/vtQ0sZ9DC75QJVk0UlA 95pi+aCEh2MEIox1/eywCdHHCHzuEZa2B+vbPG6AYJEC4KtnFRoObrQ3NMUptAQSG+aww Y+2K5cXFi4Yk3FuxYoxXD+ZWGkmifzEiIMegyXmhOadT6TfHqu+Ewyitf1WK0cI7Hx6AB Xycc3CtNY1fJ4gtowtr9nPS2fzPge8lWJlCkamgjozV+giqpbMnIDUneM/hwBLej647tu gzsO53FwXQbGdQTdix418Q2z6i1yLqjlMvJoSlshxUar357sEGxBpwNxRTsC9WSFSiQ== 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=nvras3wi; 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 6E6A8606A323 for ; Sun, 29 Nov 2026 19:00:39 +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=nvras3wi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19BB41F00896; Sun, 29 Nov 2026 19:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795978839; bh=6vgc3jKYI3SfRGBvZ15GoSyLKltSv+p4bLtPRHaktFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nvras3wirqHnq38aQatrs5F1BwuvOwSsvdp7d6Z5YZfrcgSYOMYdeVI8a1ZV8a7wf e1ZOa5FVOxUqeFJ/Z9ZDYkj4bqmqjn4/unpiFc6vT+JlEcFSVhDkpkYYtze6NobU3v HKNNBO/P3SugFYcZhOrw4KlJUbsQKcl8QhGeqIBoaRcSWarnIvA2QM/9d+qvY1VE1r 3d30ehyUpP8LDQvCDsl5gTGY5igxS5/NkapQD1h4MC3DScIytEnEk1KIpvLrkRdPuS q2oT5LSiMZFaEOciU78qqNPbHHsqP7QsPbuS4Cc761VGFtMTJ9rbZk46M2XtXj8+rP G3um4UN+nAXMg== 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 5.15.y v2] khugepaged: fix readahead lock inversion in collapse_file() Date: Sun, 29 Nov 2026 13:59:54 -0500 Message-ID: <2026-11-28-1-daily-reply-0027@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261127081618.31491-1-lance.yang@linux.dev> References: <20261127081618.31491-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? (5.15 already stopped reusing the huge page when page_count > 1 in 033b5d775511 ("mm/khugepaged: fix filemap page_to_pgoff(page) != offset").) -- Thanks, Sasha