On Sat, 31 Oct 2015, Rafael J. Wysocki wrote: > > > > > > I would say instead "no I/O is allowed from now on". Maybe that's an > > > > > > overstatement, but I think it comes closer to the truth. > > > > > > > > But that's what PM callbacks are for. > > Not really. In fact, PM callbacks may not be suitable for some use cases even > in theory (that's if you want something to stop running before any PM callbacks > are executed during suspend). If that's the case, wouldn't then it be better to have .pre_suspend callback as well, instead of having to do this kind of polling? > > > The most natural implementation would be for the callback routine to set > > > a flag; at various strategic points the kthread would check the flag and > > > if it was set, call a routine that sits around and waits for the suspend > > > to be over. > > > > Could you name at least some existing kthreads that would actually *need* > > such complex handling, instead of just waiting in schedule() until > > suspend-resume cycle is over, given that PM callbacks do all the necessary > > cleanup (putting HW to sleep, cancelling timers, etc) anyway? > > > > PM callback can always explicitly do kthread_stop() on a particular > > kthread if really necessary. > > Runtime PM uses a freezable workqueue, allocated in pm_start_workqueue(). Yeah, agreed, as I said in the original mail, freezable workqueues I am not covering for the moment, there might be a additional issues with them compared to kthreads. That needs to be further looked into. > > The main point of freezer is to reach quiescent state wrt. filesystems > > (metadata in memory need to be absolutely in sync with what's on disk). > > That's no different between hibernation and s2ram, is it? > > > > BTW, a quite some of this has been already "pre-discussed" in > > Documentation/power/freezing-of-tasks.txt (which has BTW been written > > before we've had the possibility to freeze filesystems, and this fact is > > even point there out). > > That is somewhat outdated in my view. At least my list of reasons for using > the freezer is now somewhat different from the one given in that file. Well, so what is the list then, and how do you know that kthread_run() users are behaving according to that list? That's basically exactly what this effort is about -- making some sense out of current situation. Thanks, -- Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html