From patchwork Wed Aug 29 13:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 145427 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp670042ljw; Wed, 29 Aug 2018 06:19:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbPetO12ML1wgXUeksBv/ZKUuO64MofAofkfemgiDZ7t4BTuxOX+XMLgNBLqId2lGOI2opR X-Received: by 2002:a62:20f:: with SMTP id 15-v6mr6060067pfc.100.1535548764792; Wed, 29 Aug 2018 06:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535548764; cv=none; d=google.com; s=arc-20160816; b=Q7zTmy+js/tq3VbqEoLWa1LSp7RkklpZiqMu8iMJOukD6g2KguPBLOc0RDCcjkO6lv 2mNeUea+ABl3VHlbI5w6SdcQ8sCVZRkNfl5bYTFBEairGhjyAqff8rTVd/rL5tpvnvbV aoiQ4hSGJ7cZFgfqVWfw2kfduDkzXzTtptjQTwtcKNEwFgk77pU4ieDSy3zMVlh3kDNY diqsd/9l9qa2loN4PD97yYPq5ggIddd0rBekMIKhiJcelcqBTouMiGn1AyjagqUrdcod 1b/6tfH8bnDXm3QXXbBhNgW+Zn0meIJHkZriTagP9UNQwtQnAUFqIyZOrGNrJESV7QG4 dNUw== 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:arc-authentication-results; bh=myZ+tXdnhZIQMc2mbqEZMm0G4kQH/y2eGsmXNy1+iJc=; b=tNCsT9wUL91/rmYil2KZy9kv+XIkuJ08SlzNpLhje506zPjnbTEcIyWKD9MAOZDeXe 3ODw4FVVBUM/TUsn3lZJdKh9sG0or0FPg6nRaV+pkAyRhRFXg+yywG/qTY3TcYHwFRWp htT9TX1kI4i7LcFLT16E1EzagB1ifyBBYB3WkJJZP7R/1fwhKtepIOc7sS05cR+NYsnb aPTD6ZTRblOXZ2fzL2nonY41zQEix4xY/LSZxcCekD4k+Rkt4ZtO3H7a3Xv+t0kebM9n D01Y6iDAKKA2pca7MhJTnTpfIKocUIw3EDmMJApo9bwVBM28jJ5qZoTsL6ZXwLGHNrYi ue/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQfcSDSJ; 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 d22-v6si4009560pgb.444.2018.08.29.06.19.24; Wed, 29 Aug 2018 06:19:24 -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=AQfcSDSJ; 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 S1728660AbeH2RQQ (ORCPT + 32 others); Wed, 29 Aug 2018 13:16:16 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44388 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727316AbeH2RQQ (ORCPT ); Wed, 29 Aug 2018 13:16:16 -0400 Received: by mail-wr1-f65.google.com with SMTP id v16-v6so4798434wro.11 for ; Wed, 29 Aug 2018 06:19:20 -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=myZ+tXdnhZIQMc2mbqEZMm0G4kQH/y2eGsmXNy1+iJc=; b=AQfcSDSJgJu23/p0HZUDntapwzg9r2cjzvtOHzV9SUYFJz85r6ErAThZjejGTCwKvI tKrBYEsqfXLmG5rf6xxf2r4dLEhYo2Fdot5Yh9j/DQP+vJZwCcbyy1OqUTDlggQmAb0h eb/pZaRpYAAu8BEUpw2tp53pqLs/c1tZP2cdM= 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=myZ+tXdnhZIQMc2mbqEZMm0G4kQH/y2eGsmXNy1+iJc=; b=naHZgRBWzZxpUHB0y+rqpJ9i3NdMccHF3NemXE93INcCCvuV+HPsScMCu1HhI932g8 lG6QrRznLwzmOqSHAiOL6f6BVlWECvbLSWnIkr3n9xYz6Kk8Ddy0hYc0tV2+uf08UHij 3tiEUz6IxEP/ocWCZ+5YoQvuTNSEvCz3x2s3KnGT8jGyWUn3ebXLPGCsMrd17GVt6lzl /GHLbpWsSpGWHexjO0RueQt9G3eO8fj/2XksVpj2IiqiZnJ+p3tmqhjOvHx1G2ltWUmZ bLPsVYGTLfD+we5aeTXhtJVqs7fZp3rCY/hKDupI0NJM7SiJqx210Q7uUwqWAnBQvRQF 7LHA== X-Gm-Message-State: APzg51ABPab4S6f/dPCxQYNMnvf2+++4ZZlQE5P/3s1kmyKb7OOdn9Sd 5qk+zfIZuffR5dy7aXq14Rj68g== X-Received: by 2002:adf:8385:: with SMTP id 5-v6mr4342512wre.13.1535548759793; Wed, 29 Aug 2018 06:19:19 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:4c23:4749:7ea6:c5af]) by smtp.gmail.com with ESMTPSA id a37-v6sm9532723wrc.21.2018.08.29.06.19.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 06:19:19 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: Vincent Guittot , Srikar Dronamraju , Rik van Riel Subject: [PATCH 1/4] sched/numa: remove unused code from update_numa_stats() Date: Wed, 29 Aug 2018 15:19:09 +0200 Message-Id: <1535548752-4434-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535548752-4434-1-git-send-email-vincent.guittot@linaro.org> References: <1535548752-4434-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 With : commit 2d4056fafa19 ("sched/numa: Remove numa_has_capacity()") the local variables smt, cpus and capacity and their results are not used anymore in numa_has_capacity() Remove this unused code Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Srikar Dronamraju Cc: Rik van Riel Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) -- 2.7.4 Reviewed-by: Srikar Dronamraju diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 309c93f..c2b8bf4 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1463,8 +1463,7 @@ struct numa_stats { */ static void update_numa_stats(struct numa_stats *ns, int nid) { - int smt, cpu, cpus = 0; - unsigned long capacity; + int cpu; memset(ns, 0, sizeof(*ns)); for_each_cpu(cpu, cpumask_of_node(nid)) { @@ -1473,26 +1472,8 @@ static void update_numa_stats(struct numa_stats *ns, int nid) ns->nr_running += rq->nr_running; ns->load += weighted_cpuload(rq); ns->compute_capacity += capacity_of(cpu); - - cpus++; } - /* - * If we raced with hotplug and there are no CPUs left in our mask - * the @ns structure is NULL'ed and task_numa_compare() will - * not find this node attractive. - * - * We'll detect a huge imbalance and bail there. - */ - if (!cpus) - return; - - /* smt := ceil(cpus / capacity), assumes: 1 < smt_power < 2 */ - smt = DIV_ROUND_UP(SCHED_CAPACITY_SCALE * cpus, ns->compute_capacity); - capacity = cpus / smt; /* cores */ - - capacity = min_t(unsigned, capacity, - DIV_ROUND_CLOSEST(ns->compute_capacity, SCHED_CAPACITY_SCALE)); } struct task_numa_env { From patchwork Wed Aug 29 13:19:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 145428 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp670068ljw; Wed, 29 Aug 2018 06:19:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZyvTTXiay15fQATCLQ+JBfWAN2juI9PtThnFy+DfRw88gaaTjJOBHSTGsFn6SnShppAfCw X-Received: by 2002:a17:902:744a:: with SMTP id e10-v6mr5979145plt.165.1535548766446; Wed, 29 Aug 2018 06:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535548766; cv=none; d=google.com; s=arc-20160816; b=qyuBHtU+JjC4ZADIR2rfCZe2ZRxgizUqWXSUEVquaPP6uff75WlRiqM6wdIUjnjqpF Z264SdtyICbqtK6lH+oAXsAEK2WPboEt+VIi3vuXuPVJCmjVafMpFa+P/U/8N2rw4Dlm 3S1BzOLhVf2nX4K77wCSPPh8xFbfH+G0Y5bBNPMUSkAPUJDe8YigMOON1KfGWcoyLFqK 2JdPfHK07p78qQ4gwvqutsSzFq0WUlq9JqUfRCAylSg0ovC6iwEyVl7+cs1gzuUpiyZL ullTdjJ0vHeyxqnbdwOT68oIAqhM5PfLbbdd5bBSVZgppndF2MkGOx0nCLYKYYpDby0c 6Wig== 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:arc-authentication-results; bh=RP6kCwNOibKOgIJWhXXcFj4YF7N90rBS1ViaOhyM7Zc=; b=y8/NENSL5gldy47q65XCwOI67zTF3Nz5KvOtZlXPiptT7faDnGyn5pgkY64GZgMGBm 3tM09RkVVL0wPVvxqIoqMdjMyIduG89dCw+sg02E5EHP+H5An4mcn4D5Irjoea3Z1Ppc BsShK0RV7pPfcXA5htIe0ykcQoity5YSCGdxqCz61gGuk/zewo8O3xcWqiewGZ5UhdXX 7zKDy+hI088eUfGGJU3vOajVLwpmX/VprbyWOCHy5gqq39FIrh901+9ltsPrGn+Y7gRU 7lzWdnDqIcSpN+2idBBy2Pjfqj/IyGv/H6LpVIwfZ44T5ixpoL2kbQd6A37bgieC3BXS CkBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h+wbfEvg; 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 y63-v6si3740311pgd.435.2018.08.29.06.19.26; Wed, 29 Aug 2018 06:19:26 -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=h+wbfEvg; 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 S1728694AbeH2RQS (ORCPT + 32 others); Wed, 29 Aug 2018 13:16:18 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32841 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727204AbeH2RQR (ORCPT ); Wed, 29 Aug 2018 13:16:17 -0400 Received: by mail-wm0-f68.google.com with SMTP id i134-v6so4496750wmf.0 for ; Wed, 29 Aug 2018 06:19:21 -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=RP6kCwNOibKOgIJWhXXcFj4YF7N90rBS1ViaOhyM7Zc=; b=h+wbfEvgSC+cDZM+1nbd8aw0c8mIYYeTysKD+8GGjLD2gzzkyY6TbfGpCTquRCCViC u0rLLyLhUksnOD3YEBDOORY6wa13HwPIua84iQ7ai0W/tXRWggFerBhk0HJmk1WDvebW vtib+KMqTL3+uvEGt8AeQ+I+SXV9DKTHbb91g= 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=RP6kCwNOibKOgIJWhXXcFj4YF7N90rBS1ViaOhyM7Zc=; b=MjW3Kl4unUAa9GRmSU1ai9KBipSB+rIwNeaYt21qLi6I7Uh8pmcowUFlOBB336s4Ya WGLMU0ZhpdmYfs8zVvGhI3A8GWVm11sDa1bdXHvYBidDFG3mA5/0MdnfCdm2rlnTQoqV bziMgDh17+618DBIwjzZQI9DwmL8WQ18nziDRQubRhbw/BRD67uLLgqIlIapaRv0gDPU UcK2MYrzuUb7fGmm4NzBpgvekHFDHddxgEQpcHzsyBGp6CATYleVh2ASf86aU4WczXbf WKWBJvLlPLvAO672sVxfsFUljhvOgSXg8dS4Lrm3ei/hlFmjrYqu8oITZmfet+IbL0WY 6BfQ== X-Gm-Message-State: APzg51ACrzVxfWmlgxq+uB/QBS7NFsoaHFwH2wJj5yuNdTrTCyGF++/2 aspq0isnV/+ga53gr/auFip/Qw== X-Received: by 2002:a1c:c501:: with SMTP id v1-v6mr4119018wmf.115.1535548761059; Wed, 29 Aug 2018 06:19:21 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:4c23:4749:7ea6:c5af]) by smtp.gmail.com with ESMTPSA id a37-v6sm9532723wrc.21.2018.08.29.06.19.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 06:19:20 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: Vincent Guittot , Srikar Dronamraju , Rik van Riel Subject: [PATCH 2/4] sched/numa: remove unused nr_running field Date: Wed, 29 Aug 2018 15:19:10 +0200 Message-Id: <1535548752-4434-3-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535548752-4434-1-git-send-email-vincent.guittot@linaro.org> References: <1535548752-4434-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 nr_running in struct numa_stats is not used anywhere in the code. Remove it. Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Srikar Dronamraju Cc: Rik van Riel Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 3 --- 1 file changed, 3 deletions(-) -- 2.7.4 Reviewed-by: Srikar Dronamraju diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c2b8bf4..cff1682 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1454,8 +1454,6 @@ struct numa_stats { /* Total compute capacity of CPUs on a node */ unsigned long compute_capacity; - - unsigned int nr_running; }; /* @@ -1469,7 +1467,6 @@ static void update_numa_stats(struct numa_stats *ns, int nid) for_each_cpu(cpu, cpumask_of_node(nid)) { struct rq *rq = cpu_rq(cpu); - ns->nr_running += rq->nr_running; ns->load += weighted_cpuload(rq); ns->compute_capacity += capacity_of(cpu); } From patchwork Wed Aug 29 13:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 145429 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp670096ljw; Wed, 29 Aug 2018 06:19:28 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbk3Pn2ACdm+A6Ra7kdzSKZdTSgBPXfEYWII0q1TFuZrAvrzSpYM47G9eOOoSr8HPctGfup X-Received: by 2002:a63:de4c:: with SMTP id y12-v6mr5699061pgi.435.1535548767877; Wed, 29 Aug 2018 06:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535548767; cv=none; d=google.com; s=arc-20160816; b=GrMOMyWS26ddl600ux+4BbYc0lerwyfaU2LEov1BYkc7EUVCUWoDY0Awd/3BieXocd v4fe5pDD/hfeF8p3zo2yuwcHeyTuKYMUNAJqoDknn6E9b0fnrSzWo//a1B1FuCPHiJN6 bCa49NT/h8UYm3voIxbX/Kwi9dYEti/fvhL+Yc4PwEoIWgCh7sFjRBtYYl4ghVjWAEUt fKVfUSefoolS685fIC1WeAc64Y0MblQ0vYtW6JcbHPcoR82CtOdK1UOXrKuo6W7RB/h6 CvfBOd/EzHFEu/ePdiJmBs8uOy3f8qsr9sUbvL4ZQsed/6I8noPVrva1PksjF5GMxHoP Gm6A== 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:arc-authentication-results; bh=TO1pU8JCMBu+caKwSvxQuWK2iY1ODZK5b9aWTRPwaCg=; b=nlzvomj/PDiGkj2biMmk5NV7s8VDg+/WuUWSNIgeuhtE9AJKeW1V/k2BIFKUWfScE0 ui9NDufZUm10tJdTgZGk1opTd0azyaplKKd+7BSRYDV0VxR4T3HseBPxHGejjBpiEb// l24ApsoK8UsG143jzSiDJvTCLN+Nflz8Z05YA8jUzHR5M8md5O25llwHXLRplCzafL8K k4AeL9kEqpG5JKtBZ3lhrR4hYs30W4ppmqI91z/vFeuLwiEt/Bb2ozqnWIh5gLSOlDRx bM80DsfSH8uDVplevAss8vF5kYL988VapWs7QtAeFXD/5Cy27/hBguMR9CVF+tCqyiSJ 6Fgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="P/Ql1Ewq"; 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 t16-v6si3603858pgj.234.2018.08.29.06.19.27; Wed, 29 Aug 2018 06:19:27 -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="P/Ql1Ewq"; 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 S1728725AbeH2RQU (ORCPT + 32 others); Wed, 29 Aug 2018 13:16:20 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41237 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727316AbeH2RQT (ORCPT ); Wed, 29 Aug 2018 13:16:19 -0400 Received: by mail-wr1-f65.google.com with SMTP id z96-v6so4808310wrb.8 for ; Wed, 29 Aug 2018 06:19:22 -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=TO1pU8JCMBu+caKwSvxQuWK2iY1ODZK5b9aWTRPwaCg=; b=P/Ql1EwqHhseHyku5t1Dgwfe7jPgYorqfQ5b7LVFE80A3XWZ5nDQe3LcScSJlUTD2S MjAif9mZViQo/CgmYFM5L1wP6iLV3+Oj0Edzti4ex/T5ZDopjukqWI1LDAI+NkzZsdd0 RB1Udj2qHfXbBa4mqCzypTMVxdhKed7YlMP/I= 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=TO1pU8JCMBu+caKwSvxQuWK2iY1ODZK5b9aWTRPwaCg=; b=RmlnU5zv6sxJ0JjqSDjqlyGPHqfK1SdriOx39QduGrTgRsTP7mGoCO5mXQ9yQ6g8xB xUoc71mo2tnUirun4iRlODTUmi20H58aNtyZ/yDP9GU6829i2aEqxnaja5CArgL8moZH sWOOB4vkSoE/BdbfpzAaPaHWoqJ42jEwedpSiB3pdDslZR3q7pTgAPpBktE25Cp8iIUW 4qGlEX70bFVYSSkH2WKrKN096ugtoWZna4zO6SBSeFd3qE54VN8rYSyZLAH2NoFN+VSe DY7LugOetBxlUMCT20YFdEGJI8X6j1/bPoCdwz6pzwiJLHHqvcltlge0Ss89fWVt44go b/Ig== X-Gm-Message-State: APzg51ANKuSsb49e1iNBrnNq9BF28MzroDH0Kt3Dem5fjFwRK6+18Nkr pIiDdbv0tRuzY1lT1mki6BAMFA== X-Received: by 2002:a5d:6984:: with SMTP id g4-v6mr4191595wru.232.1535548762085; Wed, 29 Aug 2018 06:19:22 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:4c23:4749:7ea6:c5af]) by smtp.gmail.com with ESMTPSA id a37-v6sm9532723wrc.21.2018.08.29.06.19.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 06:19:21 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: Vincent Guittot Subject: [RFC PATCH 3/4] sched/topology: remove smt_gain Date: Wed, 29 Aug 2018 15:19:11 +0200 Message-Id: <1535548752-4434-4-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535548752-4434-1-git-send-email-vincent.guittot@linaro.org> References: <1535548752-4434-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 smt_gain is used to compute the capacity of CPUs of a SMT core with the constraint 1 < smt_gain < 2 in order to be able to compute number of CPUs per core. The field has_free_capacity of struct numa_stat, which was the last user of this computation of number of CPUs per core, has been removed by : commit 2d4056fafa19 ("sched/numa: Remove numa_has_capacity()") We can now remove this constraint on core capacity and use the defautl value SCHED_CAPACITY_SCALE for SMT CPUs. With this remove, SCHED_CAPACITY_SCALE becomes the maximum compute capacity of CPUs on every systems. This should help to simplify some code and remove fields like rd->max_cpu_capacity Furthermore, arch_scale_cpu_capacity() is used with a NULL sd in several other places in the code when it wants the capacity of a CPUs to scale some metrics like in pelt, deadline or schedutil. In case on SMT, the value returned is not the capacity of SMT CPUs but default SCHED_CAPACITY_SCALE. Remove the smt_gain field from sched_domain struct Cc: Peter Zijlstra Cc: Ingo Molnar Cc: linux-kernel@vger.kernel.org (open list) Signed-off-by: Vincent Guittot --- include/linux/sched/topology.h | 1 - kernel/sched/sched.h | 3 --- kernel/sched/topology.c | 2 -- 3 files changed, 6 deletions(-) -- 2.7.4 Reported-by: Srikar Dronamraju Signed-off-by: Vincent Guittot Reviewed-by: Srikar Dronamraju diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 2634774..212792b 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -89,7 +89,6 @@ struct sched_domain { unsigned int newidle_idx; unsigned int wake_idx; unsigned int forkexec_idx; - unsigned int smt_gain; int nohz_idle; /* NOHZ IDLE status */ int flags; /* See SD_* */ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4a2e8ca..b1715b8 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1758,9 +1758,6 @@ unsigned long arch_scale_freq_capacity(int cpu) static __always_inline unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) { - if (sd && (sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1)) - return sd->smt_gain / sd->span_weight; - return SCHED_CAPACITY_SCALE; } #endif diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 56a0fed..069c924 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1129,7 +1129,6 @@ sd_init(struct sched_domain_topology_level *tl, .last_balance = jiffies, .balance_interval = sd_weight, - .smt_gain = 0, .max_newidle_lb_cost = 0, .next_decay_max_lb_cost = jiffies, .child = child, @@ -1155,7 +1154,6 @@ sd_init(struct sched_domain_topology_level *tl, if (sd->flags & SD_SHARE_CPUCAPACITY) { sd->flags |= SD_PREFER_SIBLING; sd->imbalance_pct = 110; - sd->smt_gain = 1178; /* ~15% */ } else if (sd->flags & SD_SHARE_PKG_RESOURCES) { sd->flags |= SD_PREFER_SIBLING; From patchwork Wed Aug 29 13:19:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 145430 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp670105ljw; Wed, 29 Aug 2018 06:19:28 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaoxbwFn34SfEmjOJhYIp6e5dDjlMLg1ugmbzJaZ6yiimbVmubspfOOs++gBm2rRLG68GU5 X-Received: by 2002:a63:549:: with SMTP id 70-v6mr5835223pgf.385.1535548768272; Wed, 29 Aug 2018 06:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535548768; cv=none; d=google.com; s=arc-20160816; b=OIYoSIP+iN3hrkMfeWVrtE0ClFvJDJV+oh1WF7krV9iQ/JQnbBuhljcgUVuooXqFi5 u/6pe6kV+jWSt2nOOM7yiOs6iHVSehdbC98GkR/3nwKCmXGEcMixhjMmm9lyPMHtdTd3 vyeZR0ptMpVxBGnMFIbtYaIGNLp+MvvuteiiJi8DzcQDsr3ik6Xte5KUzm+ihFhdiaao 8fzU5Iy5aAT5CMI9ln10WXpgMkTZSxgV8pq/dG94dEMES5qlRlDYdNMCQDr4MJwVqf1G 5lqEq+2y3OjXVet+Hx3Mua5E4Buxz0RBpSlikE+6mCg9vT05Qd9x2nPLtrKJa3ozxrcJ 4Q2w== 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:arc-authentication-results; bh=9N1/i8eovTJISBwV2wd17v34QcoNXObPuHXlaPcTSyg=; b=QUM/BmLqdfPGSGrhDOECAOy0UjCeSyMF7MEaD5MgB1FTrfqmZKOHqA9rH1sh9crbUA 0rzM/GOR5F0s0iH5NJnC62rDpggP5Qng5qOo4+2zM8bNaYKHs/i8vZeW7hd87mWKWljj JUqQGz+/Bnto7tAAe55PbaNqb9eQuGWUPqUkH9JpxmH3+dNYS1FHVmBWpiIhBp12WaJg RPPVgmImjLLIAX+RyX6HOQPcgbZzM5eezLSNW+ArfCMp89wf4pBEq6+nOYfPRQ6vR5vU hkrvmkS1uC0mFhZiJBlEB8WcjiR0do9gOybE5TPzNrGu5wugo6ssVH2eVIhk+HimmBZb /RFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NC0AP8En; 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 t16-v6si3603858pgj.234.2018.08.29.06.19.28; Wed, 29 Aug 2018 06:19:28 -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=NC0AP8En; 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 S1728758AbeH2RQV (ORCPT + 32 others); Wed, 29 Aug 2018 13:16:21 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46069 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727204AbeH2RQU (ORCPT ); Wed, 29 Aug 2018 13:16:20 -0400 Received: by mail-wr1-f66.google.com with SMTP id 20-v6so4789138wrb.12 for ; Wed, 29 Aug 2018 06:19:24 -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=9N1/i8eovTJISBwV2wd17v34QcoNXObPuHXlaPcTSyg=; b=NC0AP8EnJ6ul6iBXPE55fPtpxUCiptEqrpYGXRoBJYjP9vYV5VmPiTwrbd+2XgIPsF eXdbAGH7zMdyZf/95idDMZKkggfcmjilAuoNeZhZACjWR2gkz4KKhfh1ycvNXe99oY0O XvN2IYRgC8e8D9c4wFOp9BRv6JRf4Pu7bcl7k= 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=9N1/i8eovTJISBwV2wd17v34QcoNXObPuHXlaPcTSyg=; b=pxVe/bPTaXV1dFLjr1MECDRTUhs6hf0gvi59KIxfBGXflna0ybgLPLXlx2VR5eqL0w B4VJ38xrq1UP26/JzY95nwE7sK4GOquWy+FJ76Ks+vnnxielnK55/1fUgdGnf7nVkULv it/Tu9OWWVHBxbPYOPO8IiJdEEyNguD0FCecbmjcb6ecEF8OA+AUPeJHvH9D8LH4zF+M ViWv1TW7jVOdmaQZEAn0BJp6BAMk6AwgKA+2hgEH1HZethpZG4hapyMmLP8CLQCNNZQU 3Q7L+gNBCF7l/TZwXAkOAb4/X+0u7wip6X4+R6AFe3X44FMju1BbvLM2WB/ilaFFQeug m+1Q== X-Gm-Message-State: APzg51BXJxzXbKnX+GKXChk5jr5JyDIT3XDggAd/AUwIBYZ5KK4aUBnP Y7NYkgz11ku8yyT9W3/Z5QbBlQ== X-Received: by 2002:adf:d84a:: with SMTP id k10-v6mr4095439wrl.26.1535548763558; Wed, 29 Aug 2018 06:19:23 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:4c23:4749:7ea6:c5af]) by smtp.gmail.com with ESMTPSA id a37-v6sm9532723wrc.21.2018.08.29.06.19.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Aug 2018 06:19:22 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: Vincent Guittot , Russell King , Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 4/4] sched/topology: remove unused sd param from arch_scale_cpu_capacity() Date: Wed, 29 Aug 2018 15:19:12 +0200 Message-Id: <1535548752-4434-5-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535548752-4434-1-git-send-email-vincent.guittot@linaro.org> References: <1535548752-4434-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 struct sched_domain *sd parameter is no more used in arch_scale_cpu_capacity() so we can remote it. Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Russell King Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Vincent Guittot --- arch/arm/kernel/topology.c | 2 +- drivers/base/arch_topology.c | 6 +++--- include/linux/arch_topology.h | 2 +- kernel/sched/cpufreq_schedutil.c | 2 +- kernel/sched/deadline.c | 2 +- kernel/sched/fair.c | 8 ++++---- kernel/sched/pelt.c | 2 +- kernel/sched/sched.h | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 24ac3ca..d3d75c5 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -175,7 +175,7 @@ static void update_cpu_capacity(unsigned int cpu) topology_set_cpu_scale(cpu, cpu_capacity(cpu) / middle_capacity); pr_info("CPU%u: update cpu_capacity %lu\n", - cpu, topology_get_cpu_scale(NULL, cpu)); + cpu, topology_get_cpu_scale(cpu)); } #else diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index e7cb0c6..6dc9339 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -44,7 +44,7 @@ static ssize_t cpu_capacity_show(struct device *dev, { struct cpu *cpu = container_of(dev, struct cpu, dev); - return sprintf(buf, "%lu\n", topology_get_cpu_scale(NULL, cpu->dev.id)); + return sprintf(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id)); } static ssize_t cpu_capacity_store(struct device *dev, @@ -124,7 +124,7 @@ void topology_normalize_cpu_scale(void) / capacity_scale; topology_set_cpu_scale(cpu, capacity); pr_debug("cpu_capacity: CPU%d cpu_capacity=%lu\n", - cpu, topology_get_cpu_scale(NULL, cpu)); + cpu, topology_get_cpu_scale(cpu)); } mutex_unlock(&cpu_scale_mutex); } @@ -194,7 +194,7 @@ init_cpu_capacity_callback(struct notifier_block *nb, cpumask_andnot(cpus_to_visit, cpus_to_visit, policy->related_cpus); for_each_cpu(cpu, policy->related_cpus) { - raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * + raw_capacity[cpu] = topology_get_cpu_scale(cpu) * policy->cpuinfo.max_freq / 1000UL; capacity_scale = max(raw_capacity[cpu], capacity_scale); } diff --git a/include/linux/arch_topology.h b/include/linux/arch_topology.h index 2b70941..5df6773 100644 --- a/include/linux/arch_topology.h +++ b/include/linux/arch_topology.h @@ -17,7 +17,7 @@ DECLARE_PER_CPU(unsigned long, cpu_scale); struct sched_domain; static inline -unsigned long topology_get_cpu_scale(struct sched_domain *sd, int cpu) +unsigned long topology_get_cpu_scale(int cpu) { return per_cpu(cpu_scale, cpu); } diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 3fffad3..01b95057 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -202,7 +202,7 @@ static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu) struct rq *rq = cpu_rq(sg_cpu->cpu); unsigned long util, irq, max; - sg_cpu->max = max = arch_scale_cpu_capacity(NULL, sg_cpu->cpu); + sg_cpu->max = max = arch_scale_cpu_capacity(sg_cpu->cpu); sg_cpu->bw_dl = cpu_bw_dl(rq); if (rt_rq_is_runnable(&rq->rt)) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 997ea7b..5f763b1 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1196,7 +1196,7 @@ static void update_curr_dl(struct rq *rq) &curr->dl); } else { unsigned long scale_freq = arch_scale_freq_capacity(cpu); - unsigned long scale_cpu = arch_scale_cpu_capacity(NULL, cpu); + unsigned long scale_cpu = arch_scale_cpu_capacity(cpu); scaled_delta_exec = cap_scale(delta_exec, scale_freq); scaled_delta_exec = cap_scale(scaled_delta_exec, scale_cpu); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index cff1682..2eeac7c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -748,7 +748,7 @@ void post_init_entity_util_avg(struct sched_entity *se) { struct cfs_rq *cfs_rq = cfs_rq_of(se); struct sched_avg *sa = &se->avg; - long cpu_scale = arch_scale_cpu_capacity(NULL, cpu_of(rq_of(cfs_rq))); + long cpu_scale = arch_scale_cpu_capacity(cpu_of(rq_of(cfs_rq))); long cap = (long)(cpu_scale - cfs_rq->avg.util_avg) / 2; if (cap > 0) { @@ -3175,7 +3175,7 @@ update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cf * is not we rescale running_sum 1st */ running_sum = se->avg.util_sum / - arch_scale_cpu_capacity(NULL, cpu_of(rq_of(cfs_rq))); + arch_scale_cpu_capacity(cpu_of(rq_of(cfs_rq))); runnable_sum = max(runnable_sum, running_sum); load_sum = (s64)se_weight(se) * runnable_sum; @@ -7462,7 +7462,7 @@ static inline int get_sd_load_idx(struct sched_domain *sd, static unsigned long scale_rt_capacity(int cpu) { struct rq *rq = cpu_rq(cpu); - unsigned long max = arch_scale_cpu_capacity(NULL, cpu); + unsigned long max = arch_scale_cpu_capacity(cpu); unsigned long used, free; unsigned long irq; @@ -7487,7 +7487,7 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu) unsigned long capacity = scale_rt_capacity(cpu); struct sched_group *sdg = sd->groups; - cpu_rq(cpu)->cpu_capacity_orig = arch_scale_cpu_capacity(sd, cpu); + cpu_rq(cpu)->cpu_capacity_orig = arch_scale_cpu_capacity(cpu); if (!capacity) capacity = 1; diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c index 35475c0..5efa152 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -114,7 +114,7 @@ accumulate_sum(u64 delta, int cpu, struct sched_avg *sa, u64 periods; scale_freq = arch_scale_freq_capacity(cpu); - scale_cpu = arch_scale_cpu_capacity(NULL, cpu); + scale_cpu = arch_scale_cpu_capacity(cpu); delta += sa->period_contrib; periods = delta / 1024; /* A period is 1024us (~1ms) */ diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index b1715b8..8b306ce 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1756,7 +1756,7 @@ unsigned long arch_scale_freq_capacity(int cpu) #ifdef CONFIG_SMP #ifndef arch_scale_cpu_capacity static __always_inline -unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) +unsigned long arch_scale_cpu_capacity(int cpu) { return SCHED_CAPACITY_SCALE; } @@ -1764,7 +1764,7 @@ unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) #else #ifndef arch_scale_cpu_capacity static __always_inline -unsigned long arch_scale_cpu_capacity(void __always_unused *sd, int cpu) +unsigned long arch_scale_cpu_capacity(int cpu) { return SCHED_CAPACITY_SCALE; }