Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4044376ybg; Fri, 25 Oct 2019 12:31:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIplkB0jXFJAe2+GwXdi41BF4sKec35jtELUcYEX1qne1g1c75p46Dd81mayE/fWRtoQot X-Received: by 2002:a17:906:13c6:: with SMTP id g6mr4509495ejc.2.1572031865897; Fri, 25 Oct 2019 12:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031865; cv=none; d=google.com; s=arc-20160816; b=nXJZVq2wlaoz5QRFiLXIK0oG23dZmCS51mXd12TctGuH/uwPjORG3ZnnOkHBlyNEnV Uz0h6HHk074VUMfTSNm6HxqrS3lUsgUnOHbzkGrJHwWANyDDUNvoHHyvly4om74UfKEj dT0QNG34MK/+AAmrXdBh4XF7naN9WkbeuHlw7CtUIB6TlxRYTT0ZtgnGoXVNBAQ0HhaN 686VDO1vSIhWZsCbRes6t9y6eF7TZTTDGsuQfnoJUzsz0eNPbpSjMwsDhg+r35+QvPEr M8ZlPn52IVcclIT9/r3L232irwdBnBabpGhncYc1eX/QxIGc4ck/tyi308ZcslLHR/d4 6OOw== 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; bh=MvC1xa/Yv2E+4rHJhqnHKwrOhUrxM0nH05PTERSBhFE=; b=CCoc2S1X+sVnuK7G4DIW+hcZnWzk9pbEZaAccvJWKK8AKcUy/bdyLBius59adCdMzX cHkh553k5bMzKuVg5JKViFuheVt2+UsylfdbPMUVV8PoqvjlD5NNPys7W3/fREAZhg46 JJ+kH8wq08SuL8YaOQayQ2+T/cwUzawc0fVOL0QonC7/QYa9c+O388L8vCR+BLYvfndI xERkgU0qEDsfajBhNTF8iDPE3V8aLkyBOI43D1yCAl+ThD5Gvz4WvoFBeQ4WPb9YtmyT vRePfR+mo68s49HgFJrYNkK5URnIR3TjEQlbrUIWRx+tuB1J3bwt3YBpAXv9rvBG2mrQ CjpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dXuRuvvK; 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 m9si200090ejo.46.2019.10.25.12.30.42; Fri, 25 Oct 2019 12:31:05 -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=dXuRuvvK; 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 S2437867AbfJYILO (ORCPT + 99 others); Fri, 25 Oct 2019 04:11:14 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46027 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437822AbfJYILN (ORCPT ); Fri, 25 Oct 2019 04:11:13 -0400 Received: by mail-pg1-f196.google.com with SMTP id r1so1015554pgj.12 for ; Fri, 25 Oct 2019 01:11: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=MvC1xa/Yv2E+4rHJhqnHKwrOhUrxM0nH05PTERSBhFE=; b=dXuRuvvKfs4ccP/XEcohv6Of8V/+kMjvnucXJZpVOSjyHYKF5oMlvOKWUw+8MN+d3D bZqgOp4WN+aR0zPuV4cKr/oPywRltjzEzOrMR9Lhq0TjxbRsqgYp2ZEgO1MiCiH0+JO7 C1MLs96IFAevoXXT/ypKlC/Ydq9YELaRfq+qWlQ5JQ8ugPLa3smzDm0Gm2x6x9masAVC VqzGLKYJfdn6QIWUcMjO9ZNvIEU5utMRlOpGUk+q0+ySbs03YOsmaN4/reDnkshoEgyR X4jFBlH58xAx+2ry3+aiL9rX+tyC17TSqSqFhdTVtkFx7at4WVkA4AJwx7MxifdXxdNa fDNQ== 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=MvC1xa/Yv2E+4rHJhqnHKwrOhUrxM0nH05PTERSBhFE=; b=QeWb8mv1+3WrgR1X5GhxURACg2CVSxWc8ViHCh004QbRKE/mTFsWzvRCjjUQD58faj 4yQBxSH+j58DGAlNRK8HNnHAaVrWkDFQFnRb05cqYfzB57SNvJ6dMxEDnjhWP0thR27p BeIIyvza4x2l3YNls/0JG/05th7P6/apO2eGBKqYdPTwH0Y08rle72pn5YEb7jF15ijS 8DTsd3O0uwdXpFgdQOOZPPI19VBzqht2bmlOwFtKwVFAHJpM8uOzejyWA0KEEw4e7bvN rod79fYerWvtqBOHYzzAeScbMP0wnsD8UyMfN2a6Yj007/8IV9FpmVYU4gUFwaBqP/Vd 64tA== X-Gm-Message-State: APjAAAVSzknWEfH5/1leAiIxqRArar6+DrYQnnAT5clv1X7zxAKKYSk8 1CerVnjdhL6m0/EZm/4rS1YrTw== X-Received: by 2002:aa7:9aa2:: with SMTP id x2mr2711820pfi.103.1571991072328; Fri, 25 Oct 2019 01:11:12 -0700 (PDT) Received: from localhost ([122.172.151.112]) by smtp.gmail.com with ESMTPSA id l93sm1438985pjb.6.2019.10.25.01.11.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Oct 2019 01:11:11 -0700 (PDT) Date: Fri, 25 Oct 2019 13:41:08 +0530 From: Viresh Kumar To: Parth Shah Cc: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched/fair: Make sched-idle cpu selection consistent throughout Message-ID: <20191025081108.6gaprbwm5fvokun6@vireshk-i7> References: <5eba2fb4af9ebc7396101bb9bd6c8aa9c8af0710.1571899508.git.viresh.kumar@linaro.org> <7d3a1549-a99c-ae42-6074-8ed2ecd7074f@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7d3a1549-a99c-ae42-6074-8ed2ecd7074f@linux.ibm.com> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25-10-19, 12:13, Parth Shah wrote: > Hi Viresh, > > On 10/24/19 12:15 PM, Viresh Kumar wrote: > > There are instances where we keep searching for an idle CPU despite > > having a sched-idle cpu already (in find_idlest_group_cpu(), > > select_idle_smt() and select_idle_cpu() and then there are places where > > we don't necessarily do that and return a sched-idle cpu as soon as we > > find one (in select_idle_sibling()). This looks a bit inconsistent and > > it may be worth having the same policy everywhere. > > > > On the other hand, choosing a sched-idle cpu over a idle one shall be > > beneficial from performance point of view as well, as we don't need to > > get the cpu online from a deep idle state which is quite a time > > consuming process and delays the scheduling of the newly wakeup task. > > > > This patch tries to simplify code around sched-idle cpu selection and > > make it consistent throughout. > > > > FWIW, tests were done with the help of rt-app (8 SCHED_OTHER and 5 > > SCHED_IDLE tasks, not bound to any cpu) on ARM platform (octa-core), and > > no significant difference in scheduling latency of SCHED_OTHER tasks was > > found. > > > > Signed-off-by: Viresh Kumar > > --- > > [...] > > > @@ -5755,13 +5749,11 @@ static int select_idle_smt(struct task_struct *p, int target) > > for_each_cpu(cpu, cpu_smt_mask(target)) { > > if (!cpumask_test_cpu(cpu, p->cpus_ptr)) > > continue; > > - if (available_idle_cpu(cpu)) > > + if (available_idle_cpu(cpu) || sched_idle_cpu(cpu)) > > return cpu; > > I guess this is a correct approach, but just wondering what if we still > keep searching for a sched_idle CPU even though we have found an > available_idle CPU? I do believe selecting a sched-idle CPU should almost always be better (performance wise), unless we have a strong argument against it. And anyway, the load balancer will get triggered at a later point of time and will pull away these newly wakeup tasks to idle CPUs. The advantage we get out of it is that the tasks get serviced a bit earlier when they first get queued. It is really up to the maintainers to see what kind of policy do we want to adapt here and not a choice I can make :) -- viresh