Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1660128ybz; Thu, 16 Apr 2020 13:09:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLiwxfrmGLm/wTm/Gei8zqlA6y2bZo2/1ca0n8k7lpJDHbvG3y2ylwKaMe6JzOoGvoHMn7u X-Received: by 2002:a17:906:48ce:: with SMTP id d14mr10637230ejt.113.1587067788815; Thu, 16 Apr 2020 13:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587067788; cv=none; d=google.com; s=arc-20160816; b=akGwWZCeYcGjGcvTauEzRiPcNqA2u9FYvKNGWg1rkl5oHwj3Ske69N/yLHCddeUtmt alTcZC71OhCtshTzujaq/I2n7st7EoPJsdmoxAMjzuPH0VaWoseinigMpRazkRiUB+oP gXNSitruE8Tqz6OU1fuKGY4vKBoifkX8lNH5O0iMOKGVKEAWJ9EjcYNWxybHyuCTHy1G 9pMFnSe/J56weJXYc+WQJ8qczMPiPdo8FeT+lMx9q6ssFDBH3tXJW3epF/X9zqvM3f2T dj8KP+hPRkePKqJwhkfNVhQxNjJGO4W36wuqTb09V4WthYOlG7n5zNBrjy5eWwiUXCtd R33Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=KwBByiAv3HXmeAVixqGHcJ2QpuSnLZEjcGbMG0rBWiQ=; b=rkab4fm+i89TFR8jQ7/jtsEx/QUU3D27/Y96nnEjGiB3BK24uPzTR2h0ma9usfIXjg Rf1qLHEZAperXQsFoSrZyjN32r2h1P4+/bpuCeIGk+8MDwbh2pBSonclhwIHyMWfn7w0 paUNDIWlYgvMkazxov+vznAlk8L23h5R7z58QDIwVVJes3ZTMJy+p6VLK87o4lE/jaxC iNneTYpnoV7e4+GgMDPMtMAZ94II4AQw0FybkMxz6hVA3enJIfYY3gAY+DZNBj1jrRD3 N7UWK0KlvBUzRfDkooqUnylwOx040y4/WFGJMn2bDjtnK/3iKdvHCRX9IIoEPpcxm0Rv 3QjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nKlcSTBO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id l27si11855205ejc.524.2020.04.16.13.09.25; Thu, 16 Apr 2020 13:09:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nKlcSTBO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2441695AbgDPNwn (ORCPT + 99 others); Thu, 16 Apr 2020 09:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2897376AbgDPNhC (ORCPT ); Thu, 16 Apr 2020 09:37:02 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 158AEC061A0C for ; Thu, 16 Apr 2020 06:37:00 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id t11so5604760lfe.4 for ; Thu, 16 Apr 2020 06:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KwBByiAv3HXmeAVixqGHcJ2QpuSnLZEjcGbMG0rBWiQ=; b=nKlcSTBO8GkCKIkCf8/N+OMHUq2yJYsqJGYD/0xJeirmiL64DS1GL7ARltujhYVJCj dUcAkGooLg9w7Fuy+DNQJD2FFRtk0QD57uBCP94rYqxGvIPCvKR1dw+XyStjOb2YoAIl PwdoynVoOS9JWj3oNz4rDpHm2mwiLLDuy0685MPer49Pl2VzWtr5+7AHZ0owr7GSU2Vw Dx4+edpy7ydLHo4deZyEk3HcgSrgU4jl57t7L1kVq6AvvsEqujV7hZOY0EHmgzsbwUir KvceFCIP5jh/EonIzK2rfMaLEHcFLOao5FM/mJFsc+ZypqihrCRzBvizg+3e1qUDVRwt 1Aew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KwBByiAv3HXmeAVixqGHcJ2QpuSnLZEjcGbMG0rBWiQ=; b=aNqX6bL24G3rGLgDvRXtzDgK/UeVjH3Nf7p76xSeNct71zgsgkhIwksY16bU+s4lMh am9pyiKnpXeMVlWDrS/KTfGvL6Yyuys38w6vhVxh3Dqz2INLKydzUzNzfwbxOnMb0H/5 LG8QWoTw8jJjzsW2DJnhXHkQkAgYB/gJxR7lKUigG6sr7jMcFM0K7DdDxRRNSk/J6L5i NVj5fYmJ9cL7CkKr2KUXmePD9xwcRGAAZIRDo8i2WxRBtgYv4hjGFZJCtQOub9+l8hNY sw08OnThW+aEa5ksqp3kPhtftaAD619xc5LItO4iE4dRyqRoBeV0SJcotS+kdA/6NImi CRGA== X-Gm-Message-State: AGi0PuYi2cRJkDH0NPnr2RH3VMKAEJVJ9zWTTR5IWILRjOU0PXsCbv3L qOk7EEo4B3R/1uI7uHhKT8JumRwz9yO2XIZHriXteQ== X-Received: by 2002:ac2:51c9:: with SMTP id u9mr6422380lfm.184.1587044218400; Thu, 16 Apr 2020 06:36:58 -0700 (PDT) MIME-Version: 1.0 References: <20200415210512.805-1-valentin.schneider@arm.com> <20200415210512.805-10-valentin.schneider@arm.com> In-Reply-To: From: Vincent Guittot Date: Thu, 16 Apr 2020 15:36:46 +0200 Message-ID: Subject: Re: [PATCH v3 9/9] sched/topology: Define and use shortcut pointers for wakeup sd_flag scan To: Dietmar Eggemann Cc: Valentin Schneider , linux-kernel , Ingo Molnar , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 16 Apr 2020 at 15:04, Dietmar Eggemann wrote: > > On 16.04.20 12:24, Valentin Schneider wrote: > > > > On 16/04/20 08:46, Vincent Guittot wrote: > >>> @@ -6657,7 +6646,19 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) > >>> > >>> rcu_read_lock(); > >>> > >>> - sd = highest_flag_domain(cpu, sd_flag); > >>> + switch (wake_flags & (WF_TTWU | WF_FORK | WF_EXEC)) { > >>> + case WF_TTWU: > >>> + sd_flag = SD_BALANCE_WAKE; > >>> + sd = rcu_dereference(per_cpu(sd_balance_wake, cpu)); > >> > >> It's worth having a direct pointer for the fast path which we always > >> try to keep short but the other paths are already slow and will not > >> get any benefit of this per cpu pointer. > >> We should keep the loop for the slow paths > >> > > > > Which fast/slow paths are you referring to here? want_affine vs > > !want_affine? If so, do you then mean that we should do the switch case > > only when !want_affine, and otherwise look for the domain via the > > for_each_domain() loop? > > Coming back to the v2 discussion on this patch > > https://lore.kernel.org/r/20200311181601.18314-10-valentin.schneider@arm.com > > SD_BALANCE_WAKE is not used in mainline anymore, so wakeups are always > fast today. > > I.e. you wouldn't need a per_cpu(sd_balance_wake, cpu) since it's always > NULL. > > I.e. want_affine logic and the 'for_each_domain(cpu, tmp)' isn't needed > anymore. > > This will dramatically simplify the code in select_task_rq_fair(). > > But I guess Vincent wants to keep the functionality so we're able to > enable SD_BALANCE_WAKE on certain sd's? I looked too quickly what was done by this patch. I thought that it was adding a per_cpu pointer for all cases including the fast path with wake affine but it only skips the for_each_domain loop for the slow paths which don't need it because they are already slow. It would be better to keep the for_each_domain loop for slow paths and to use a per_cpu pointer for fast_path/wake affine. Regarding the wake_affine path, we don't really care about looping all domains and we could directly use the highest domain because wake_affine() that is used in the loop, only uses the imbalance_pct of the sched domain for wake_affine_weight() and it should not harm to use only the highest domain and then select_idle_sibling doesn't use it but the llc or asym_capacity pointer instead.