[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171115101440.ar2yki5axehfq3bq@dhcp22.suse.cz>
Date: Wed, 15 Nov 2017 11:14:40 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Yu Chen <yu.c.chen@...el.com>
Cc: Dave Chinner <david@...morbit.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Hendrik Woltersdorf <hendrikw@...or.de>,
Dave Chinner <dchinner@...hat.com>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Jiri Kosina <jkosina@...e.cz>, Len Brown <len.brown@...el.com>,
Rui Zhang <rui.zhang@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Yu Chen <yu.chen.surf@...il.com>, linux-xfs@...r.kernel.org,
Hou Tao <houtao1@...wei.com>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [Regression/XFS/PM] Freeze tasks failed in xfsaild
On Wed 15-11-17 00:39:53, Yu Chen wrote:
[...]
> Before the filesystem freezing feature is merged into
> upstream, wouldn't it be nice if we have some compromise
> workaround for such kind of issues: how about treat the
> always-sleeping tasks as frozen? They are safe to be
> regarded as frozen because they do nothing.
> Here's a draft patch to get it done, and it can be
> optimized if the direction is acceptible.
I do not think this will fly. You have no guarantee those tasks wake up
at any moment after you consider them frozen and declare the system as
quiescent from the userspace POV.
> diff --git a/kernel/power/process.c b/kernel/power/process.c
> index 7381d49a44db..93e123a58558 100644
> --- a/kernel/power/process.c
> +++ b/kernel/power/process.c
> @@ -100,8 +100,28 @@ static int try_to_freeze_tasks(bool user_only)
> read_lock(&tasklist_lock);
> for_each_process_thread(g, p) {
> if (p != current && !freezer_should_skip(p)
> - && freezing(p) && !frozen(p))
> - sched_show_task(p);
> + && freezing(p) && !frozen(p)) {
> + unsigned long cnt_ctx;
> +
> + cnt_ctx = p->nvcsw + p->nivcsw;
> + msleep(MSEC_PER_SEC);
> + /* If the task keeps asleep for 1000 ms
> + * (actually should be:
> + * freeze_timeout_msecs+1000ms in theory)
> + * AKA, there is no context switch for the
> + * task during this period, we predict this
> + * task is not likely to do any work in the
> + * future and we can treat it as frozen.
> + */
> + if ((p->state & TASK_NORMAL) &&
> + (cnt_ctx == (p->nvcsw + p->nivcsw))) {
> + pr_err("(%s %c) is sleeping and safe to be treated as frozen\n",
> + p->comm, task_state_to_char(p));
> + todo = 0;
> + } else {
> + sched_show_task(p);
> + }
> + }
> }
> read_unlock(&tasklist_lock);
> }
> --
> 2.13.5
>
>
>
>
>
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists