Re: PATCH: freezer: add fake signal clearing back when thaw task

From: Oleg Nesterov
Date: Tue Feb 26 2013 - 09:29:43 EST


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();
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/