[Sheepdog] [PATCH v2 1/2] force some callbacks of cluster request running in worker thread

Christoph Hellwig hch at infradead.org
Sun Apr 29 12:45:02 CEST 2012


On Sat, Apr 28, 2012 at 03:33:53PM +0800, Liu Yuan wrote:
> I think its time to retrofit process_main(). it doesn't necessarily run
> in main thread. Actually, we should try to put it in the event queue as
> possible as we can, to offload the main thread.
> 
> I'd suggest a new name scheme:
> process_work() -> process_top(), which runs only local node
> process_main() -> process_bottom(), which runs in all nodes, either in
> worker or in main thread.

How would we decide when to run it in the main or worker thread?

I'm getting more an more scared about the threading model - there's a
lot of assumption that certain pieces of code only run in the main
thread, or in the event_queue and thus can avoid locking, but there's no
good way to veryify that this actually is the case.

I think before this gets even more complicated an tid based assertation
mechanism ala:

   main_tid = gettid();

static inline bool assert_mainthread(void)
{
	assert(gettid() == main_tid);
}

plus variants for other "optimized" queues needs to be added over all
places that have this assumption.

As for the naming of the execution function, why not name them
descriptively as what they do:

  process_on_each_node()

and

  process_local()

or similar.




More information about the sheepdog mailing list