From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932601Ab3AYS21 (ORCPT ); Fri, 25 Jan 2013 13:28:27 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:35453 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932532Ab3AYS2X (ORCPT ); Fri, 25 Jan 2013 13:28:23 -0500 Subject: [PATCH 14/14] mm: Account for WRITEBACK_TEMP in balance_dirty_pages To: miklos@szeredi.hu From: "Maxim V. Patlasov" Cc: dev@parallels.com, xemul@parallels.com, fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, jbottomley@parallels.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, devel@openvz.org Date: Fri, 25 Jan 2013 22:28:03 +0400 Message-ID: <20130125182752.10037.46454.stgit@maximpc.sw.ru> In-Reply-To: <20130125181700.10037.29163.stgit@maximpc.sw.ru> References: <20130125181700.10037.29163.stgit@maximpc.sw.ru> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make balance_dirty_pages start the throttling when the WRITEBACK_TEMP counter is high enough. This prevents us from having too many dirty pages on fuse, thus giving the userspace part of it a chance to write stuff properly. Note, that the existing balance logic is per-bdi, i.e. if the fuse user task gets stuck in the function this means, that it either writes to the mountpoint it serves (but it can deadlock even without the writeback) or it is writing to some _other_ dirty bdi and in the latter case someone else will free the memory for it. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- mm/page-writeback.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0713bfb..c47bcd4 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1235,7 +1235,8 @@ static void balance_dirty_pages(struct address_space *mapping, */ nr_reclaimable = global_page_state(NR_FILE_DIRTY) + global_page_state(NR_UNSTABLE_NFS); - nr_dirty = nr_reclaimable + global_page_state(NR_WRITEBACK); + nr_dirty = nr_reclaimable + global_page_state(NR_WRITEBACK) + + global_page_state(NR_WRITEBACK_TEMP); global_dirty_limits(&background_thresh, &dirty_thresh); From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Maxim V. Patlasov" Subject: [PATCH 14/14] mm: Account for WRITEBACK_TEMP in balance_dirty_pages Date: Fri, 25 Jan 2013 22:28:03 +0400 Message-ID: <20130125182752.10037.46454.stgit@maximpc.sw.ru> References: <20130125181700.10037.29163.stgit@maximpc.sw.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: dev-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org, xemul-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org, fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, jbottomley-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org, viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org To: miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org Return-path: In-Reply-To: <20130125181700.10037.29163.stgit-vWG5eQQidJHciZdyczg/7Q@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fuse-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org Make balance_dirty_pages start the throttling when the WRITEBACK_TEMP counter is high enough. This prevents us from having too many dirty pages on fuse, thus giving the userspace part of it a chance to write stuff properly. Note, that the existing balance logic is per-bdi, i.e. if the fuse user task gets stuck in the function this means, that it either writes to the mountpoint it serves (but it can deadlock even without the writeback) or it is writing to some _other_ dirty bdi and in the latter case someone else will free the memory for it. Signed-off-by: Maxim Patlasov Signed-off-by: Pavel Emelyanov --- mm/page-writeback.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0713bfb..c47bcd4 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -1235,7 +1235,8 @@ static void balance_dirty_pages(struct address_space *mapping, */ nr_reclaimable = global_page_state(NR_FILE_DIRTY) + global_page_state(NR_UNSTABLE_NFS); - nr_dirty = nr_reclaimable + global_page_state(NR_WRITEBACK); + nr_dirty = nr_reclaimable + global_page_state(NR_WRITEBACK) + + global_page_state(NR_WRITEBACK_TEMP); global_dirty_limits(&background_thresh, &dirty_thresh); ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d