Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759672AbcDMNI4 (ORCPT ); Wed, 13 Apr 2016 09:08:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:55210 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757421AbcDMNIy (ORCPT ); Wed, 13 Apr 2016 09:08:54 -0400 Date: Wed, 13 Apr 2016 15:08:46 +0200 From: Jan Kara To: Jens Axboe Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: [PATCH 4/9] writeback: track if we're sleeping on progress in balance_dirty_pages() Message-ID: <20160413130846.GA23550@quack2.suse.cz> References: <1459350477-16404-1-git-send-email-axboe@fb.com> <1459350477-16404-5-git-send-email-axboe@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1459350477-16404-5-git-send-email-axboe@fb.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 759 Lines: 25 On Wed 30-03-16 09:07:52, Jens Axboe wrote: > Note in the bdi_writeback structure if a task is currently being > limited in balance_dirty_pages(), waiting for writeback to > proceed. ... > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 11ff8f758631..15e696bc5d14 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -1746,7 +1746,9 @@ pause: > pause, > start_time); > __set_current_state(TASK_KILLABLE); > + wb->dirty_sleeping = 1; > io_schedule_timeout(pause); > + wb->dirty_sleeping = 0; Huh, but wb->dirty_sleeping is shared by all the processes in the system. So this is seriously racy, isn't it? You rather need a counter for this to work. Honza -- Jan Kara SUSE Labs, CR