Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2595896ybv; Mon, 24 Feb 2020 08:05:42 -0800 (PST) X-Google-Smtp-Source: APXvYqydXL8JIHfZDl0HxFPd0877IIMU7Clf0iM5bk4DsUGcQq/X4iSDIetRh1Go5owkaSIWTyXi X-Received: by 2002:a9d:7b4e:: with SMTP id f14mr40911558oto.355.1582560342296; Mon, 24 Feb 2020 08:05:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582560342; cv=none; d=google.com; s=arc-20160816; b=ARWZF5rFc+CQzLXkGLgaOaoqXA0/oS62bqHArar1o/EnGiK/xWI3PmxaLJ7i7OnMHe GvKZScQJJAtr3eWoE6Kt1CFoxJbt/TPYh1IteVeEefK83vsKOT2AJ6G1l19RTRXNCSUa +k7IqDyDaq86ojoPwxelQQ+5xXRhMseXNXqF+IGiAuO7+zfHm96wTVbBi5ifiTDOog6t rKqNPTGL7mDeTNd4qv9xSqXMkLbN62iAB1ZfyS/klvt42VOuHcnQ+RpFReAhD3TtC4op ayyWkfUM9RmE95MNZGElYm+GCn2Lm8tZPLSlYb8cRNcqpeN7hOb74BPxNkcfRHHpvwMM 4n+w== 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:dmarc-filter:dkim-signature; bh=hONwJDRPPASCJa7NuZbPYpImYBsMqPVL5iKoRqF+ugQ=; b=IOs3uSpbf/HounbSZvWlKNlpY0BE6jABCCtjNYrahfDaNUlYIZGg51j02tUVvIpemP Qwp+4kj/JWT+0ODTKOrI9A4zYqeCytmsxiU7kME9Kmn8w0xj54EzsA4CZheB79p60mQF Zpz4oDbd3WapXD0Fw+i5aLHcXAgY1aGt1DMoqNFLd+KhS+lYHknpzeuy5vtudpu+vXD8 vQ8y/kxHgPyNeGg2BMmo+gMIViB+pmthiHgsz8wwzEukHkBDvMC62OMeryOyZMtjhC4x HzSh6ZB7L6ZJbTOiTvK+5ZDuhXLusUOKZWizP7+ygq+5XVh+CqGzjTqnCvXSPhxflvFR FLiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=BNsXSLGw; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d189si5038108oib.93.2020.02.24.08.05.29; Mon, 24 Feb 2020 08:05:42 -0800 (PST) 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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=BNsXSLGw; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727932AbgBXQE5 (ORCPT + 99 others); Mon, 24 Feb 2020 11:04:57 -0500 Received: from mail26.static.mailgun.info ([104.130.122.26]:49982 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727489AbgBXQE5 (ORCPT ); Mon, 24 Feb 2020 11:04:57 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1582560296; h=Content-Type: Cc: To: Subject: Message-ID: Date: From: In-Reply-To: References: MIME-Version: Sender; bh=hONwJDRPPASCJa7NuZbPYpImYBsMqPVL5iKoRqF+ugQ=; b=BNsXSLGwwEh7u7GgkkuBnpAvkLlTzb5yytLtMhMQtBH9Gg0wATDj0NHkhHKVZ9Z63otRltIh ioCGvzH5E31eq2E8uMx7CbHFj/QJR86wRM+BtL/whxtGUx6KLJnPB16vVcXeOXmDCNT/xG0M rclQ/SlsxOFr/z4IG0ehQN4Fl3E= X-Mailgun-Sending-Ip: 104.130.122.26 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 mxa.mailgun.org with ESMTP id 5e53f428.7f27a5696110-smtp-out-n03; Mon, 24 Feb 2020 16:04:56 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6F17EC43383; Mon, 24 Feb 2020 16:04:55 +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=unavailable autolearn_force=no version=3.4.0 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (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 F0ED0C447A9 for ; Mon, 24 Feb 2020 16:04:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F0ED0C447A9 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 Received: by mail-ed1-f52.google.com with SMTP id g19so12451725eds.11 for ; Mon, 24 Feb 2020 08:04:53 -0800 (PST) X-Gm-Message-State: APjAAAUqp0YAyD9O04yTxTY9sU5lShzy6o09Ks313Zwmo8Ph1uWXr276 ywfLUky0GlgK9NemyUKvbR3DMsnWTEr0+IiyEw0= X-Received: by 2002:a05:6402:a49:: with SMTP id bt9mr45817212edb.144.1582560292603; Mon, 24 Feb 2020 08:04:52 -0800 (PST) MIME-Version: 1.0 References: <20200223184001.14248-1-qais.yousef@arm.com> <20200223184001.14248-6-qais.yousef@arm.com> <20200224061004.GH28029@codeaurora.org> <20200224121139.cbz2dt5heiouknif@e107158-lin.cambridge.arm.com> In-Reply-To: <20200224121139.cbz2dt5heiouknif@e107158-lin.cambridge.arm.com> From: Pavan Kondeti Date: Mon, 24 Feb 2020 21:34:41 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 5/6] sched/rt: Better manage pushing unfit tasks on wakeup To: Qais Yousef Cc: Pavan Kondeti , Ingo Molnar , Peter Zijlstra , Steven Rostedt , Dietmar Eggemann , Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , LKML 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 Hi Qais, On Mon, Feb 24, 2020 at 5:42 PM Qais Yousef wrote: [...] > We could do, temporarily, to get these fixes into 5.6. But I do think > select_task_rq_rt() doesn't do a good enough job into pushing unfit tasks to > the right CPUs. > > I don't understand the reasons behind your objection. It seems you think that > select_task_rq_rt() should be enough, but not AFAICS. Can you be a bit more > detailed please? > > FWIW, here's a screenshot of what I see > > https://imgur.com/a/peV27nE > > After the first activation, select_task_rq_rt() fails to find the right CPU > (due to the same move all tasks to the cpumask_fist()) - but when the task > wakes up on 4, the logic I put causes it to migrate to CPU2, which is the 2nd > big core. CPU1 and CPU2 are the big cores on Juno. > > Now maybe we should fix select_task_rq_rt() to better balance tasks, but not > sure how easy is that. > Thanks for the trace. Now things are clear to me. Two RT tasks woke up simultaneously and the first task got its previous CPU i.e CPU#1. The next task goes through find_lowest_rq() and got the same CPU#1. Since this task priority is not more than the just queued task (already queued on CPU#1), it is sent to its previous CPU i.e CPU#4 in your case. From task_woken_rt() path, CPU#4 attempts push_rt_tasks(). CPU#4 is not overloaded, but we have rt_task_fits_capacity() check which forces the push. Since the CPU is not overloaded, your has_unfit_tasks() comes to rescue and push the task. Since the task has not scheduled in yet, it is eligible for push. You added checks to skip resched_curr() in push_rt_tasks() otherwise the push won't happen. Finally, I understood your patch. Obviously this is not clear to me before. I am not sure if this patch is the right approach to solve this race. I will think a bit more. 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