Linux Power Management development
 help / color / mirror / Atom feed
* Re: [PATCH 6.18 0167/1250] PM: hibernate: call preallocate_image() after freeze prepare
@ 2026-09-19 13:47 David Lomas
  2026-09-20 17:50 ` Sasha Levin
  2026-09-21  0:13 ` Sasha Levin
  0 siblings, 2 replies; 7+ messages in thread
From: David Lomas @ 2026-09-19 13:47 UTC (permalink / raw)
  To: gregkh, sashal
  Cc: stable, rafael.j.wysocki, matthew.leach, superm1, linux-pm,
	regressions

Please note, I'm chasing a bug on this laptop using claude, and not
familiar at all with kernel development, so take what it's written
below with a pinch of whatever you prefer. But it seems pretty
convinced it has found the root cause of periodic freezes during
hibernation (whether from sleep on a timer, or direct via 'systemctl
hibernate').

Re: <20260917151556.616977299@linuxfoundation.org>
Upstream commit 783c8109844503bd1c35dab41b6d5fd074a9f131 deadlocks
hibernation entry on my machine (7.2.4, Dell XPS 13 9360, 8 GB, zswap
on) whenever the system has been in use for some hours: the hibernate
call never returns and the laptop sits warm with no image written,
seven times in ten days. Direct `systemctl hibernate` and
suspend-then-hibernate are the same. Never on 7.1.x or 6.18.49, and
never on a fresh boot.

Captured with SysRq (w) after ~8 minutes hung. The hibernating task is
in the direct-reclaim throttle waiting for kswapd, which was frozen 27
ms earlier by freeze_kernel_threads(), which this commit moved ahead
of hibernate_preallocate_memory():

  [ 8404.650787] Freezing remaining freezable tasks completed (elapsed
0.001 seconds)
  [ 8404.677608] PM: hibernation: Preallocating image memory
  (nothing further; SysRq at 8871)

  task:systemd-sleep   state:D pid:36677
   __schedule
   schedule
   throttle_direct_reclaim+0x358/0x3e0
   try_to_free_pages+0xbf/0x220
   __alloc_pages_slowpath.constprop.0+0x531/0x1510
   __alloc_frozen_pages_noprof+0x334/0x370
   alloc_pages_mpol+0xb2/0x160
   alloc_pages_noprof+0x49/0x90
   preallocate_image_memory+0x35/0x9b
   hibernate_preallocate_memory+0x25b/0x390
   hibernation_snapshot+0xc1/0x4e0
   hibernate.cold+0x117/0x4b5
   state_store+0xf2/0x100

  Node 0 Normal free:32044kB boost:119232kB min:172224kB low:185472kB
  high:198720kB ... inactive_anon:1601740kB zspages:362688kB
  377713 pages in swap cache

All four CPUs idle (SysRq l). Free memory is below the pfmemalloc
reserve (two thirds of which is watermark boost), so the GFP_KERNEL
allocations in preallocate_image_memory() go through
throttle_direct_reclaim(), which does wait_event_killable() on
pgdat->pfmemalloc_wait until kswapd raises free pages above the
reserve. kswapd is frozen, so nothing ever wakes it. The wait is
killable, so the hung-task detector does not report it either. With
hung_task_panic, softlockup_panic and hardlockup_panic all set,
nothing fired in eight minutes.

This is the concern Rafael raised on v3 (frozen kswapd); the reply
covered the I/O path but not the pfmemalloc throttle. Reverting the
order, or bypassing the throttle for the hibernation task (PF_KTHREAD
style), would avoid it. Setting vm.watermark_boost_factor=0 shrinks
the window but does not close it.

Full SysRq dump (l/m/w, via efi-pstore) available on request.

#regzbot introduced: 783c8109844503bd1c35dab41b6d5fd074a9f131

David Lomas

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH 6.18 0167/1250] PM: hibernate: call preallocate_image() after freeze prepare
@ 2026-09-19 20:52 David Lomas
  2026-09-21 21:18 ` Hic Haec Hoc
  0 siblings, 1 reply; 7+ messages in thread
From: David Lomas @ 2026-09-19 20:52 UTC (permalink / raw)
  To: h.haechoc+kernel
  Cc: linux-pm, rafael.j.wysocki, matthew.leach, gregkh, stable,
	regressions

Same commit, same symptom: my report with the blocked-task backtrace
is at https://lore.kernel.org/all/CALjEBWQo0-Sdimo+aRNKUQvgDGw=jBFCcfwCXaqVdtoPrHLAQA@mail.gmail.com/
(XPS 13 9360, 8 GB, zswap). The hibernating task sits in
throttle_direct_reclaim() waiting for kswapd, which
freeze_kernel_threads() froze just before
hibernate_preallocate_memory() ran.

#regzbot introduced: 783c8109844503bd1c35dab41b6d5fd074a9f131

David

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-21 21:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-19 13:47 [PATCH 6.18 0167/1250] PM: hibernate: call preallocate_image() after freeze prepare David Lomas
2026-09-20 17:50 ` Sasha Levin
2026-09-21  8:08   ` Thorsten Leemhuis
2026-09-21 10:22     ` David Lomas
2026-09-21  0:13 ` Sasha Levin
  -- strict thread matches above, loose matches on Subject: below --
2026-09-19 20:52 David Lomas
2026-09-21 21:18 ` Hic Haec Hoc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox