On Wed, Mar 16, 2011 at 08:58:44PM +0100, Jan Kara wrote: [..] > > > > Had a query. > > > > > > > > - What makes sure that flusher thread will not stop writing back till all > > > > the waiters on the bdi have been woken up. IIUC, flusher thread will > > > > stop once global background ratio is with-in limit. Is it possible that > > > > there are still some waiter on some bdi waiting for more pages to finish > > > > writeback and that might not happen for sometime. > > > Yes, this can possibly happen but once distribute_page_completions() > > > gets called (after a given time), it will notice that we are below limits > > > and wake all waiters. > > > Under normal circumstances, we should have a decent > > > estimate when distribute_page_completions() needs to be called and that > > > should be long before flusher thread finishes it's work. But in cases when > > > a bdi has only a small share of global dirty limit, what you describe can > > > possibly happen. > > > > So if a bdi share is small then it can happen that global background > > threshold is fine but per bdi threshold is not. That means > > task_bdi_threshold is also above limit and IIUC, distribute_page_completion() > > will not wake up the waiter until bdi_task_limit_exceeded() is in control. > It will wake them. What you miss is the check right at the beginning of > distribute_page_completions(): > dirty_exceeded = check_dirty_limits(bdi, &st); > if (dirty_exceeded < DIRTY_MAY_EXCEED_LIMIT) { > /* Wakeup everybody */ > ... > > When we are globally below (background+limit)/2, dirty_exceeded is set to > DIRTY_OK or DIRTY_BACKGROUND and thus we just wake all the waiters. Ok, thanks. Now I see it. Thanks Vivek -- 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