All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Yu Chen <yu.c.chen@intel.com>
Cc: Dave Chinner <david@fromorbit.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Hendrik Woltersdorf <hendrikw@arcor.de>,
	Dave Chinner <dchinner@redhat.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Jiri Kosina <jkosina@suse.cz>, Len Brown <len.brown@intel.com>,
	Rui Zhang <rui.zhang@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Yu Chen <yu.chen.surf@gmail.com>,
	linux-xfs@vger.kernel.org, Hou Tao <houtao1@huawei.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [Regression/XFS/PM] Freeze tasks failed in xfsaild
Date: Wed, 15 Nov 2017 11:14:40 +0100	[thread overview]
Message-ID: <20171115101440.ar2yki5axehfq3bq@dhcp22.suse.cz> (raw)
In-Reply-To: <20171114163953.GA27880@yu-chen.sh.intel.com>

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

      reply	other threads:[~2017-11-15 10:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-13 10:31 [Regression/XFS/PM] Freeze tasks failed in xfsaild Yu Chen
2017-11-13 20:14 ` Luis R. Rodriguez
2017-11-13 20:37   ` Dan Williams
2017-11-14 20:19     ` Luis R. Rodriguez
2017-11-14 21:25       ` Dave Chinner
2017-11-14 22:01         ` Rafael J. Wysocki
2017-11-14 23:07           ` Dave Chinner
2017-11-14 23:40             ` Rafael J. Wysocki
2017-11-15 18:01               ` Luis R. Rodriguez
2017-11-15 18:05                 ` Rafael J. Wysocki
2017-11-14  3:31   ` Yu Chen
2017-11-13 22:52 ` Dave Chinner
2017-11-14  3:39   ` Yu Chen
2017-11-14  4:02     ` Dave Chinner
2017-11-14 16:39       ` Yu Chen
2017-11-14 16:39         ` Yu Chen
2017-11-14 16:39         ` Yu Chen
2017-11-15 10:14         ` Michal Hocko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171115101440.ar2yki5axehfq3bq@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=hendrikw@arcor.de \
    --cc=houtao1@huawei.com \
    --cc=jkosina@suse.cz \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=yu.c.chen@intel.com \
    --cc=yu.chen.surf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.