From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE3B9284672 for ; Fri, 12 Dec 2025 14:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765549359; cv=none; b=rS147YJZ03HQuSGy6nqk9uL2HsqMoTKGyopoqFBFl0jHM+bJTmBpsDbl/kQ4gh/p7oXUSdvQ2yQO4ixwv+myfEuP+dYitCzIrHPGTSO+BE69lZMtfXWTV2QKOzSZxKO1zxe+cVErN6tcKOn80Y8NvizbKcmqwlW6NyEbok/w0TI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765549359; c=relaxed/simple; bh=zixVKroluF6zMBi5ipdgvllNC1VooE1i938sn1wc09Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rMF4rDDkzsbY3P/F2edSacOGkaaq+NJpJbtk7xXwBHEEiF5RwP68rQBhKD8BGr9gMbrQRlMaOt5S6SRJHq469e3ttafwCNCginDeSFIW2JFKmoVJ+VFdhtNYWYtk23adWrEJ9DosEfKaVJ0xNSrDo4deH6+7KMp8zX0bkzsnLYw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 98E371063; Fri, 12 Dec 2025 06:22:29 -0800 (PST) Received: from [192.168.178.101] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 49E4B3F73B; Fri, 12 Dec 2025 06:22:34 -0800 (PST) Message-ID: <0486368b-9cc9-48f3-8074-b72c76aab7e1@arm.com> Date: Fri, 12 Dec 2025 15:22:32 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/2] sched: update the rq->avg_idle when a task is moved to an idle CPU To: Shijie Huang , Huang Shijie , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: patches@amperecomputing.com, cl@linux.com, Shubhang@os.amperecomputing.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, vschneid@redhat.com, vineethr@linux.ibm.com, kprateek.nayak@amd.com References: <20251209094508.570049-1-shijie@os.amperecomputing.com> <20251209094508.570049-3-shijie@os.amperecomputing.com> <51a9e1c4-3061-488c-89f4-ed656f3a73e3@amperemail.onmicrosoft.com> Content-Language: en-GB From: Dietmar Eggemann In-Reply-To: <51a9e1c4-3061-488c-89f4-ed656f3a73e3@amperemail.onmicrosoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12.12.25 04:16, Shijie Huang wrote: > > On 12/12/2025 00:15, Dietmar Eggemann wrote: >> In v2 you moved update_rq_avg_idle() (1) from activate_task() (2) to >> enqueue_task() to possibly handle delayed tasks. > Not for the delayed tasks, just for a more common place to handle more > cases. >> In v3 you figured there can't be any delayed task on a CPU when it sets >> rq->idle_stamp in sched_balance_newidle() > Yes. >> So you could move (1) back to (2) avoiding the 'if rq->idle_stamp' for >> the sched_change pattern for instance? > Could you please tell me what is "avoiding the 'if rq->idle_stamp' for > the sched_change pattern" ? > > Sorry, I do not understand your meaning. sched_change uses dequeue_task()/enqueue_task() for a queued task to change prio, policy, sched params, taskgroups, etc. kernel/sched/sched.h: DEFINE_CLASS(sched_change, struct sched_change_ctx *, sched_change_end(_T), sched_change_begin(p, flags), struct task_struct *p, unsigned int flags) kernel/sched/core.c: struct sched_change_ctx *sched_change_begin(struct task_struct *p, unsigned int flags) void sched_change_end(struct sched_change_ctx *ctx) > IMHO, there is no need to move (1) back to (2). Btw, I'm using a BUG_ON(this_rq->idle_stamp) in sched_balance_newidle() with update_rq_avg_idle() in activate_task() for testing.