Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1842590ybn; Thu, 26 Sep 2019 03:05:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYkHn7TQ7Gba/nzr+acJqFb4zqVOZe/UPdpMngjOyFGM1Fk65Jh7umjLGA2qDBHcVDF68a X-Received: by 2002:a05:6402:14d0:: with SMTP id f16mr2571512edx.41.1569492303436; Thu, 26 Sep 2019 03:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569492303; cv=none; d=google.com; s=arc-20160816; b=yzKG48e5hP5bIUxNR6nJHuKOd92FukN8cgDw9IL2Hu5CyHlozeu/DhjydVe+ruSiIG EfHU2SidhbiwhcNIHyiXhkjlMotYKiGdQV9Zo/6CdQ4XXEfGHzWaHupALesOU3cCbOZc 6DunY0n6+Xgb2RUv+BQ+dFqrMwff/bpOhLxSRrLABGNcJ5OhOO1/FYFg3pru1PzsisAv e1fEvhnmyXGaiIAsSP629bN077EqNGA39/Yiy9iaq8H0PrZ+UkvRmNhkeZXm+N5Y9IQb VQfJoB0T2t06fcY/a0vl/vM6IPqMob7ZPDS2lS57bfjTmqMjN4QIV1Ss9sEm4sAhEp6f KA8A== 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=1iYIPSzzIfXlRvnuiGOUUTDkEf43dGwEwse/Vb9bEnE=; b=KtLhpZvbVk898PNCsy0aslarc/rvSsNqTe2RhPzDi3QfkR2lNQBAmz6spL6xTe4ZIJ 75boqUO8QIp2ar6XFUGSqIlrUrFBgyZpZUGZosGsQiBVVYNTYDljGGsJ92AVWNk4agGJ 73TeYTYB7XplPHvd+hqCYiN5JSOo4JiEmpgfG9noN7JJxUYZl98Qp0N+68kI/h8NPKE7 sxE6e7aMCBkJ7hd9fKrxpgvpsbFQrCTAlirVkGnaHtOoHjQqifyAb7/K0hbD8cvNNpqh 6Xip9vgrV4AwruXLIZw3345Q2X8XerR8m+J78TbrdXYIADuv9V2GPNyBI5/vx6Dq31q4 sPTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bNmt9DOt; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si701109ejq.164.2019.09.26.03.04.39; Thu, 26 Sep 2019 03:05:03 -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=@gmail.com header.s=20161025 header.b=bNmt9DOt; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbfIYWHz (ORCPT + 99 others); Wed, 25 Sep 2019 18:07:55 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:34096 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727735AbfIYWHz (ORCPT ); Wed, 25 Sep 2019 18:07:55 -0400 Received: by mail-lf1-f67.google.com with SMTP id r22so154385lfm.1 for ; Wed, 25 Sep 2019 15:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1iYIPSzzIfXlRvnuiGOUUTDkEf43dGwEwse/Vb9bEnE=; b=bNmt9DOt5JGyHTmbNuyV+3+vaKOB/qnAuhWlp/ogagheP6TNEym2rVTA1feCUZZa/X 8VpNWfRYn9wit6UwLwWcT8gtFiUxl3rx4s8Xd7H93ebVNBJ7JsEPlsqeBCdtm5U3vbMR FMWqBOlFOQQZ84IibgteeiCibYPpIUtPcGZFxNbLMnyZR5GvROP7FDMbC4xqOghCD48T K98sDCi5LkhmTuLccVPh7PQWS7TRZpWaxClvDMSdPC6Baet1yshzg0SFu6woVC0r8tVK S8daqjkDXi6tUfR6CoP149MQnZ10wTuZSlS3FghtViSM+sgsRoWjHIp4bCee/4UxIr/I k21g== 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=1iYIPSzzIfXlRvnuiGOUUTDkEf43dGwEwse/Vb9bEnE=; b=esLf6rZLsDW9PmvaEVgU8wZTytVRlgbV72Jah3CktxxEcs3gsw8ylSsy0qcRFFl+9o WzUmjLHycYltZHdhlATAc9ygtSOrt6aMsaVLCiZbxaKstEvyJJTLMoziw2OY9FTlFy9w bcGZV/XXirlFJqRkH/34iJPKIYBXOV6blIzveWMRS61rUngIwaRlrRpQVPSi/B4LHwDW sxp1BwaX+q8I2yrCyv+1mMhyQGMDdbbY9zF/Mxen8vU5SPjtiXNwPiw12FDn/i0EtLTq KVPrPmoq7SI3NqgwPN8D75b7E6yEfmUz25iXS0JkLm7V9CQKNisPfammKyRUjyqcaa3M t/VQ== X-Gm-Message-State: APjAAAXVMJZnnSOMRGVvI94SaHAcbLppRkfwvYFG7EaWKLESlEqcNg6J rgDUGh5nqiKiLahoGUzI6Zd9Os4naFQDTxg6heo= X-Received: by 2002:ac2:4c8f:: with SMTP id d15mr161866lfl.74.1569449273985; Wed, 25 Sep 2019 15:07:53 -0700 (PDT) MIME-Version: 1.0 References: <20190612163345.GB26997@sinkpad> <635c01b0-d8f3-561b-5396-10c75ed03712@oracle.com> <20190613032246.GA17752@sinkpad> <20190619183302.GA6775@sinkpad> <20190718100714.GA469@aaronlu> <20190725143003.GA992@aaronlu> <20190726152101.GA27884@sinkpad> <7dc86e3c-aa3f-905f-3745-01181a3b0dac@linux.intel.com> <20190802153715.GA18075@sinkpad> <69cd9bca-da28-1d35-3913-1efefe0c1c22@linux.intel.com> <54fbb676-61f9-e76c-7be3-fe2c2bb473da@linux.intel.com> In-Reply-To: <54fbb676-61f9-e76c-7be3-fe2c2bb473da@linux.intel.com> From: Aubrey Li Date: Thu, 26 Sep 2019 06:07:42 +0800 Message-ID: Subject: Re: [RFC PATCH v3 00/16] Core scheduling v3 To: Tim Chen Cc: Dario Faggioli , Julien Desfossez , "Li, Aubrey" , Aaron Lu , Subhra Mazumdar , Vineeth Remanan Pillai , Nishanth Aravamudan , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Paul Turner , Linus Torvalds , Linux List Kernel Mailing , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Kees Cook , Greg Kerr , Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini 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, Sep 26, 2019 at 1:24 AM Tim Chen wrote: > > On 9/24/19 7:40 PM, Aubrey Li wrote: > > On Sat, Sep 7, 2019 at 2:30 AM Tim Chen wrote: > >> +static inline s64 core_sched_imbalance_delta(int src_cpu, int dst_cpu, > >> + int src_sibling, int dst_sibling, > >> + struct task_group *tg, u64 task_load) > >> +{ > >> + struct sched_entity *se, *se_sibling, *dst_se, *dst_se_sibling; > >> + s64 excess, deficit, old_mismatch, new_mismatch; > >> + > >> + if (src_cpu == dst_cpu) > >> + return -1; > >> + > >> + /* XXX SMT4 will require additional logic */ > >> + > >> + se = tg->se[src_cpu]; > >> + se_sibling = tg->se[src_sibling]; > >> + > >> + excess = se->avg.load_avg - se_sibling->avg.load_avg; > >> + if (src_sibling == dst_cpu) { > >> + old_mismatch = abs(excess); > >> + new_mismatch = abs(excess - 2*task_load); > >> + return old_mismatch - new_mismatch; > >> + } > >> + > >> + dst_se = tg->se[dst_cpu]; > >> + dst_se_sibling = tg->se[dst_sibling]; > >> + deficit = dst_se->avg.load_avg - dst_se_sibling->avg.load_avg; > >> + > >> + old_mismatch = abs(excess) + abs(deficit); > >> + new_mismatch = abs(excess - (s64) task_load) + > >> + abs(deficit + (s64) task_load); > > > > If I understood correctly, these formulas made an assumption that the task > > being moved to the destination is matched the destination's core cookie. > > That's not the case. We do not need to match the destination's core cookie, I actually meant destination core's core cookie. > as that may change after context switches. It needs to reduce the load mismatch > with the destination CPU's sibling for that cgroup. So the new_mismatch is not always true, especially when there are more cgroups and more core cookies on the system. Thanks, -Aubrey