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, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>