Prev: [PATCH] ACPI: skip checking BM_STS if the BIOS doesn't ask for it
Next: generic changes for memblock
From: Tejun Heo on 26 Jul 2010 12:20 Just one more thing. On 07/26/2010 06:05 PM, Tejun Heo wrote: > * Placing try_to_freeze() could be a bit annoying. It shouldn't be > executed when there's a work to flush. * Similar issue exists for kthread_stop(). The kthread shouldn't exit while there's a work to flush (please note that kthread_worker interface allows detaching / attaching worker kthread during operation, so it should remain in consistent state with regard to flushing). Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on 26 Jul 2010 15:00 Hello, On 07/26/2010 06:31 PM, Michael S. Tsirkin wrote: >> On 07/26/2010 06:05 PM, Tejun Heo wrote: >>> * Placing try_to_freeze() could be a bit annoying. It shouldn't be >>> executed when there's a work to flush. > > BTW why is this important? > We could always get another work and flush right after > try_to_freeze, and then flush would block for a long time. > > BTW the vhost patch you sent does not do this at all. > I am guessing it is because our thread is not freezable? Yeap, I think so. >> * Similar issue exists for kthread_stop(). The kthread shouldn't exit >> while there's a work to flush (please note that kthread_worker >> interface allows detaching / attaching worker kthread during >> operation, so it should remain in consistent state with regard to >> flushing). > > Not sure I agree here. Users must synchronise flush and stop calls. > Otherwise a work might get queued after stop is called, and > you won't be able to flush it. For freeze, it probably is okay but for stop, I think it's better to keep the semantics straight forward. It may be okay to do otherwise but having such oddity in generic interface is nasty and may lead to surprises which can be pretty difficult to track down later on. It's just a bit more of annoyance while writing the generic code, so... Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on 26 Jul 2010 15:10 On 07/26/2010 06:23 PM, Michael S. Tsirkin wrote: >> * Can you please keep the outer goto repeat loop? I just don't like >> outermost for (;;). > > Okay ... can we put the code in a {} scope to make it clear > where does the loop starts and ends? If we're gonna do that, it would be better to put it inside a loop construct. The reason why I don't like it is that loops like that don't really help read/writeability much while indenting the whole logic unnecessarily and look more like a result of obsession against goto rather than any practical reason. It's just a cosmetic preference and I might as well be the weirdo here, so if you feel strong about it, please feel free to put everything in a loop. >> * Placing try_to_freeze() could be a bit annoying. It shouldn't be >> executed when there's a work to flush. > > It currently seems to be executed when there is work to flush. > Is this wrong? Oh, does it? As I wrote in the other mail, things like that wouldn't necessarily break correctness but I think it would be better to avoid surprises in the generic code if not too difficult. >> * I think A - B <= 0 test would be more familiar. At least >> time_before/after() are implemented that way. > > I am concerned that this overflows a signed integer - > which I seem to remeber that C99 disallows. Really? Overflows of pointer isn't expected and that's why we have weird RELOC_HIDE() macro for such calculations but integers not expected to overflow is a news to me. Are you sure? That basically means time_before/after() aren't safe either. > timer macros are on data path so might be worth the risk there, > but flush is slow path so better be safe? I don't think performance matters much here. I just think the sign test is clearer / more familiar for the logic. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on 26 Jul 2010 15:20 On 07/26/2010 06:51 PM, Michael S. Tsirkin wrote: > On Mon, Jul 26, 2010 at 06:14:30PM +0200, Tejun Heo wrote: >> Just one more thing. > > I noticed that with vhost, flush_work was getting the worker > pointer as well. Can we live with this API change? Yeah, the flushing mechanism wouldn't work reliably if the work is queued to a different worker without flushing, so yeah passing in @worker might actually be better. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on 26 Jul 2010 15:40 Hello, On 07/26/2010 09:14 PM, Tejun Heo wrote: > On 07/26/2010 06:51 PM, Michael S. Tsirkin wrote: >> I noticed that with vhost, flush_work was getting the worker >> pointer as well. Can we live with this API change? > > Yeah, the flushing mechanism wouldn't work reliably if the work is > queued to a different worker without flushing, so yeah passing in > @worker might actually be better. Thinking a bit more about it, it kind of sucks that queueing to another worker from worker->func() breaks flush. Maybe the right thing to do there is using atomic_t for done_seq? It pays a bit more overhead but maybe that's justifiable to keep the API saner? It would be great if it can be fixed somehow even if it means that the work has to be separately flushed for each worker it has been on before being destroyed. Or, if flushing has to be associated with a specific worker anyway, maybe it would be better to move the sequence counter to kthread_worker and do it similarly with the original workqueue so that work can be destroyed once execution starts? Then, it can at least remain semantically identical to the original workqueue. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: [PATCH] ACPI: skip checking BM_STS if the BIOS doesn't ask for it Next: generic changes for memblock |