mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
@ 2026-11-27  9:11 Li kunyu
  2026-11-27  9:33 ` Kayra Cizmeci
  2026-11-27 11:00 ` [PATCH v2] " Li kunyu
  0 siblings, 2 replies; 6+ messages in thread
From: Li kunyu @ 2026-11-27  9:11 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	kayracizmeci
  Cc: linux-kernel, Li kunyu

pref_llc_queued is only used once. Assign p->pref_llc_queued directly
at the original sampling point instead of caching the value in a local
variable.

Suggested-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Link: https://lore.kernel.org/all/awhlwJTOLPeNqFW8@scheduler.schedules/
Signed-off-by: Li kunyu <likunyu@open-hieco.net>
---
 kernel/sched/fair.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index da0d9e19c457..4efc5ed5e79f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1521,16 +1521,13 @@ static void pref_llc_running_dec(struct rq *rq, struct task_struct *p)
 
 static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
 {
-	int pref_llc, pref_llc_queued;
+	int pref_llc;
 	struct sched_domain *sd;
 
 	pref_llc = p->preferred_llc;
 	if (pref_llc < 0)
 		return;
 
-	pref_llc_queued = (pref_llc == task_llc(p));
-	rq->nr_llc_running++;
-
 	/*
 	 * Record whether p is enqueued on its preferred
 	 * LLC, in order to pair with account_llc_dequeue()
@@ -1545,7 +1542,8 @@ static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
 	 * p->pref_llc_queued in account_llc_dequeue() would
 	 * be reliable.
 	 */
-	p->pref_llc_queued = pref_llc_queued;
+	p->pref_llc_queued = (pref_llc == task_llc(p));
+	rq->nr_llc_running++;
 
 	/* Skipped while delayed; clear_delayed() adds it back on wake. */
 	pref_llc_running_inc(rq, p);
-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
  2026-11-27  9:11 [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue() Li kunyu
@ 2026-11-27  9:33 ` Kayra Cizmeci
  2026-11-27  9:47   ` Li kunyu
  2026-11-27 11:00 ` [PATCH v2] " Li kunyu
  1 sibling, 1 reply; 6+ messages in thread
From: Kayra Cizmeci @ 2026-11-27  9:33 UTC (permalink / raw)
  To: Li kunyu
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	linux-kernel

Hi,

On Fri, Nov 27, 2026 at 05:11:46PM +0800, Li kunyu wrote:
> pref_llc_queued is only used once. Assign p->pref_llc_queued directly
> at the original sampling point instead of caching the value in a local
> variable.
> 
> Suggested-by: Kayra Cizmeci <kayracizmeci@gmail.com>
> Link: https://lore.kernel.org/all/awhlwJTOLPeNqFW8@scheduler.schedules/

I didn't really suggest anything. I don't know which part of my mail
was a suggestion to you? Maybe below code is correct but I didn't
suggest it. So please remove my tag from the patch.

> Signed-off-by: Li kunyu <likunyu@open-hieco.net>
> ---
>  kernel/sched/fair.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index da0d9e19c457..4efc5ed5e79f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1521,16 +1521,13 @@ static void pref_llc_running_dec(struct rq *rq, struct task_struct *p)
>  
>  static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
>  {
> -	int pref_llc, pref_llc_queued;
> +	int pref_llc;
>  	struct sched_domain *sd;
>  
>  	pref_llc = p->preferred_llc;
>  	if (pref_llc < 0)
>  		return;
>  
> -	pref_llc_queued = (pref_llc == task_llc(p));
> -	rq->nr_llc_running++;
> -
>  	/*
>  	 * Record whether p is enqueued on its preferred
>  	 * LLC, in order to pair with account_llc_dequeue()
> @@ -1545,7 +1542,8 @@ static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
>  	 * p->pref_llc_queued in account_llc_dequeue() would
>  	 * be reliable.
>  	 */
> -	p->pref_llc_queued = pref_llc_queued;
> +	p->pref_llc_queued = (pref_llc == task_llc(p));
> +	rq->nr_llc_running++;
>  
>  	/* Skipped while delayed; clear_delayed() adds it back on wake. */
>  	pref_llc_running_inc(rq, p);
> -- 
> 2.47.3
> 

Thanks,

Kayra

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
  2026-11-27  9:33 ` Kayra Cizmeci
@ 2026-11-27  9:47   ` Li kunyu
  2026-11-27 10:22     ` Kayra Cizmeci
  0 siblings, 1 reply; 6+ messages in thread
From: Li kunyu @ 2026-11-27  9:47 UTC (permalink / raw)
  To: Kayra Cizmeci
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	linux-kernel

Hi Kayra,

On 2026/11/27 17:33, Kayra Cizmeci wrote:
> Hi,
> 
> On Fri, Nov 27, 2026 at 05:11:46PM +0800, Li kunyu wrote:
>> pref_llc_queued is only used once. Assign p->pref_llc_queued directly
>> at the original sampling point instead of caching the value in a local
>> variable.
>>
>> Suggested-by: Kayra Cizmeci <kayracizmeci@gmail.com>
>> Link: https://lore.kernel.org/all/awhlwJTOLPeNqFW8@scheduler.schedules/
> I didn't really suggest anything. I don't know which part of my mail
> was a suggestion to you? Maybe below code is correct but I didn't
> suggest it. So please remove my tag from the patch.
> 

I saw your reply on the cleanup patch in the linked thread and took it as a
suggestion, which I then incorporated (hence the Suggested-by). If that wasn't
the intent, let me know and I'll send a v2 to drop the tag.

-- 
thanks,
kunyu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
  2026-11-27  9:47   ` Li kunyu
@ 2026-11-27 10:22     ` Kayra Cizmeci
  2026-11-27 10:40       ` Li kunyu
  0 siblings, 1 reply; 6+ messages in thread
From: Kayra Cizmeci @ 2026-11-27 10:22 UTC (permalink / raw)
  To: Li kunyu
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	linux-kernel

On Fri, Nov 27, 2026 at 05:47:26PM +0800, Li kunyu wrote:
> Hi Kayra,
> 
> On 2026/11/27 17:33, Kayra Cizmeci wrote:
> > Hi,
> > 
> > On Fri, Nov 27, 2026 at 05:11:46PM +0800, Li kunyu wrote:
> >> pref_llc_queued is only used once. Assign p->pref_llc_queued directly
> >> at the original sampling point instead of caching the value in a local
> >> variable.
> >>
> >> Suggested-by: Kayra Cizmeci <kayracizmeci@gmail.com>
> >> Link: https://lore.kernel.org/all/awhlwJTOLPeNqFW8@scheduler.schedules/
> > I didn't really suggest anything. I don't know which part of my mail
> > was a suggestion to you? Maybe below code is correct but I didn't
> > suggest it. So please remove my tag from the patch.
> > 
> 
> I saw your reply on the cleanup patch in the linked thread and took it as a
> suggestion, which I then incorporated (hence the Suggested-by). If that wasn't
> the intent, let me know and I'll send a v2 to drop the tag.

Yeah, I want my tag removed :-). And I don't know
which part of my message was a suggestion to you...

> 
> -- 
> thanks,
> kunyu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
  2026-11-27 10:22     ` Kayra Cizmeci
@ 2026-11-27 10:40       ` Li kunyu
  0 siblings, 0 replies; 6+ messages in thread
From: Li kunyu @ 2026-11-27 10:40 UTC (permalink / raw)
  To: Kayra Cizmeci
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	linux-kernel

Hi,

On 2026/11/27 18:22, Kayra Cizmeci wrote:
>> I saw your reply on the cleanup patch in the linked thread and took it as a
>> suggestion, which I then incorporated (hence the Suggested-by). If that wasn't
>> the intent, let me know and I'll send a v2 to drop the tag.
> Yeah, I want my tag removed :-). And I don't know
> which part of my message was a suggestion to you...
> 

‘As I see and know, cleanups attend to get lost in sched's traffic.
I don't like that. So I'll review this :-).’ I came across this comment and,
since I happened to have some thoughts on it, I referenced it. I’ll post a v2
under this thread shortly.

-- 
thanks,
kunyu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue()
  2026-11-27  9:11 [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue() Li kunyu
  2026-11-27  9:33 ` Kayra Cizmeci
@ 2026-11-27 11:00 ` Li kunyu
  1 sibling, 0 replies; 6+ messages in thread
From: Li kunyu @ 2026-11-27 11:00 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak,
	kayracizmeci
  Cc: linux-kernel, Li kunyu

pref_llc_queued is only used once. Assign p->pref_llc_queued directly
at the original sampling point instead of caching the value in a local
variable.

Signed-off-by: Li kunyu <likunyu@open-hieco.net>
---
Changes in v2:
- Remove the Suggested-by tag and the related reference information.
---
 kernel/sched/fair.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index da0d9e19c457..4efc5ed5e79f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1521,16 +1521,13 @@ static void pref_llc_running_dec(struct rq *rq, struct task_struct *p)
 
 static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
 {
-	int pref_llc, pref_llc_queued;
+	int pref_llc;
 	struct sched_domain *sd;
 
 	pref_llc = p->preferred_llc;
 	if (pref_llc < 0)
 		return;
 
-	pref_llc_queued = (pref_llc == task_llc(p));
-	rq->nr_llc_running++;
-
 	/*
 	 * Record whether p is enqueued on its preferred
 	 * LLC, in order to pair with account_llc_dequeue()
@@ -1545,7 +1542,8 @@ static void account_llc_enqueue(struct rq *rq, struct task_struct *p)
 	 * p->pref_llc_queued in account_llc_dequeue() would
 	 * be reliable.
 	 */
-	p->pref_llc_queued = pref_llc_queued;
+	p->pref_llc_queued = (pref_llc == task_llc(p));
+	rq->nr_llc_running++;
 
 	/* Skipped while delayed; clear_delayed() adds it back on wake. */
 	pref_llc_running_inc(rq, p);
-- 
2.47.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-27 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  9:11 [PATCH] sched/fair: Simplify pref_llc_queued handling in account_llc_enqueue() Li kunyu
2026-11-27  9:33 ` Kayra Cizmeci
2026-11-27  9:47   ` Li kunyu
2026-11-27 10:22     ` Kayra Cizmeci
2026-11-27 10:40       ` Li kunyu
2026-11-27 11:00 ` [PATCH v2] " Li kunyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®