Re: [PATCH] Revert "xfs: clear PF_NOFREEZE for xfsaild kthread"

Michal Hocko
2016-01-22T09:52:40Z

On Wed 20-01-16 09:47:50, Michal Hocko wrote:
> On Wed 13-01-16 16:12:48, Dave Chinner wrote:
> > This reverts commit 24ba16bb3d499c49974669cd8429c3e4138ab102 as it
> > prevents machines from suspending. This regression occurs when the
> > xfsaild is idle on entry to suspend, and so there s no activity to
> > wake it from it's idle sleep and hence see that it is supposed to
> > freeze. Hence the freezer times out waiting for it and suspend is
> > cancelled.
> >
> > There is no obvious fix for this short of freezing the filesystem
> > properly, so revert this change for now.
>
> We had a similar report opensuse bugzilla just recently. I believe the
> proper fix should be the following:
> ---
> From ae910a86ada86804c34cc8136afebc9fefa15813 Mon Sep 17 00:00:00 2001
> From: Michal Hocko <mhocko@suse.com>
> Date: Tue, 19 Jan 2016 20:28:49 +0100
> Subject: [PATCH] xfs, xfsaild: Do not block suspend
>
> Hendik has reported suspend failures due to xfsaild blocking the freezer
> to settle down.
> Jan 17 19:59:56 linux-6380 kernel: PM: Syncing filesystems ... done.
> Jan 17 19:59:56 linux-6380 kernel: PM: Preparing system for sleep (mem)
> Jan 17 19:59:56 linux-6380 kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
> Jan 17 19:59:56 linux-6380 kernel: Freezing remaining freezable tasks ...
> Jan 17 19:59:56 linux-6380 kernel: Freezing of tasks failed after 20.002 seconds (1 tasks refusing to freeze, wq_busy=0):
> Jan 17 19:59:56 linux-6380 kernel: xfsaild/dm-5 S 00000000 0 1293 2 0x00000080
> Jan 17 19:59:56 linux-6380 kernel: f0ef5f00 00000046 00000200 00000000 ffff9022 c02d3800 00000000 00000032
> Jan 17 19:59:56 linux-6380 kernel: ee0b2400 00000032 f71e0d00 f36fabc0 f0ef2d00 f0ef6000 f0ef2d00 f12f90c0
> Jan 17 19:59:56 linux-6380 kernel: f0ef5f0c c0844e44 00000000 f0ef5f6c f811e0be 00000000 00000000 f0ef2d00
> Jan 17 19:59:56 linux-6380 kernel: Call Trace:
> Jan 17 19:59:56 linux-6380 kernel: [<c0844e44>] schedule+0x34/0x90
> Jan 17 19:59:56 linux-6380 kernel: [<f811e0be>] xfsaild+0x5de/0x600 [xfs]
> Jan 17 19:59:56 linux-6380 kernel: [<c0286cbb>] kthread+0x9b/0xb0
> Jan 17 19:59:56 linux-6380 kernel: [<c0848a79>] ret_from_kernel_thread+0x21/0x38
>
> The issue has been there for quite some time but it has been made
> visible by only by 24ba16bb3d49 ("xfs: clear PF_NOFREEZE for xfsaild
> kthread") because the suspend started seeing xfsaild.
>
> The above commit has missed that the !xfs_ail_min branch might call
> schedule with TASK_INTERRUPTIBLE without calling try_to_freeze so the pm
> suspend would wake up the kernel thread over and over again without any
> progress. What we want here is to use freezable_schedule instead to hide
> the thread from the suspend.
>
> While we are here also change schedule_timeout to freezable variant to
> prevent from spurious wakeups by suspend.
>
> Reported-by: Hendrik Woltersdorf <hendrikw@arcor.de>
> Signed-off-by: Michal Hocko <mhocko@suse.com>

Hendrik was able to test the patch so feel free to add his Tested-by
--
Michal Hocko