From: Jan Kara Subject: Re: [PATCH RFC] mm: Implement balance_dirty_pages() through waiting for flusher thread Date: Mon, 21 Jun 2010 15:42:39 +0200 Message-ID: <20100621134238.GE3828@quack.suse.cz> References: <1276797878-28893-1-git-send-email-jack@suse.cz> <1276856497.27822.1699.camel@twins> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org, akpm@linux-foundation.org, wfg@mail.ustc.edu.cn To: Peter Zijlstra Return-path: Received: from cantor2.suse.de ([195.135.220.15]:37204 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932288Ab0FUNnC (ORCPT ); Mon, 21 Jun 2010 09:43:02 -0400 Content-Disposition: inline In-Reply-To: <1276856497.27822.1699.camel@twins> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri 18-06-10 12:21:37, Peter Zijlstra wrote: > On Thu, 2010-06-17 at 20:04 +0200, Jan Kara wrote: > > + if (bdi_stat(bdi, BDI_WRITTEN) >= bdi->wb_written_head) > > + bdi_wakeup_writers(bdi); > > For the paranoid amongst us you could make wb_written_head s64 and write > the above as: > > if (bdi_stat(bdi, BDI_WRITTEN) - bdi->wb_written_head > 0) > > Which, if you assume both are monotonic and wb_written_head is always > within 2^63 of the actual bdi_stat() value, should give the same end > result and deal with wrap-around. > > For when we manage to create a device that can write 2^64 pages in our > uptime :-) OK, the fix is simple enough so I've changed it, although I'm not paranoic enough ;) (I actually did the math before writing that test). Honza -- Jan Kara SUSE Labs, CR