* [PATCH v2] sched/core: Skip sched_core_fork/free() when core sched is disabled
@ 2022-04-24 20:17 Cruz Zhao
2022-04-25 8:14 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Cruz Zhao @ 2022-04-24 20:17 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot
Cc: linux-kernel
As __put_task_struct() and copy_process() are hot path functions,
the call of sched_core_fork/free() will bring overhead when core
sched is disabled, and we skip them in these cases.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Cruz Zhao <CruzZhao@linux.alibaba.com>
---
kernel/sched/core_sched.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/core_sched.c b/kernel/sched/core_sched.c
index 38a2cec..72a8ef8 100644
--- a/kernel/sched/core_sched.c
+++ b/kernel/sched/core_sched.c
@@ -108,13 +108,16 @@ static unsigned long sched_core_clone_cookie(struct task_struct *p)
void sched_core_fork(struct task_struct *p)
{
- RB_CLEAR_NODE(&p->core_node);
- p->core_cookie = sched_core_clone_cookie(current);
+ if (!sched_core_disabled()) {
+ RB_CLEAR_NODE(&p->core_node);
+ p->core_cookie = sched_core_clone_cookie(current);
+ }
}
void sched_core_free(struct task_struct *p)
{
- sched_core_put_cookie(p->core_cookie);
+ if (!sched_core_disabled())
+ sched_core_put_cookie(p->core_cookie);
}
static void __sched_core_set(struct task_struct *p, unsigned long cookie)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] sched/core: Skip sched_core_fork/free() when core sched is disabled
2022-04-24 20:17 [PATCH v2] sched/core: Skip sched_core_fork/free() when core sched is disabled Cruz Zhao
@ 2022-04-25 8:14 ` Peter Zijlstra
2022-04-25 15:04 ` cruzzhao
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2022-04-25 8:14 UTC (permalink / raw)
To: Cruz Zhao
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, linux-kernel
On Mon, Apr 25, 2022 at 04:17:34AM +0800, Cruz Zhao wrote:
> As __put_task_struct() and copy_process() are hot path functions,
> the call of sched_core_fork/free() will bring overhead when core
> sched is disabled, and we skip them in these cases.
Only if you have profile data.. mostly these functions do whole lot of
nothing.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] sched/core: Skip sched_core_fork/free() when core sched is disabled
2022-04-25 8:14 ` Peter Zijlstra
@ 2022-04-25 15:04 ` cruzzhao
0 siblings, 0 replies; 3+ messages in thread
From: cruzzhao @ 2022-04-25 15:04 UTC (permalink / raw)
To: Peter Zijlstra
Cc: mingo, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
bsegall, mgorman, bristot, linux-kernel
在 2022/4/25 下午4:14, Peter Zijlstra 写道:
> On Mon, Apr 25, 2022 at 04:17:34AM +0800, Cruz Zhao wrote:
>> As __put_task_struct() and copy_process() are hot path functions,
>> the call of sched_core_fork/free() will bring overhead when core
>> sched is disabled, and we skip them in these cases.
>
> Only if you have profile data.. mostly these functions do whole lot of
> nothing.
Many thanks for suggestion, I'll test it.
Best wishes,
Cruz Zhao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-25 15:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 20:17 [PATCH v2] sched/core: Skip sched_core_fork/free() when core sched is disabled Cruz Zhao
2022-04-25 8:14 ` Peter Zijlstra
2022-04-25 15:04 ` cruzzhao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).