All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Lianwei Wang <lianwei.wang@gmail.com>,
	linux-kernel@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Mandeep Singh Baines <msb@chromium.org>
Subject: Re: PATCH: freezer: add fake signal clearing back when thaw task
Date: Tue, 26 Feb 2013 15:28:04 +0100	[thread overview]
Message-ID: <20130226142804.GC28940@redhat.com> (raw)
In-Reply-To: <20130225235313.GE2679@htj.dyndns.org>

Ah, I just noticed that the changelog mentions wait_event_freezable() too,

On 02/25, Tejun Heo wrote:
>
> > Subject: [PATCH] freezer: add fake signal clearing back when thaw task
> >
> > The fake TIF_SIGPENDING is set during freeze userspace process, but it
> > is not cleared when thaw tasks after below commit:
> >   34b087e freezer: kill unused set_freezable_with_signal()
> >
> > This will cause the userspace task that wait_event_freezable

But there is no userspace users?

I guess wait_event_freezable() is only used to avoid the contribution
to load_avg. So we can simplify it, __wait_event_freezable() can simply
do freezable_schedule() or wait_event_freezable() can do
freezer_do_not_count + wait_event_interruptible. Or we are going to add
more users?

As for current users, I think they do not need this interface. Something
like below. I was going to try to convert khugepaged/ksm_scan_thread
yesterday but I was distracted, will try to do tomorrow.

Oleg.

--- x/mm/huge_memory.c
+++ x/mm/huge_memory.c
@@ -2616,7 +2616,7 @@ static int khugepaged_has_work(void)
 static int khugepaged_wait_event(void)
 {
 	return !list_empty(&khugepaged_scan.mm_head) ||
-		kthread_should_stop();
+		kthread_should_stop_or_freeze();
 }
 
 static void khugepaged_do_scan(void)
@@ -2655,20 +2655,18 @@ static void khugepaged_do_scan(void)
 
 static void khugepaged_wait_work(void)
 {
-	try_to_freeze();
-
 	if (khugepaged_has_work()) {
 		if (!khugepaged_scan_sleep_millisecs)
 			return;
 
-		wait_event_freezable_timeout(khugepaged_wait,
-					     kthread_should_stop(),
+		wait_event_interruptible_timeout(khugepaged_wait,
+					     kthread_should_stop_or_freeze(),
 			msecs_to_jiffies(khugepaged_scan_sleep_millisecs));
 		return;
 	}
 
 	if (khugepaged_enabled())
-		wait_event_freezable(khugepaged_wait, khugepaged_wait_event());
+		wait_event_interruptible(khugepaged_wait, khugepaged_wait_event());
 }
 
 static int khugepaged(void *none)
@@ -2678,7 +2676,7 @@ static int khugepaged(void *none)
 	set_freezable();
 	set_user_nice(current, 19);
 
-	while (!kthread_should_stop()) {
+	while (!kthread_freezable_should_stop(NULL)) {
 		khugepaged_do_scan();
 		khugepaged_wait_work();
 	}


  parent reply	other threads:[~2013-02-26 14:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21  6:19 PATCH: freezer: add fake signal clearing back when thaw task Lianwei Wang
2013-02-25 23:53 ` Tejun Heo
2013-02-26 14:14   ` Oleg Nesterov
2013-02-26 14:54     ` Oleg Nesterov
2013-02-26 14:28   ` Oleg Nesterov [this message]
2013-03-04  3:24   ` Lianwei Wang
2013-03-04 17:01     ` Tejun Heo
2013-03-04 17:32     ` Oleg Nesterov

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=20130226142804.GC28940@redhat.com \
    --to=oleg@redhat.com \
    --cc=lianwei.wang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msb@chromium.org \
    --cc=rjw@sisk.pl \
    --cc=tj@kernel.org \
    /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.