From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 09/27] nfs: writeback pages wait queue Date: Thu, 03 Mar 2011 17:08:01 +0100 Message-ID: <1299168481.1310.56.camel@laptop> References: <20110303064505.718671603@intel.com> <20110303074949.809203319@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Andrew Morton , Jan Kara , Jens Axboe , Chris Mason , Trond Myklebust , Christoph Hellwig , Dave Chinner , Theodore Ts'o , Mel Gorman , Rik van Riel , KOSAKI Motohiro , Greg Thelen , Minchan Kim , Vivek Goyal , Andrea Righi , Balbir Singh , linux-mm , linux-fsdevel@vger.kernel.org, LKML To: Wu Fengguang Return-path: Received: from casper.infradead.org ([85.118.1.10]:56455 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755733Ab1CCQG3 (ORCPT ); Thu, 3 Mar 2011 11:06:29 -0500 Received: from j77219.upc-j.chello.nl ([24.132.77.219] helo=dyad.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.72 #1 (Red Hat Linux)) id 1PvB2q-00014Q-45 for linux-fsdevel@vger.kernel.org; Thu, 03 Mar 2011 16:06:28 +0000 In-Reply-To: <20110303074949.809203319@intel.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, 2011-03-03 at 14:45 +0800, Wu Fengguang wrote: > +static void nfs_wakeup_congested(long nr, > + struct backing_dev_info *bdi, > + wait_queue_head_t *wqh) > +{ > + long limit = nfs_congestion_kb >> (PAGE_SHIFT - 10); > + > + if (nr < 2 * limit - min(limit / 8, NFS_WAIT_PAGES)) { > + if (test_bit(BDI_sync_congested, &bdi->state)) { > + clear_bdi_congested(bdi, BLK_RW_SYNC); > + smp_mb__after_clear_bit(); > + } > + if (waitqueue_active(&wqh[BLK_RW_SYNC])) > + wake_up(&wqh[BLK_RW_SYNC]); > + } > + if (nr < limit - min(limit / 8, NFS_WAIT_PAGES)) { > + if (test_bit(BDI_async_congested, &bdi->state)) { > + clear_bdi_congested(bdi, BLK_RW_ASYNC); > + smp_mb__after_clear_bit(); > + } > + if (waitqueue_active(&wqh[BLK_RW_ASYNC])) > + wake_up(&wqh[BLK_RW_ASYNC]); > + } > +} memory barriers want a comment - always - explaining what they order and against whoem.