Received: by 10.223.164.202 with SMTP id h10csp1837403wrb; Fri, 24 Nov 2017 02:08:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMawu6HAt/8VnzEgmxaIYKjm6Q629mSMhweep75Tr8rBtvHJWOTVLfs96JD8uZggAGr70ryo X-Received: by 10.101.82.1 with SMTP id o1mr26817867pgp.261.1511518095552; Fri, 24 Nov 2017 02:08:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511518095; cv=none; d=google.com; s=arc-20160816; b=QfR71+XvHhjhckKCK+ThJ5er3Eqe7YYPAgZDQ1kCQHu8m4UtzI/nhf0pEzbHGvbaIA XLCHtu7slM81wF+190A7rVNnTQuW2zh63FJioEycDBIKSzWpI3k+6r9lbpRHnopC5Cd0 vRuDlAdhMLcf1ezwvNQirF5N2GHcHNYHQy4t1zgnTFzrDmddtg7xB04Qg9r5fYf+uW0P yotc2u99TeqzFtFeFvwFmTC8/PRpQgOGIGq20aVAS6PZIGOFY18b92XPISP/y61Q54UM xNsEIyBcMkNWnPiUWhEkzvF5ofee+ppqtkg5bZms7gkXT2EaXoYyrWUz4iK/DzCSGoHV /a0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=gA4SItKr3rDvs4rOCt0Sf1zeIq2GOtXHt1cSx7y+eTI=; b=vwFSTMgSfpMiOswpVaCxrJvLv0dP7oakspRECWKy1GnXM44FyIpQH+bpmTwycLYUvg YPI5GAN8dQDlo3fodMf6ZrBX28agqNSx8z8KyxYpsF4x8Bv0fjRF3ByWs2rNjLnWr4M9 lhxXoM5R6bFPZulIargnRQ0CUB6eiSJ+4sKSmr9PP2OhWaP/U9cGfVb2be0g+E1WVvbu YsoV0FjJ2AjZqsIJL68X0EYaVhG6jZhsMWLRIw6dXEmDo/iK6mQjHOi9PkVUPziObU1t 3EmvlWL27gGntggr4s+rwUQob+3WGucgYZAslcwcwRhc6vLTkOrGR4T7niUHluVahHao 129g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si10698648pgp.365.2017.11.24.02.08.02; Fri, 24 Nov 2017 02:08:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753086AbdKXKHZ (ORCPT + 76 others); Fri, 24 Nov 2017 05:07:25 -0500 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:14986 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752387AbdKXKHX (ORCPT ); Fri, 24 Nov 2017 05:07:23 -0500 From: Peter Enderborg To: Michal Hocko , , , , CC: Jonathan Corbet , "Luis R . Rodriguez" , Kees Cook , Alex Deucher , "David S . Miller" , Harry Wentland , Greg Kroah-Hartman , Tony Cheng , David Rientjes , Peter Enderborg , Andrew Morton , Jan Kara , "Kirill A . Shutemov" , Dave Jiang , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Ross Zwisler , Matthew Wilcox , Hugh Dickins , Johannes Weiner , Kemi Wang , Vlastimil Babka , YASUAKI ISHIMATSU , Nikolay Borisov , Mel Gorman , Pavel Tatashin Subject: [PATCH] mm:Add watermark slope for high mark Date: Fri, 24 Nov 2017 11:07:07 +0100 Message-ID: <20171124100707.24190-1-peter.enderborg@sony.com> X-Mailer: git-send-email 2.11.1 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When tuning the watermark_scale_factor to reduce stalls and compactions the high mark is also changed, it changed a bit too much. So this patch introduces a slope that can reduce this overhead a bit, or increase it if needed. Signed-off-by: Peter Enderborg --- Documentation/sysctl/vm.txt | 15 +++++++++++++++ include/linux/mm.h | 1 + include/linux/mmzone.h | 2 ++ kernel/sysctl.c | 9 +++++++++ mm/page_alloc.c | 6 +++++- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index eda628c..aecff6c 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt @@ -62,6 +62,7 @@ Currently, these files are in /proc/sys/vm: - user_reserve_kbytes - vfs_cache_pressure - watermark_scale_factor +- watermark_high_factor_slope - zone_reclaim_mode ============================================================== @@ -857,6 +858,20 @@ that the number of free pages kswapd maintains for latency reasons is too small for the allocation bursts occurring in the system. This knob can then be used to tune kswapd aggressiveness accordingly. +============================================================= + +watermark_high_factor_slope: + +This factor is high mark for watermark_scale_factor. +The unit is in percent. +Max value is 1000 and min value is 100. (High watermark is the same as +low water mark) Low watermark is min_wmark_pages + watermark_scale_factor. +and high watermark is +min_wmark_pages+(watermark_scale_factor * watermark_high_factor_slope). + +The default value is 200. + + ============================================================== zone_reclaim_mode: diff --git a/include/linux/mm.h b/include/linux/mm.h index 7661156..c89536b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2094,6 +2094,7 @@ extern void zone_pcp_reset(struct zone *zone); /* page_alloc.c */ extern int min_free_kbytes; extern int watermark_scale_factor; +extern int watermark_high_factor_slope; /* nommu.c */ extern atomic_long_t mmap_pages_allocated; diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 67f2e3c..91bf842 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -886,6 +886,8 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); int watermark_scale_factor_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); +//int watermark_high_factor_tilt_sysctl_handler(struct ctl_table *, int, +// void __user *, size_t *, loff_t *); extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1]; int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 2fb4e27..83c48c9 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1444,6 +1444,15 @@ static struct ctl_table vm_table[] = { .extra2 = &one_thousand, }, { + .procname = "watermark_high_factor_slope", + .data = &watermark_high_factor_slope, + .maxlen = sizeof(watermark_high_factor_slope), + .mode = 0644, + .proc_handler = watermark_scale_factor_sysctl_handler, + .extra1 = &one_hundred, + .extra2 = &one_thousand, + }, + { .procname = "percpu_pagelist_fraction", .data = &percpu_pagelist_fraction, .maxlen = sizeof(percpu_pagelist_fraction), diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 48b5b01..3dc50ff 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -263,6 +263,7 @@ compound_page_dtor * const compound_page_dtors[] = { int min_free_kbytes = 1024; int user_min_free_kbytes = -1; int watermark_scale_factor = 10; +int watermark_high_factor_slope = 200; static unsigned long __meminitdata nr_kernel_pages; static unsigned long __meminitdata nr_all_pages; @@ -6989,6 +6990,7 @@ static void __setup_per_zone_wmarks(void) for_each_zone(zone) { u64 tmp; + u64 tmp_high; spin_lock_irqsave(&zone->lock, flags); tmp = (u64)pages_min * zone->managed_pages; @@ -7026,7 +7028,9 @@ static void __setup_per_zone_wmarks(void) watermark_scale_factor, 10000)); zone->watermark[WMARK_LOW] = min_wmark_pages(zone) + tmp; - zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + tmp * 2; + tmp_high = mult_frac(tmp, watermark_high_factor_slope, 100); + zone->watermark[WMARK_HIGH] = min_wmark_pages(zone) + tmp_high; + spin_unlock_irqrestore(&zone->lock, flags); } -- 2.7.4 From 1585150833904506395@xxx Sun Nov 26 17:33:57 +0000 2017 X-GM-THRID: 1584969664238197018 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread