From patchwork Thu Apr 25 17:23:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 2489101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id A13FFDF5B1 for ; Thu, 25 Apr 2013 17:28:21 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVPwW-0001Td-Ut; Thu, 25 Apr 2013 17:26:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVPvw-0006sY-ME; Thu, 25 Apr 2013 17:26:12 +0000 Received: from mail-wg0-x235.google.com ([2a00:1450:400c:c00::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVPuo-0006hK-No for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2013 17:25:16 +0000 Received: by mail-wg0-f53.google.com with SMTP id z11so1661786wgg.32 for ; Thu, 25 Apr 2013 10:25:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=qQ53/e/Bo+GJbnEbjIlirMmtSiq4UYxlvzpL8GDMAlU=; b=p3nIOhC39nHAoxWt7e1xapdEK+qPaVsCDul3yNGYeT6uBL4XK/slovB0MKWFTTrVb/ fpItm1D/6ASUJOX/ytGcneMU8r9pK7YYzczQ/SkVsgJVv7jF1oyQUIQdX0PNtH7Rkp1m GVy3eoJPBM6CrDce4DdAhF4fQpvxqM5Ze2GIm98+4J9M24llGv6wqW1VrGQYyLDls8sF o+a8Dhc1g+mQknXhbmYwELy/Q+qDOkeNmqWHLPHlPkcidwdDokewmDTgCxOSKUODHq5I 33JHiCMWEr2Qfe7fM0efXZw6fYdwY+m1FP5FVXLY3kEzPlxR+4ah6385qX6ywdXd8871 DcSw== X-Received: by 10.180.20.37 with SMTP id k5mr37380826wie.27.1366910700468; Thu, 25 Apr 2013 10:25:00 -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 q13sm12311485wie.8.2013.04.25.10.24.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:00 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, peterz@infradead.org, mingo@kernel.org, linux@arm.linux.org.uk, pjt@google.com, santosh.shilimkar@ti.com, Morten.Rasmussen@arm.com, chander.kashyap@linaro.org, cmetcalf@tilera.com, tony.luck@intel.com, alex.shi@intel.com, preeti@linux.vnet.ibm.com Subject: [PATCH 06/14] sched: add a knob to choose the packing level Date: Thu, 25 Apr 2013 19:23:22 +0200 Message-Id: <1366910611-20048-7-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366910611-20048-1-git-send-email-vincent.guittot@linaro.org> References: <1366910611-20048-1-git-send-email-vincent.guittot@linaro.org> X-Gm-Message-State: ALoCoQnmaFkEvBoBocqTbkzyF1hOZZNkECr0w+nf4yxXmG/04azq1nwtt8ya8b68SEyUYH0SBdv3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130425_132503_091141_C7D19E1C X-CRM114-Status: GOOD ( 13.63 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: len.brown@intel.com, l.majewski@samsung.com, Vincent Guittot , corbet@lwn.net, amit.kucheria@linaro.org, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, arjan@linux.intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There are 3 packing levels: - the default one only packs the small tasks when the system is not busy - the none level doesn't pack anything - the full level uses as few as possible number of CPUs based on the current activity of the system Signed-off-by: Vincent Guittot --- include/linux/sched/sysctl.h | 8 ++++++++ kernel/sched/fair.c | 12 ++++++++++++ kernel/sysctl.c | 13 +++++++++++++ 3 files changed, 33 insertions(+) diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index bf8086b..b72a8b8 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; +enum sched_tunable_packing { + SCHED_PACKING_NONE, + SCHED_PACKING_DEFAULT, + SCHED_PACKING_FULL, +}; + +extern enum sched_tunable_packing __read_mostly sysctl_sched_packing_mode; + 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; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a985c98..98166aa 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -113,6 +113,18 @@ unsigned int __read_mostly sysctl_sched_shares_window = 10000000UL; unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; #endif +#ifdef CONFIG_SMP +/* + * The packing policy of the scheduler + * + * Options are: + * SCHED_PACKING_NONE - No buddy is used for packing some tasks + * SCHED_PACKING_DEFAULT - The small tasks are packed on a not busy CPUs + * SCHED_PACKING_FULL - All Tasks are packed in a minimum number of CPUs + */ +enum sched_tunable_packing sysctl_sched_packing_mode = SCHED_PACKING_DEFAULT; + +#endif /* * Increase the granularity value when there are more CPUs, * because with more CPUs the 'effective latency' as visible diff --git a/kernel/sysctl.c b/kernel/sysctl.c index afc1dc6..ca22f59 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -265,6 +265,8 @@ 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; +static int min_sched_packing_mode = SCHED_PACKING_NONE; +static int max_sched_packing_mode = SCHED_PACKING_FULL-1; #endif /* CONFIG_SMP */ #endif /* CONFIG_SCHED_DEBUG */ @@ -281,6 +283,17 @@ static struct ctl_table kern_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, +#ifdef CONFIG_SMP + { + .procname = "sched_packing_mode", + .data = &sysctl_sched_packing_mode, + .maxlen = sizeof(enum sched_tunable_packing), + .mode = 0644, + .proc_handler = proc_dointvec, + .extra1 = &min_sched_packing_mode, + .extra2 = &max_sched_packing_mode, + }, +#endif #ifdef CONFIG_SCHED_DEBUG { .procname = "sched_min_granularity_ns",