If you are talking about 5 second timedwait(), then it is only used to exit the thread. It won't ensure progress (shouldn't based on my code review).
Regards, Malahal. Matt W. Benjamin [m...@cohortfs.com] wrote: > From memory. > > The code isn't trying to eliminate that race, no. If/when it arises, and all > threads are idle, then the timeout will ensure progress. > > In particular, if there is no work for -any- threads, it is desirable for at > least > most to go idle. As work ramps up, threads will be woken. > > The next optimization, I would intuit, might be to have a leader that is > resistant > to idle. > > Matt > > ----- "Malahal Naineni" <mala...@us.ibm.com> wrote: > > > The nfs_rpc_enqueue_req is called by the producer and > > nfs_rpc_dequeue_req is called by the consumer. Here is the high level > > view of those functions. > > > > In particular, if a consumer finds no request in the queue, and then > > attempts to go to sleep, but before he adds himself to the wait list > > (before step 2b), if producer adds another request at that instant, > > the > > producer would find the wait list empty and couldn't wake up any > > consumer. > > > > Later the consumer would add himself to the wait list and goes to > > sleep > > (in a loop actually due to timedwait call. This will continue if > > there > > was no other request coming in. Am I missing something? > > > > nfs_rpc_dequeue_req() > > { > > 1. request = nfs_rpc_consume_req() > > 2. if (request == NULL) { /* no work to do */ > > a) set Wqe_LFlag_WaitSync flag > > b) add itself to the wait list > > c) while not Wqe_LFlag_SyncDone { > > pthread_cond_timedwait(5 seconds) > > } > > goto step 1; /* woke up with SyncDone */ > > } > > } > > > > nfs_rpc_enqueue_req() > > { > > 1. add request to the list > > 2. if (wait list is not empty) { > > a) pick up first waiting thread. > > b) set Wqe_LFlag_SyncDone > > c) if Wqe_LFlag_WaitSync() pthread_cond_signal(). > > } > > } > > > > > > ------------------------------------------------------------------------------ > > Monitor Your Dynamic Infrastructure at Any Scale With Datadog! > > Get real-time metrics from all of your servers, apps and tools > > in one place. > > SourceForge users - Click here to start your Free Trial of Datadog > > now! > > http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140 > > _______________________________________________ > > Nfs-ganesha-devel mailing list > > Nfs-ganesha-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel > > -- > Matt Benjamin > CohortFS, LLC. > 315 West Huron Street, Suite 140A > Ann Arbor, Michigan 48103 > > http://cohortfs.com > > tel. 734-761-4689 > fax. 734-769-8938 > cel. 734-216-5309 > ------------------------------------------------------------------------------ Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140 _______________________________________________ Nfs-ganesha-devel mailing list Nfs-ganesha-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel