mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Josh Don <joshdon@google.com>, Zecheng Li <zli94@ncsu.edu>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Rik van Riel <riel@surriel.com>, Chris Mason <clm@fb.com>,
	Madadi Vineeth Reddy <vineethr@linux.ibm.com>,
	Xu Liu <xliuprof@google.com>, Blake Jones <blakejones@google.com>,
	Nilay Vaish <nilayvaish@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	<linux-kernel@vger.kernel.org>, Zecheng Li <zecheng@google.com>
Subject: Re: [PATCH v9 RESEND 1/3] sched/fair: Co-locate cfs_rq and sched_entity in cfs_tg_state
Date: Wed, 1 Apr 2026 08:27:50 +0530	[thread overview]
Message-ID: <c04894c6-df1b-43b0-adc5-effa513f4517@amd.com> (raw)
In-Reply-To: <CABk29NvTZYy=+=WgXkqDG_dw0HJmj6X6WdW1CTE=dwT1JaQ7mQ@mail.gmail.com>

Hello Josh,

On 4/1/2026 1:05 AM, Josh Don wrote:
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 0a35a82e4792..79160d419c9f 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -13877,8 +13877,6 @@ void free_fair_sched_group(struct task_group *tg)
>>         for_each_possible_cpu(i) {
>>                 if (tg->cfs_rq)
>>                         kfree(tg->cfs_rq[i]);
>> -               if (tg->se)
>> -                       kfree(tg->se[i]);
>>         }
> 
> To be more explicit, suggest converting tg->cfs_rq[i] to an explicit
> cfs_tg_state pointer via container_of, to not depend on cfs_rq being
> the first member of the struct.

I suggested the __no_randomize_layout trick since it is similar to what
"struct sched_entity_stats" does and we save on checking if
"tg->cfs_rq[i]" NULL before doing container_of() + kfree().

I isn't any more obscure than how kfree(tg->se[i]) would have previously
freed up the stats member too in one go but perhaps a comment on top
can address your concerns?

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-04-01  2:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 17:52 [PATCH v9 RESEND 0/3] sched/fair: Optimize cfs_rq and sched_entity allocation for better data locality Zecheng Li
2026-03-19 17:52 ` [PATCH v9 RESEND 1/3] sched/fair: Co-locate cfs_rq and sched_entity in cfs_tg_state Zecheng Li
2026-03-31 19:35   ` Josh Don
2026-04-01  2:57     ` K Prateek Nayak [this message]
2026-04-02  2:19       ` Josh Don
2026-03-19 17:52 ` [PATCH v9 RESEND 2/3] sched/fair: Remove task_group->se pointer array Zecheng Li
2026-03-31 19:42   ` Josh Don
2026-03-19 17:52 ` [PATCH v9 RESEND 3/3] sched/fair: Allocate cfs_tg_state with percpu allocator Zecheng Li
2026-03-31 19:49   ` Josh Don

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c04894c6-df1b-43b0-adc5-effa513f4517@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=blakejones@google.com \
    --cc=bsegall@google.com \
    --cc=clm@fb.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=nilayvaish@google.com \
    --cc=peterz@infradead.org \
    --cc=riel@surriel.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vineethr@linux.ibm.com \
    --cc=vschneid@redhat.com \
    --cc=xliuprof@google.com \
    --cc=zecheng@google.com \
    --cc=zli94@ncsu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®