From patchwork Tue Oct 2 07:26:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 147956 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4826916lji; Tue, 2 Oct 2018 00:27:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YV8d7/2SEFfYzTrOXbILCaFB9jSRrcC+4vH3Vr6le8OwAeyuFtmnfbB20UGK4QD/+dYKD X-Received: by 2002:a17:902:28a8:: with SMTP id f37-v6mr15374517plb.264.1538465222177; Tue, 02 Oct 2018 00:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538465222; cv=none; d=google.com; s=arc-20160816; b=hsuhqJLTvRANmILofqbfm2SANcTtN80hZwqZ9Ypjms++Q6mZd4pi7as8CsJ+AIvnVi pWYlzUrd+Hnjehge12fdYQVDdAleR7fSkuttDYE/QnjnPaS+TkxYL/Y3r4kera82NRfd T/Z4o8gJBV4UF4KSSFeywzNddNeKSKnLmiHtNRhQ5w1nzdwo5vUZWj+JfC0WjcltESam Ju3996cHxclQdMo66U6jr4MEATEgnJ9Ujs+daTvhQdYQZjIiFe9mmIzobulUIeIga5n4 U4qvmtkxTCK1ungXCgEtoHshiMgMe5VldlR6x7FVPqKzPYU8COh9ZTQ6Mx/iNQAKdsLl URKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=8+letnrUftggUuNnWV9VjgurJvKNvmDW3KXCaTcLkec=; b=zSrLLEfN+6wE5CM+qLUiXb5EkGf7cLvrwuAK7M6ZIKLhMtGpRAIAE6rpiNVuT9cVhR BhnlITq8QnImmP4EALW13hrP/vNUr0XwuL+Z3Hs0Ot/j85GN4RhtTAC2EI388IPDzUbD bMgDnZ1+VKgsiEpW+TKzke2VZggkA6G/tFPGfyMCvDxM0iF6Yg0cZOomwsGNklErNatc Ied9DVuZOW4xub0DinnyzWxCffz94Yao5hjSSpABF0uwA/yPoYBwYBXzgIy4vDbYIIjx KJNiJ2ibgbED6M4OU95ivIe/0Eka+5yupTuncAnusDU0QRJ0iF6ukYiEqDaOPUtbSy0e 0Ozg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LIqySdi/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5-v6si15253345pla.439.2018.10.02.00.27.01; Tue, 02 Oct 2018 00:27:02 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b="LIqySdi/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbeJBOIt (ORCPT + 32 others); Tue, 2 Oct 2018 10:08:49 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43319 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbeJBOIr (ORCPT ); Tue, 2 Oct 2018 10:08:47 -0400 Received: by mail-wr1-f67.google.com with SMTP id n1-v6so904564wrt.10 for ; Tue, 02 Oct 2018 00:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8+letnrUftggUuNnWV9VjgurJvKNvmDW3KXCaTcLkec=; b=LIqySdi/hQNddNF7iZF72vB/x/20T8hK6twDHDrumNqp/ltArrhJ3cQcFcC8yw7KWS rif+//CB/1/GhzGpa3ROaKUYK9G9DqcZdk9y2oTaFhX1t4Iemf4scpLwntPc58mXV4Ss mHQYIJbfMOU2FDfA/IutuJuoogKaVBzftKakQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8+letnrUftggUuNnWV9VjgurJvKNvmDW3KXCaTcLkec=; b=suk7hiG4hBaPBMnREVncOm2pd8JX2fN4csiLCzS2fQ7u29Bxq0BuIdvIO+DM7SZ4xu vh71jWEgALvtaWsNjvjsc72S5p7ZcbES+SRhbonda1xCRaBlSFU7gX1srjRZB8460v7Y Dl6mVkhIzyDaueWbQeAByaRluheXXZwkE35B54B2d1k+ilfwHlGJg/CgXwbRW+kgR9Q7 g2ZLPkt1QzgQWUu9YJhn/XSaShbz52kMRuPrLqztENvRRDtYOiCvl2sVeYuuAxcLyS0p TxYoUFft+bZCOEABlLagKeuPEj6XUtSPYGHep5tqeXS72EsgQuHUOXMOotykzX3EIk3j Qd0A== X-Gm-Message-State: ABuFfoiBLDqXASC8ByC0hz9+6oXOKTcpH1FOW8XxLGB13o74kBc5313B Dl1y3qYa5hj6oVsP+mfqpxcQK7atNF4= X-Received: by 2002:a5d:5002:: with SMTP id e2-v6mr9954337wrt.210.1538465216390; Tue, 02 Oct 2018 00:26:56 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:99b3:4272:8254:6430]) by smtp.gmail.com with ESMTPSA id t24-v6sm3550552wra.5.2018.10.02.00.26.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Oct 2018 00:26:55 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Morten.Rasmussen@arm.com, Vincent Guittot Subject: [RESEND PATCH 1/3] sched/fair: fix rounding issue for asym packing Date: Tue, 2 Oct 2018 09:26:37 +0200 Message-Id: <1538465199-20176-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> References: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When check_asym_packing() is triggered, the imbalance is set to : busiest_stat.avg_load * busiest_stat.group_capacity / SCHED_CAPACITY_SCALE busiest_stat.avg_load also comes from a division and the final rounding can make imbalance slightly lower than the weighted load of the cfs_rq. But this is enough to skip the rq in find_busiest_queue and prevents asym migration to happen. Add 1 to the avg_load to make sure that the targeted cpu will not be skipped unexpectidly. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6bd142d..0ed99ad2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7824,6 +7824,12 @@ static inline void update_sg_lb_stats(struct lb_env *env, /* Adjust by relative CPU capacity of the group */ sgs->group_capacity = group->sgc->capacity; sgs->avg_load = (sgs->group_load*SCHED_CAPACITY_SCALE) / sgs->group_capacity; + /* + * Prevent division rounding to make the computation of imbalance + * slightly less than original value and to prevent the rq to be then + * selected as busiest queue + */ + sgs->avg_load += 1; if (sgs->sum_nr_running) sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; From patchwork Tue Oct 2 07:26:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 147958 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4827052lji; Tue, 2 Oct 2018 00:27:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV61W5CKdLSIM0ItsI2tdPWiCgVjU5AqCg/8TuZA94I+R0MRA6pNeix2Bap9ObuI0HfyyLXEE X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr15256415plg.43.1538465232087; Tue, 02 Oct 2018 00:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538465232; cv=none; d=google.com; s=arc-20160816; b=va43PedMUl5thnlb1XbC/tUcUyBJdKyTTruLQl9AQPzbBNgCuPORVeaHvmnJEKk320 vqf6ig3y5vYWFNyEF72K2DRvOPaM9QLeNqY2B0E2mcdww+YFgyzWQwsnxE/ePwgQSMYh sLmfxbw9pMAwMjSbLzH+ITc25FwIfRLm/++8ax8b45olwNPVTNWbotfGgqvkzFSel/+U 5ZacVeKw9TPH+k2CtfwNEk/sdM4Dt5tqSFDDgkY5aSv1xjFglSdlt1FVuQtx1jHRm57e z2aGCeFOdwPGdXsuSJKDGrZidwZQ7dZBrMdlrXocw29So6JyMJPOHYXyF+kmE9bNscgX CtpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ZAZV7TSRGTTOn8i3VUsUuDTLiKlP22KY3CKFP4aWfqM=; b=uJGNOUr7GA2aLx5D4Vj2bC0afG+pKuuABhOIXrMhRL2WyMHJ3SLC4dlypc5bIwU3OX 404Lnsto+Xs0wsbRsMzIa9dllFSdw+hX3d5JJt+KQUwDruzI1Zjc9Yce1p9O/ezSqzkd upNKnBUPIFgNVw+885Lskkekuj1XfxzP3N3KCiUoPilH7tipUZyG9S50XHzBC1aAYd7P 3b7lvnJxlFyY4AGxwpuBcLhP0ilzzMO7WD0u+Q8l/0nruVwtu1t37t+Y/bWWGqsguh2H L2zgs2e5ugQoEAOkBd8ssC9dRNP9JU4WqenxPrjxa2T1s9wT/z5L4v78qZb9GpxOEgp8 b+ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NyVks4hp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y34-v6si2896489pgk.479.2018.10.02.00.27.11; Tue, 02 Oct 2018 00:27:12 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=NyVks4hp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727254AbeJBOJA (ORCPT + 32 others); Tue, 2 Oct 2018 10:09:00 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38501 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbeJBOIs (ORCPT ); Tue, 2 Oct 2018 10:08:48 -0400 Received: by mail-wm1-f67.google.com with SMTP id 193-v6so1082673wme.3 for ; Tue, 02 Oct 2018 00:26:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZAZV7TSRGTTOn8i3VUsUuDTLiKlP22KY3CKFP4aWfqM=; b=NyVks4hpZvec6NdAmePSWZoJpMdhY7iogqMQDB5GbmG0mCsW8lfAOI0te8QVi3w2kH 37bXm5D0BCQSh2s+RwnHte5n5eVfqwzLHi/klgLCNKneLuFDOlVGHbwvNy1sGT+pXiJW EXMpqhwT4A9g4F97ZO1hIFrrO3WzI07DCandc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZAZV7TSRGTTOn8i3VUsUuDTLiKlP22KY3CKFP4aWfqM=; b=uUTZNZrpO2Kavn/eaVSCxbOnnBcBahojdKrgy3iw2stTeel7f2YmP28pifYkWDrQLy MbWvRVU7tXpgF2s+jIiYStpYcUKOwyKs/0oCy4XX8SelcORVMycaLOoUy/J2iSoZZSNB HuE+9swwdCK3R2Az1R1EIorrgbD9MY15Iwg16h97F+gxf2BtmXbgspC8kcEJJhSauI7W DCYI9Un+XalEXRYM6Pfy3sAOWURVlyhC7/51XxFCSR2jDoehYzU8ap/t2spdThd0bw2u xJjxA+XFu5nEgdBe+nhb+nlcbsXFYzohij0IZMxo9Mvd4fW77QY3bbIZseLRwWAyetZV +sdA== X-Gm-Message-State: ABuFfogEkqCBT1SerpJxyocDrwl2v5KLlJ03QF0fF/FEJ5PznfiWi1wY lRcwsiYydrLaN3HXFb7BNyDoOA== X-Received: by 2002:a1c:c708:: with SMTP id x8-v6mr918489wmf.116.1538465217554; Tue, 02 Oct 2018 00:26:57 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:99b3:4272:8254:6430]) by smtp.gmail.com with ESMTPSA id t24-v6sm3550552wra.5.2018.10.02.00.26.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Oct 2018 00:26:56 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Morten.Rasmussen@arm.com, Vincent Guittot Subject: [RESEND PATCH 2/3] sched/fair: trigger asym_packing during idle load balance Date: Tue, 2 Oct 2018 09:26:38 +0200 Message-Id: <1538465199-20176-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> References: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org newly idle load balance is not always triggered when a cpu becomes idle. This prevent the scheduler to get a chance to migrate task for asym packing. Enable active migration because of asym packing during idle load balance too. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0ed99ad2..00f2171 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8460,7 +8460,7 @@ static int need_active_balance(struct lb_env *env) { struct sched_domain *sd = env->sd; - if (env->idle == CPU_NEWLY_IDLE) { + if (env->idle != CPU_NOT_IDLE) { /* * ASYM_PACKING needs to force migrate tasks from busy but From patchwork Tue Oct 2 07:26:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 147957 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4826967lji; Tue, 2 Oct 2018 00:27:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV63SwGo1x6lWYjatz7Vju8i7JfWYOvPFnJNMoFufrwjPkYGr07+GmI5/b7iG+DAmBD03nnUh X-Received: by 2002:a65:53c9:: with SMTP id z9-v6mr13180500pgr.203.1538465224718; Tue, 02 Oct 2018 00:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538465224; cv=none; d=google.com; s=arc-20160816; b=bQ5Ly5DsbPziUDjHNndTryvI2veDBEU7T9x7LFiXqRoac8dHcI60fH4lPT+ZAN2f2t M4Y1I/cz4r9ZRmPQ11bDg9GujXR7K5XPrP+anxTlZZLDwTV9zGpN4FcLDYeGqtG35dpG jzFtqDhosCLSya6AejhNsmmnqaRY7FAHAhJiv205lHfWM0EGOYdsKJobMAynxaUfBMTW qmmzqGFGplpneeyUtXpTzoudnCUfJDln5sq8CqxAUoum0ifxjDwUiBBKCJlmZzQbp98e OcJxnuBM1BfeapbyBg2PKSpYUnBik93Mo1fIVST2EAxunEnxxSwtw/IFC/DbgJeHrSvu 95iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Wf4RyXux5B5jeDxtYeqhctDhaaK9OERZSccFy0gfof0=; b=LUEoOJLYGp+mOug9L6pv/vttk3ANTDzKe0Bp9/3Cc8ASw+WPG57llUMXnHT2oYGKr3 6PKRq43hxGpbPu8o8tGNSMtV0CaI4rftY8Mm9n8Sw2n8IVUr8kanwVUie1HxHway4Q3W HGMs7m1R9BMWSSntlZOb8hagRVu9WdSz/RV45i3iTwymGX/Wc8NAPbUMX9DdtLEsVKlc LWOhLjLwRUk292aW59zqi0V3PEdXoFq0hKsMxVoGW4KNA6/21nSvHxRcs7AorGDNYDYV R4B+Y1RBBV0pGN8X0kaXpBZik61Ef07VyKq/KcVqeyk9h7gefoDR3q5VGDKaXojk6m0n ypaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xjbel8BM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y34-v6si2896489pgk.479.2018.10.02.00.27.04; Tue, 02 Oct 2018 00:27:04 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=Xjbel8BM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727195AbeJBOIw (ORCPT + 32 others); Tue, 2 Oct 2018 10:08:52 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36981 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbeJBOIu (ORCPT ); Tue, 2 Oct 2018 10:08:50 -0400 Received: by mail-wr1-f68.google.com with SMTP id u12-v6so926864wrr.4 for ; Tue, 02 Oct 2018 00:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wf4RyXux5B5jeDxtYeqhctDhaaK9OERZSccFy0gfof0=; b=Xjbel8BM8yKMlqC/42AYs0S3sd5yMDO5sSmyMzEeONlYHqTDQtk/jkEn89AcXcRI3O 4X6rkLSaW2AYio6FEnDeFqNLmywzNadVBP59R+drzsmv5opi9Qmkn3BE/ycXoQAfVre3 9Zhr+Im2eyVM4gkDbxxrudxmtLmocIDPygpq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Wf4RyXux5B5jeDxtYeqhctDhaaK9OERZSccFy0gfof0=; b=BQ6Z/cM7U20Tdst00HIuVXaH6baK2g9Plg5biDYhu1Vgqtb/wlR0XZy+9aLVCMXRvy jjYvDf49wcUQbZNCWck0IFk/4tPKCOveTcmGH+CgIynHQUI10KHSOLTxZmCoFVew07c+ NHljZCfO/BUpuBRHdAdEeg/OlL3SPZUnNLERCy6T5FoeWu4/B1++KK+8F/u44QOD1X5Y 61xFQi2HKaiD8OCBlJa6jLo7/PmfgO2ct4d54iOvKNxcT7fTlndgeDmeXXFvAquEBOcR fegLBHxbWKVNMwT/IWpxc78HD+nc25Jgyofsra76nACZOjdykyuqlejcTvwl5M2QSIqU nqWQ== X-Gm-Message-State: ABuFfohhl0Kd6ug14gp7NsRbT8s6zFH2q43byp0z+rnUWC/QhILLZevz h2R1Kz7YNI6HjQYStaA4VvTJqA== X-Received: by 2002:adf:9244:: with SMTP id 62-v6mr9302961wrj.130.1538465218673; Tue, 02 Oct 2018 00:26:58 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:99b3:4272:8254:6430]) by smtp.gmail.com with ESMTPSA id t24-v6sm3550552wra.5.2018.10.02.00.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Oct 2018 00:26:57 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: valentin.schneider@arm.com, Morten.Rasmussen@arm.com, Vincent Guittot Subject: [RESEND PATCH 3/3] sched/fair: fix unnecessary increase of balance interval Date: Tue, 2 Oct 2018 09:26:39 +0200 Message-Id: <1538465199-20176-4-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> References: <1538465199-20176-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of active balance, we increase the balance interval to cover pinned tasks cases not covered by all_pinned logic. Neverthless, the active migration triggered by asym packing should be treated as the normal unbalanced case and reset the interval to default value otherwise active migration for asym_packing can be easily delayed for hundreds of ms because of this all_pinned detection mecanism. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 00f2171..4b6a226 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8456,22 +8456,32 @@ static struct rq *find_busiest_queue(struct lb_env *env, */ #define MAX_PINNED_INTERVAL 512 -static int need_active_balance(struct lb_env *env) +static inline bool +asym_active_balance(enum cpu_idle_type idle, unsigned int flags, int dst, int src) { - struct sched_domain *sd = env->sd; - - if (env->idle != CPU_NOT_IDLE) { + if (idle != CPU_NOT_IDLE) { /* * ASYM_PACKING needs to force migrate tasks from busy but * lower priority CPUs in order to pack all tasks in the * highest priority CPUs. */ - if ((sd->flags & SD_ASYM_PACKING) && - sched_asym_prefer(env->dst_cpu, env->src_cpu)) - return 1; + if ((flags & SD_ASYM_PACKING) && + sched_asym_prefer(dst, src)) + return true; } + return false; +} + +static int need_active_balance(struct lb_env *env) +{ + struct sched_domain *sd = env->sd; + + + if (asym_active_balance(env->idle, sd->flags, env->dst_cpu, env->src_cpu)) + return 1; + /* * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task. * It's worth migrating the task if the src_cpu's capacity is reduced @@ -8749,7 +8759,8 @@ static int load_balance(int this_cpu, struct rq *this_rq, } else sd->nr_balance_failed = 0; - if (likely(!active_balance)) { + if (likely(!active_balance) || + asym_active_balance(env.idle, sd->flags, env.dst_cpu, env.src_cpu)) { /* We were unbalanced, so reset the balancing interval */ sd->balance_interval = sd->min_interval; } else {