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=1796082323; b=y09rzl7V3kAV7bu9QijowluMMgssBookRDYk92xQQqhHgpqe2gW+zfjIuwRcPwCnXs/Q YZXY6thvFCaAoLrBLQWX+k2EJdJomuSjrF80PQBfntE/EE/kTL3D8dBqYW2PRgjgiA8WT Rch6Hug4doeYwcsXt2QQN0bgRAOPrQzIx6X6xSVn/NyNtQX+mJLRxrieQLXKZGvzlVO3l YRo/L0Q0h8IXhGXkjxRImwuuwMFkJoRsT4Rk8PkwiUKj3edKrjRSbuBdqzslSi9J4Yg62 7z65L83q5WYCtOtTwCjcfR0Ub8hVQD6jJd0MITnMzcSSxv9Tw+jhNX7/jIUG3/JJ00g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796082323; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-Id: In-Reply-To:References:X-Mailer:Mime-Version:Content-Type: Content-Transfer-Encoding; bh=ehSdumYVCv2nnVcn8/ywAaYZB7Z+QxRts1qYeRbfhSE=; b=HxBB0dmBASE3DXqenK661yzIXqzYchRSJjcHce7M+38ANhqI+XwRQ3phEkJ+z+VoaKIn GlFAJoV0/KDMm8euKQTt0GrZjifBp4OlwLD2NE8memYjoXe8xKMPpd0Sp1wuksJuq4WtH JcKeJNB6ZdxkYMNu/zfVs0LwxZwQQMi1lHUDeHbeZFTnBAWT09B4mpddtW0d3MLC9Qog9 eybc3u5P+aLk/bG94kdRIGfRbGcj/Kqz6dBTkLtLpe/1J7OwDUunpnuAafRU1HRKT+zy9 cwy9ddjOxNPC9BlSqDPJH/wZw/QsRu/0ClED1PlRV5oWzd4cSXnGyO+lcD28toeFegw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=N93nSsWB; 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 5D200606A320 for ; Mon, 30 Nov 2026 23:45:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=N93nSsWB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A2441F00897; Mon, 30 Nov 2026 23:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796082322; bh=ehSdumYVCv2nnVcn8/ywAaYZB7Z+QxRts1qYeRbfhSE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=N93nSsWBNwHTb6y0hebn6lS+hiul96aSl07jWJDftP0r+Hh14oTo9BKrx3mrkIrf8 nezgZJLCs8xQBR+e05jyk/49Dj2ktk6StFuexOAdLiQvUVfPfJUIClGVEh1yu6avFR /imrfpaiL4jaZ7xDG9GWS2TyNwOQnmHloaZBtqxA= Date: Mon, 30 Nov 2026 15:45:21 -0800 From: Andrew Morton To: "Michael S. Tsirkin" Cc: linux-mm@kvack.org, Andrea Arcangeli , Dan Williams , Dave Hansen , David Hildenbrand , Konrad Rzeszutek Wilk , Luiz Capitulino , Matthew Wilcox , Michal Hocko , Nitesh Narayan Lal , Oscar Salvador , Pankaj Gupta , Paolo Bonzini , Rik van Riel , Vlastimil Babka , Wei Wang , Yang Zhang , wei qi , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Mel Gorman , Alexander Duyck , linux-pm@vger.kernel.org Subject: Re: [PATCH] hibernation: clear PG_reported before saving image Message-Id: <20261130154521.2a5f84bdee2669fc8a3fc135@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 30 Nov 2026 12:02:56 -0500 "Michael S. Tsirkin" wrote: > Free buddy pages are excluded from the hibernation image, but the struct > page entries containing their PG_reported flags are saved. If > PG_reported is set, then after resume, page reporting will never report > these pages. But this is wrong: the restore kernel may have written to > these free pages while loading the image. > > --- a/kernel/power/snapshot.c > +++ b/kernel/power/snapshot.c > @@ -1274,6 +1274,11 @@ static void mark_free_pages(struct zone *zone) > list_for_each_entry(page, free_list, buddy_list) { > unsigned long i; > > + /* > + * Free page contents are not preserved across hibernation. > + */ > + __ClearPageReported(page); peeve: the __FooPageBar() functions are a micro-optimization and they're scary - if something else can possibly get at this page concurrently then we have a mess on our hands. So I like to see a comment against each one which makes it really really clear that we're not adding a once-per-century race. Either that, or remove the __ so we can sleep at night.