Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3589385pxj; Mon, 21 Jun 2021 02:05:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+G6vqSv4DDMloDZVQZjDEylptJL0jqZOT2xaPwYvIYzNUXi4ThgQulDSjQZFyw0FxyiOo X-Received: by 2002:a17:906:680f:: with SMTP id k15mr6472239ejr.75.1624266326990; Mon, 21 Jun 2021 02:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624266326; cv=none; d=google.com; s=arc-20160816; b=vX0kKlLt0jwsD53w5iYCItSoRNK71qbnmDgjSz2x28HgZVWdppQtMdNkix75ze6bvq Pw/u8oIMjgbE82+FnoLwvpmct/w/A2de6eHUpyOcycx2xu8+11IPqWMdMAoIljTr2SLJ YIyQ/YoO1N+Et61f9UJy+2PMx13+SH4C8QBMhL/asW5WvmGdEGhPTfyIYwCAtoJEfD04 sGr0glERW98Zmx2kVPLRZ9XayzNKCHUQ+GiKY8fIxbdE0dtCdcJCf7QfKcWCfAiZtvXb iB50wBqQRiEL0l1T1VH3rwQQIJ/sV8EVLgg2Egwdyng34hP9gwrtLd4oCyAF16tUSVG7 YoRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=WhBCpRmtiMgHA6nO2NEeIn80HnRktjw+HBQhJvQoy3w=; b=yava4njg4HOljA1E0iFb7HazQ1+mGKKWd8kzSIL2GcHQJCNcYUHx1NXfwcsPpue9Q6 g4nDwdqqtXIe4po2X2HTEVVKDMHCzfw6aCsB9kntHsNvKPaMoS/kF4rlDYsc24/0KYrd PfJoIR8aLzJQwYgY1WZ8Pq4/o/HhNZveVkNav36do8oLpPGSW4vXB2lC9W+dAanuLlb/ 5mxfHkCxNBK064WzfoOjcXJNM1dTMfyNMw/H8FPHeE0RrA4wm/BS+KZouANAjWRpMP2K n7qy57mnumLugCYA3vL5RazDEM3OzfB3XN8ldQKCBpt549jZ1LNH5+vG8zRfNOMo2P93 Jsog== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm23si13866265edb.119.2021.06.21.02.05.04; Mon, 21 Jun 2021 02:05:26 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbhFUJFp (ORCPT + 99 others); Mon, 21 Jun 2021 05:05:45 -0400 Received: from foss.arm.com ([217.140.110.172]:58904 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhFUJFj (ORCPT ); Mon, 21 Jun 2021 05:05:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A81F31FB; Mon, 21 Jun 2021 02:03:25 -0700 (PDT) Received: from e120877-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 895913F718; Mon, 21 Jun 2021 02:03:24 -0700 (PDT) Date: Mon, 21 Jun 2021 10:03:13 +0100 From: Vincent Donnefort To: Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , linux-kernel Subject: Re: [PATCH 1/2] sched/rt: Fix RT utilization tracking during policy change Message-ID: <20210621090312.GA193194@e120877-lin.cambridge.arm.com> References: <1624023139-66147-1-git-send-email-vincent.donnefort@arm.com> 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [...] > > /* > > - * If we are already running, then there's nothing > > - * that needs to be done. But if we are not running > > - * we may need to preempt the current running task. > > - * If that current running task is also an RT task > > + * If we are not running we may need to preempt the current > > + * running task. If that current running task is also an RT task > > * then see if we can move to another run queue. > > */ > > if (task_on_rq_queued(p) && rq->curr != p) { > > @@ -2355,6 +2353,13 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p) > > if (p->prio < rq->curr->prio && cpu_online(cpu_of(rq))) > > resched_curr(rq); > > } > > + > > + /* > > + * If we are running, update the avg_rt tracking, as the running time > > + * will now on be accounted into the latter. > > + */ > > + if (task_current(rq, p)) > > task_current(rq,p) equals the "rq->curr != p" above. Having 2 > different ways to get the same value in the function is a bit > confusing. > > And call it once > > Otherwise, the fix looks good to me I can change it to something like: if (task_current(rq, p)) { update_rt_rq_load_avg() return; } if (task_on_rq_queued(p) { ... if (p->prio ...) resched_curr(rq); } ? > > > + update_rt_rq_load_avg(rq_clock_pelt(rq), rq, 0); > > } > > > > /* > > -- > > 2.7.4 > >