Received: by 10.192.165.148 with SMTP id m20csp272835imm; Tue, 24 Apr 2018 22:17:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx48BPi3WmLJcnPk5mBJp/8xDXZ0N3hwgHCBIi0X93M6F9Owo811ci1caD4VXOo99trRaq9QG X-Received: by 10.98.236.24 with SMTP id k24mr22317952pfh.204.1524633448563; Tue, 24 Apr 2018 22:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524633448; cv=none; d=google.com; s=arc-20160816; b=xfxyHzJQdDIdlMaObgMk3iuU2G3YzIOBwoFLEpmD6wMAUJ5o2qYdCuAMgeMshe2eCE hdELRSn1ys45TAqDmcZVpjxIYCJJFcKpbLo+EKFEZfpw021Kc1xs9QmHDrOwdzJyYgBa 5pWa4mOKBVskvzKFnY8VOF7yBCAnXEsek3DkO/GOVF0Iq2TxNDa+awcjLesVN6v/VnzC L6+zmdku7e/VhpCco58DxeL6GkLn4VcJyFvtdNXAb0T/UD8zenb76zzIYE0qlfbtZWlt NV9CT1bK4VU0xEh6zOE/DKCFKEvYW0odX41FCdIbtu/L4ExDk5wDwd3uGacQcElLBXyo q/Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=pDrtm87UxdAfRe9udP4dmQIEiiV1H182GU5AsdeFtUw=; b=HQ6T6rHMG/zW9jLcrGD63Vd/L8Wkio7MCotUDOEBJKZsP1hW18tiSjNwexryoBh0/S 0vGKt1YFF3eJHEiyUEm6B1+fLOU/c5GOaORqS2JaIIH/Zj1DyAOM0+T8vu7hrbQrum7d 5QXXMkQYrtBoBe8rskNEJksdskfISRgdVD1rsvFwqN548x/K64zhp8MX3+kJqYbiVXVV Ef8rGy30aEbUdKOaL8o3u4F4KyqfdSZnox0UFllHGXCHxjxbLmDeeXNYtawl30m2ZsOC uTMEIMtc8+ftlrq4IcLjrqtv8a485XsubTFQS3927kd0gAZeAN/YfbyC4eX4SrS53h1F F+MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W9DL8+Ph; 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 l6si13128331pgs.531.2018.04.24.22.16.59; Tue, 24 Apr 2018 22:17: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=W9DL8+Ph; 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 S1751079AbeDYFPP (ORCPT + 99 others); Wed, 25 Apr 2018 01:15:15 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:39222 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbeDYFPN (ORCPT ); Wed, 25 Apr 2018 01:15:13 -0400 Received: by mail-pg0-f68.google.com with SMTP id b9so12492347pgf.6 for ; Tue, 24 Apr 2018 22:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pDrtm87UxdAfRe9udP4dmQIEiiV1H182GU5AsdeFtUw=; b=W9DL8+Phhvz1SG6fVFQHttfA5I9wfibN5TclV1N9WMAZzorfDis9n24H6hlYS7UrOm 37JG+MlV+UyOYN5C0XKwRZgqEqxPQWsq9faZ+7pOBHXr80mIUF9S0TJA/GVry9JhxfAt RxyXKCtbfrJS6bjyh/rXWw/cJ56EvaPTLC+kU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pDrtm87UxdAfRe9udP4dmQIEiiV1H182GU5AsdeFtUw=; b=CjscuIasPIq1TiaQDn8//sYcNpNn9dq6LXa/8u82wIm6XbFDiDjH3L/bnODMdahEdh DQQjF/TCGZuQzTqDbOcq1PeOzS04fpk026SKCM7ftBgZdaO6/rR/BRdvPKBU2pH306vS ee7Pq3J3zxj939CieUJXZ8qH1JfuySs3V5W109i3k39e9yWmulUsJaW9eTw/qb6yg2YF gT/OcHx3fu5JpQrmBXBgzqA0qHAbdqhYlcKkjBiibfK3fP8ESUusDhwAc5MNznxpjlGU ctDuC3FCl8co620WZkljWopPf23ntPSLbo7K7ZNIde9I4El37zn9vRx0ny9ZJpxatomg V4nQ== X-Gm-Message-State: ALQs6tBSrQz165JvT3Cc1qdmp16acFRyqq84MT+VxitqgYmAM/LrCU7S PBD8IvTbKNN/dZkCX8u/GxVKTA== X-Received: by 2002:a17:902:a5:: with SMTP id a34-v6mr24566423pla.58.1524633313360; Tue, 24 Apr 2018 22:15:13 -0700 (PDT) Received: from localhost ([122.172.61.40]) by smtp.gmail.com with ESMTPSA id u7sm33383534pfa.96.2018.04.24.22.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 22:15:11 -0700 (PDT) Date: Wed, 25 Apr 2018 10:45:09 +0530 From: Viresh Kumar To: Peter Zijlstra Cc: Valentin Schneider , Ingo Molnar , Vincent Guittot , Daniel Lezcano , linux-kernel@vger.kernel.org, Quentin Perret , c@hirez.programming.kicks-ass.net Subject: Re: [PATCH] sched/fair: Rearrange select_task_rq_fair() to optimize it Message-ID: <20180425051509.aohopadqw7q5urbd@vireshk-i7> References: <8a34a16da90b9f83ffe60316a074a5e4d05b59b0.1524479666.git.viresh.kumar@linaro.org> <434fa179-7c8f-8a01-a07a-4527521a04c7@arm.com> <20180424104304.GE4064@hirez.programming.kicks-ass.net> <0985e709-0d71-2c08-20a9-7bfb618fb5f2@arm.com> <20180424123523.GF4064@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180424123523.GF4064@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24-04-18, 14:35, Peter Zijlstra wrote: > In any case, if there not going to be conflicts here, this all looks > good. Thanks Peter. I also had another patch and wasn't sure if that would be the right thing to do. The main purpose of this is to avoid calling sync_entity_load_avg() unnecessarily. +++ b/kernel/sched/fair.c @@ -6196,9 +6196,6 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p { int new_cpu = cpu; - if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed)) - return prev_cpu; - while (sd) { struct sched_group *group; struct sched_domain *tmp; @@ -6652,15 +6649,19 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f if (unlikely(sd)) { /* Slow path */ - /* - * We're going to need the task's util for capacity_spare_wake - * in find_idlest_group. Sync it up to prev_cpu's - * last_update_time. - */ - if (!(sd_flag & SD_BALANCE_FORK)) - sync_entity_load_avg(&p->se); + if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed)) { + new_cpu = prev_cpu; + } else { + /* + * We're going to need the task's util for + * capacity_spare_wake in find_idlest_group. Sync it up + * to prev_cpu's last_update_time. + */ + if (!(sd_flag & SD_BALANCE_FORK)) + sync_entity_load_avg(&p->se); - new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag); + new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag); + } } else if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */ /* Fast path */ -- viresh