Hi Chris, On 2024-05-23 03:02, Chris Li wrote: > Hi Sukrit, > > It seems that you need the swap file block start address to read the > swap file headers. > This warning still requires the user to read the dmesg. The kernel > still does not have the swapfile header at resume. In other words, it > does not fix the issue. This was not intended to be a fix. I had created this patch thinking that adding an actual fix for this might be non-trivial and may not be desirable to everyone, especially when swapfile+hibernation is not commonly used. > I don't know the suspend/resume code enough, will adding recording the > physical start address of the swapfile in swap_info_struct help you > address this problem? The suspend code can write that value to > "somewhere* for resume to pick it up. > > Let's find a proper way to fix this issue rather than just warning on it. Adding a new member in swap_info_struct for the physical block offset will help in the fix, I think. It can even be enclosed in #ifdef HIBERNATION if nothing else needs that value. This value can be checked by hibernate[1] as: sis->start_offset == first_se(sis)->start_block Another possible solution might be to add a new swap flag like SWP_SUSP or SWP_HIBERNATE and set it only when we don't have this rounding up issue. Since we will boot the kernel normally first and later switch to our pre-hibernate kernel after image load from swap, the value cannot be set inside the kernel memory. We pass the start block address in kernel commandline parameter (resume_offset) for next boot. [1]: The hibernate swapfile checking code is the function swap_type_of() in mm/swapfile.c -- Sukrit