From patchwork Fri Oct 18 11:52:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 21118 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52937246F1 for ; Fri, 18 Oct 2013 11:53:51 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 6sf4440469qeb.4 for ; Fri, 18 Oct 2013 04:53:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=IbOvqSyZWr8Q2TEVAHPwMx4PSVueEubZwCtJmq/ZnlM=; b=PXnOHN+pnmIgxmfSqudaNDD5ZKDnMrsd+7klaLYMUvJbxI1O9bv6/Mfr3YTa9kNeKf DRJG7OKBFeUydtsAzhXCYGVzGKQxCa52GW2u+5zKVe7TlCAP8n0tNfKwg4C4CWzLHxRr Tf6m3AeZeYG3RtoZOVOCnD+ZNcbSHEbEkcP03Qd54pfUQUtWi/Y/3VgsdGRY9hLVwtHN Ze2D+sQsVQV0qv9ZQ0j3gQfwEoReZcrd8AnNUdTDpCfeSEc7A5k/YjhDlTitsx5uRvKG rpRXqBcKxN3AFa5/TBrErLtNIn0NrsqoI5l8nwG6HEJbIjMNSb1ep/d9J1FTcpCoNQf9 5uJw== X-Received: by 10.58.88.2 with SMTP id bc2mr851349veb.37.1382097230822; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.133.201 with SMTP id pe9ls1202850qeb.23.gmail; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) X-Received: by 10.58.107.204 with SMTP id he12mr13914veb.26.1382097230669; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by mx.google.com with ESMTPS id hc10si236130vdb.28.2013.10.18.04.53.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:53:50 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.52; Received: by mail-vb0-f52.google.com with SMTP id f12so1841315vbg.11 for ; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) X-Gm-Message-State: ALoCoQmEVHPlLjWSzfsvQ+doS67InpIfqKEpMFQiK9qtvLTWDJdr4cM2NujbqAdjnB4zKgvN9RGY X-Received: by 10.58.146.71 with SMTP id ta7mr66949veb.23.1382097230567; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp29482vcz; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) X-Received: by 10.180.208.2 with SMTP id ma2mr2109763wic.52.1382097229669; Fri, 18 Oct 2013 04:53:49 -0700 (PDT) Received: from mail-wg0-f46.google.com (mail-wg0-f46.google.com [74.125.82.46]) by mx.google.com with ESMTPS id s20si415435wib.51.2013.10.18.04.53.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:53:49 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.46 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.46; Received: by mail-wg0-f46.google.com with SMTP id m15so3590463wgh.25 for ; Fri, 18 Oct 2013 04:53:49 -0700 (PDT) X-Received: by 10.194.134.97 with SMTP id pj1mr1327172wjb.58.1382097229250; Fri, 18 Oct 2013 04:53:49 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id lr3sm25000673wic.5.2013.10.18.04.53.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:53:48 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, pjt@google.com, Morten.Rasmussen@arm.com, cmetcalf@tilera.com, tony.luck@intel.com, alex.shi@intel.com, preeti@linux.vnet.ibm.com, linaro-kernel@lists.linaro.org Cc: rjw@sisk.pl, paulmck@linux.vnet.ibm.com, corbet@lwn.net, tglx@linutronix.de, len.brown@intel.com, arjan@linux.intel.com, amit.kucheria@linaro.org, l.majewski@samsung.com, Vincent Guittot Subject: [RFC][PATCH v5 05/14] sched: add a packing level knob Date: Fri, 18 Oct 2013 13:52:18 +0200 Message-Id: <1382097147-30088-5-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382097147-30088-1-git-send-email-vincent.guittot@linaro.org> References: <1382097147-30088-1-git-send-email-vincent.guittot@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.52 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The knob is used to set an average load threshold that will be used to trig the inclusion/removal of CPUs in the packing effort list. Signed-off-by: Vincent Guittot --- include/linux/sched/sysctl.h | 9 +++++++++ kernel/sched/fair.c | 26 ++++++++++++++++++++++++++ kernel/sysctl.c | 17 +++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index bf8086b..f41afa5 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -44,6 +44,14 @@ enum sched_tunable_scaling { }; extern enum sched_tunable_scaling sysctl_sched_tunable_scaling; +#ifdef CONFIG_SCHED_PACKING_TASKS +extern int __read_mostly sysctl_sched_packing_level; + +int sched_proc_update_packing(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos); +#endif + extern unsigned int sysctl_numa_balancing_scan_delay; extern unsigned int sysctl_numa_balancing_scan_period_min; extern unsigned int sysctl_numa_balancing_scan_period_max; @@ -61,6 +69,7 @@ extern unsigned int sysctl_sched_shares_window; int sched_proc_update_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos); + #endif #ifdef CONFIG_SCHED_DEBUG static inline unsigned int get_sysctl_timer_migration(void) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7149f38..5568980 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -186,6 +186,32 @@ void sched_init_granularity(void) */ DEFINE_PER_CPU(int, sd_pack_buddy); +/* + * The packing level of the scheduler + * + * This level define the activity % above which we should add another CPU to + * participate to the packing effort of the tasks + */ +#define DEFAULT_PACKING_LEVEL 80 +int __read_mostly sysctl_sched_packing_level = DEFAULT_PACKING_LEVEL; + +unsigned int sd_pack_threshold = (100 * 1024) / DEFAULT_PACKING_LEVEL; + + +int sched_proc_update_packing(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, + loff_t *ppos) +{ + int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); + if (ret || !write) + return ret; + + if (sysctl_sched_packing_level) + sd_pack_threshold = (100 * 1024) / sysctl_sched_packing_level; + + return 0; +} + static inline bool is_packing_cpu(int cpu) { int my_buddy = per_cpu(sd_pack_buddy, cpu); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index b2f06f3..77383fc 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -255,11 +255,17 @@ static struct ctl_table sysctl_base_table[] = { { } }; +#ifdef CONFIG_SCHED_PACKING_TASKS +static int min_sched_packing_level; +static int max_sched_packing_level = 100; +#endif /* CONFIG_SMP */ + #ifdef CONFIG_SCHED_DEBUG static int min_sched_granularity_ns = 100000; /* 100 usecs */ static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ static int min_wakeup_granularity_ns; /* 0 usecs */ static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ + #ifdef CONFIG_SMP static int min_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; static int max_sched_tunable_scaling = SCHED_TUNABLESCALING_END-1; @@ -279,6 +285,17 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, +#ifdef CONFIG_SCHED_PACKING_TASKS + { + .procname = "sched_packing_level", + .data = &sysctl_sched_packing_level, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = sched_proc_update_packing, + .extra1 = &min_sched_packing_level, + .extra2 = &max_sched_packing_level, + }, +#endif #ifdef CONFIG_SCHED_DEBUG { .procname = "sched_min_granularity_ns",