Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp622927ybt; Wed, 24 Jun 2020 07:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3HoMyCQXIBCc6vknQ6unS2RTJBwHQIFzzDIC1ByiPgDRISHuoHszu/4BnyYLY9t8lV+us X-Received: by 2002:aa7:c682:: with SMTP id n2mr26411263edq.18.1593008498206; Wed, 24 Jun 2020 07:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593008498; cv=none; d=google.com; s=arc-20160816; b=CCRIOW+42uu3+e6hjA7Iayu4C3Se0NMbxKX0QI5tNm0nxY3O3k1f9B2OPapjRV/BTq VQ+wz41MuluGDeQzyY5Fv6njnwL+9R7I+hjzaOYvLZStH1L27tWipdryMHTnhkQgPWLb 6KSpkpiwh1zyi7A+dprm8UzN20Q+xdBkBjgjebNdQZ5wDka5KYVxxMWjY/WGnwrhjqBK YU5/k2DE3/9oWkqE4whp8VKanXij2u1cCMVGExKbJyAqnwMxePlBhCpum+aEulk9GFu/ ljnVKD30ZBKkoSI4Mtf5vmCL8ykJfEMku2lwef+9HHYr9RWE0vRK7mL52sv0aQsOpUhp VbKw== 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:dmarc-filter:dkim-signature; bh=A4b2D748cWipzvKRfVN086pFwlukr+c2oii9h7uumRw=; b=fRbHzVlddfPbAeTDAF0NKtog5Mc251R1q+X3ZqVIw9Wx5dw9v3VFHpNrIpQHBSc2JC xMn/4XOBA1Kft2QooofVMMIcAat3vVdGqqFNCgeL/cxzJ9spb9YPdlOyI/AbQrNHiEZ2 eI0SgZ9FXZP0FtP0cqHC/jmMv3WkJIz+vON7ohDSHOfllPFl7ZsVBOOxNrfRfl04WVg3 QRIf6qfdOKWH8y9/xQpSD1gqIuyId4vmKAZ2wKX4R6fYtpHt1clyB36WPPl5NSu72U6w c/iZVLRxcgcysC91Jgs3Sm6UsxQBufIIz6+uiKIMV9/Z2HQ6h6cSS5V8ZDrXi218B8VM cQzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=V5NJJ3ex; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si250654ejw.686.2020.06.24.07.21.15; Wed, 24 Jun 2020 07:21:38 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=V5NJJ3ex; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390033AbgFXOTB (ORCPT + 99 others); Wed, 24 Jun 2020 10:19:01 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:15769 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388115AbgFXOTA (ORCPT ); Wed, 24 Jun 2020 10:19:00 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1593008340; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=A4b2D748cWipzvKRfVN086pFwlukr+c2oii9h7uumRw=; b=V5NJJ3exuQSLAlq9jNYovTxEauinXwnN9uzvFHZMtEVNMWK9UIz3ck57n4mXpPT7nTFxBKLb XO8XWflbtCcbypI3TMBNy7V6iSLX7toh3YtiC0Z+8Z4H4TzneYlGCuDwr9Cw+8lCU0qw0EC9 K/8+Th5D+isF+VZZj/5FYM05eB8= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n11.prod.us-west-2.postgun.com with SMTP id 5ef360cb117610c7ff66da94 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 24 Jun 2020 14:18:51 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id AF198C433C6; Wed, 24 Jun 2020 14:18:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pkondeti) by smtp.codeaurora.org (Postfix) with ESMTPSA id 44B0CC433C8; Wed, 24 Jun 2020 14:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 44B0CC433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=pkondeti@codeaurora.org Date: Wed, 24 Jun 2020 19:48:44 +0530 From: Pavan Kondeti To: Vincent Guittot Cc: Peter Zijlstra , LKML , Lei Wen Subject: Re: Looping more in detach_tasks() when RT and CFS tasks are present Message-ID: <20200624141844.GB25985@codeaurora.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Vincent, On Wed, Jun 24, 2020 at 02:39:25PM +0200, Vincent Guittot wrote: > Hi Pavan, > > On Wed, 24 Jun 2020 at 13:42, Pavan Kondeti wrote: > > > > Hi Vincent/Peter, > > > > in load_balance(), we derive env->loop_max based on rq->nr_running. > > When the busiest rq has both RT and CFS tasks, we do more loops in > > detach_tasks(). Is there any reason for not using > > rq->cfs.h_nr_running? > > Using cfs.h_nr_running seems fine for loop_max > Thanks for taking a look. > > > > Lei Wen attempted to fix this before. > > https://lore.kernel.org/lkml/1376814322-7320-2-git-send-email-leiwen@marvell.com/ > > The 1st part of the patch is wrong because even if h_nr_running == 1 > but nr_running > 1, we can pull the cfs thread without using active > balance > Right. When a RT and CFS tasks are packed, I have seen CFS task getting pulled via load balancer without waking migration/X. I was using the below patch along with some prints in detach_tasks() loop. I will update Lei Wen's patch and resend it. diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 02f323b..f042016 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9509,7 +9509,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, * correctly treated as an imbalance. */ env.flags |= LBF_ALL_PINNED; - env.loop_max = min(sysctl_sched_nr_migrate, busiest->nr_running); + env.loop_max = min(sysctl_sched_nr_migrate, busiest->cfs.h_nr_running); more_balance: rq_lock_irqsave(busiest, &rf); Thanks, Pavan -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.