Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1952183pxb; Mon, 11 Oct 2021 17:17:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwu9D1guVzN50B20zFblvBhIRJbsiuHauc/o4aTeLZVhtd6OBxS8KkbD+fLMufL3VAaW1mB X-Received: by 2002:a17:906:eb86:: with SMTP id mh6mr29571313ejb.141.1633997851686; Mon, 11 Oct 2021 17:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633997851; cv=none; d=google.com; s=arc-20160816; b=w4uFb0kJdJwS8TOOrCm8nVIJNgHox0hdv8SpBrkR15mSK6ePVwwvJXxK90FPEjZ6V7 zo6+v4rtq0NKglik4a6OxZynVRcs7vJYJ8a80cTADh5cSnC6h1WdxxO/i+ouk2jnffKe yJFXhg/VfrQvJyMfX95Q9jLTgShLjsG3eIsvEZgZcDqe+3lzhR4UpkAC66uHf08MOVq3 wkRp4e9+aV0VY3hRYyomy5a9uJnIkExh1tImqAMOqol8U+Lfg2vR/eRM6JJb2/iC61jK yxd0R4T+DSutYPD2HV+8j2BVwBUUOQP6qsirSuKgpim+Cs6Vh1HHXdnYxEDb6lLaxL6V Hkuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ENwk9JEgz2hASvxdoAsgjgcUl2M7wlCV95vN1r9bfoY=; b=cPT6m8HRDBmUiFN2y1zDY1CwmGn0e7JoXLbCFVZjP0jq/ICnuAMnyAvcNjmtiZtavR tTfjZypemkGjum1lCHmcg0LUyDIuRK8uwqen6uyVF5yqiDjKIoN80Ot2E1xkFvSe4+fD uIviiKB7Aweb92L3wQ5seZnqbAbO811tF91UyE4lKikqdVNSxj6m5igKgBgKTBpWvg+k iB+fnaipEWUlGZvr3OfUVWqXrsQ+/wrcJtCJExRFH8vdKM8J9O5OvkX9YDFYWCAECv9U k243eGucpT7PEC830/Tom/Kw72kVx0eC+WkFXjVYOzPdCYT5R84BRi70s1/kTW0q9qJC lGXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qp7Hifvd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si16735287ejt.408.2021.10.11.17.16.59; Mon, 11 Oct 2021 17:17:31 -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=@google.com header.s=20210112 header.b=qp7Hifvd; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233607AbhJLAQm (ORCPT + 99 others); Mon, 11 Oct 2021 20:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232758AbhJLAQl (ORCPT ); Mon, 11 Oct 2021 20:16:41 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE86FC061570 for ; Mon, 11 Oct 2021 17:14:40 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id n65so42721523ybb.7 for ; Mon, 11 Oct 2021 17:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ENwk9JEgz2hASvxdoAsgjgcUl2M7wlCV95vN1r9bfoY=; b=qp7HifvdbhtSoBNZrHOxPz3g/MDHOhlHgP6YBDMWBCJl6RN+Q5vXyIG7MtYoR6sX2H Rt971+DgVcNmdHbhe2d+PJWaWKWQGYOHg8ZiXsHu6SHZh0J3rLB5daWYaFPJIOy1bTjq NfFwYHPxQOOg4VMxegJxVzpm5MoGvWIueAc9vPp9K5h8DUjf68Q0yGHmiJYER4a0b30S CqEKxXvhKdBNbAhpGk+CByb8jH26k2AgOYVDLO85dqn6hSqjJjPzyyn7l/xt+mBsx3ps 4Swl2mGBx3g5/5MoBECGr6Mjk2EBPlX7Ze2dIK2DVcvxXHQiLXvXCLp0ReGKE+P6xW8/ ygvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ENwk9JEgz2hASvxdoAsgjgcUl2M7wlCV95vN1r9bfoY=; b=uQRUbEfDP9ahnJVvuUaQjDXld2k2oRms/YJaq7fVEC0DInosm9+9I510VI2vAjsylR 1VInjiFVrnj3Blsm8EXT/oij/buNc0QCvkoxaDZa50MT6lOa4grNZGoNh0h/LKBJ7sL2 BfZQPKvDG9hrAlRxZGPCFN4lT43PrzhepRM0huGBFVW0FqnECLX/7yoEaaKcVnb6ovNa w9Pr8TULg1AGg8xkoLhTCJ1lmzrMEoLhu21uPWJGigvOcdAo25icQoVLPSvAhyXOTWsW Dq3rsbiCQ5d+r3jZqj+xrusOT7nwtlteZHPbNLkazt67jkga6hS2RJHxay4Q2mJ0Uy9b 3jdw== X-Gm-Message-State: AOAM533MN2Fus4hQ3JGo9kwB60+RdDI2Pp4zVCk2BuspeYo0KBY8XoGN w7exBdFUd3xdps4ufKXsYJpXFFcOFolPFzTJ7QA6KQ== X-Received: by 2002:a25:cf07:: with SMTP id f7mr25077060ybg.100.1633997679963; Mon, 11 Oct 2021 17:14:39 -0700 (PDT) MIME-Version: 1.0 References: <20211008000825.1364224-1-joshdon@google.com> In-Reply-To: From: Josh Don Date: Mon, 11 Oct 2021 17:14:29 -0700 Message-ID: Subject: Re: [PATCH] sched/core: forced idle accounting To: Tao Zhou Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Joel Fernandes , Vineeth Pillai , Hao Luo , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 9, 2021 at 11:11 AM Tao Zhou wrote: [snip] > > + smt_count = cpumask_weight(smt_mask); > > + if (smt_count > 2) { > > + unsigned int nr_forced_idle = 0, nr_running = 0; > > + > > + for_each_cpu(i, smt_mask) { > > + rq_i = cpu_rq(i); > > + p = rq_i->core_pick ?: rq_i->curr; > > + > > + if (p != rq_i->idle) > > + nr_running++; > > + else if (rq_i->nr_running) > > + nr_forced_idle++; > > + } > > + > > + if (WARN_ON_ONCE(!nr_running)) { > > + /* can't be forced idle without a running task */ > > + } else { > > + delta *= nr_forced_idle; > > + delta /= nr_running; > > + } > > Is it possible to use (smt_count - core_occupation) / core_occupation > to evaluate this delta ? Good point, we can use the pre-computed info here. This will help simplify this logic. Thanks, Josh