Re: [PATCH v3] PM/Memory-hotplug: Avoid task freezing failures

From: Tejun Heo
Date: Mon Nov 21 2011 - 11:40:14 EST


Hello, Srivatsa.

On Mon, Nov 21, 2011 at 10:06:39AM +0530, Srivatsa S. Bhat wrote:
> void lock_system_sleep(void)
> {
> /* simplified freezer_do_not_count() */
> current->flags |= PF_FREEZER_SKIP;
>
> mutex_lock(&pm_mutex);
>
> }
>
> void unlock_system_sleep(void)
> {
> mutex_unlock(&pm_mutex);
>
> /* simplified freezer_count() */
> current->flags &= ~PF_FREEZER_SKIP;
>
> }
>
> We probably don't want the restriction that freezer_do_not_count() and
> freezer_count() work only for userspace tasks. So I have open coded
> the relevant parts of those functions here.
>
> I haven't tested this solution yet. Let me know if this solution looks
> good and I'll send it out as a patch after testing and analyzing some
> corner cases, if any.

Ooh ooh, I definitely like this one much better. Oleg did something
similar w/ wait_event_freezekillable() too. On related notes,

* I think it would be better to remove direct access to pm_mutex and
use [un]lock_system_sleep() universally. I don't think hinging it
on CONFIG_HIBERNATE_CALLBACKS buys us anything.

* In the longer term, we should be able to toggle PF_NOFREEZE instead
as SKIP doesn't mean anything different. We'll probably need a
better API tho. But for now SKIP should work fine.

Thank you.

--
tejun
--
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/