kernel/sched/psi.c | 3 +++ 1 file changed, 3 insertions(+)
We could bail out early when psi was disabled.
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
kernel/sched/psi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 81fca77397f6..e74e14762d49 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1005,6 +1005,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta)
struct psi_group_cpu *groupc;
u64 now;
+ if (static_branch_likely(&psi_disabled))
+ return;
+
if (!task->pid)
return;
--
2.25.1
On 2023/9/25 18:21, Haifeng Xu wrote: > We could bail out early when psi was disabled. > > Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> > --- > kernel/sched/psi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c > index 81fca77397f6..e74e14762d49 100644 > --- a/kernel/sched/psi.c > +++ b/kernel/sched/psi.c > @@ -1005,6 +1005,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta) > struct psi_group_cpu *groupc; > u64 now; > > + if (static_branch_likely(&psi_disabled)) > + return; > + > if (!task->pid) > return; > Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com> Thanks.
On Mon, Sep 25, 2023 at 10:21:43AM +0000, Haifeng Xu wrote: > We could bail out early when psi was disabled. > > Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Can you please resend this with Peter Ziljstra <peterz@infradead.org> in CC? Thanks
On 2023/9/25 20:31, Johannes Weiner wrote: > On Mon, Sep 25, 2023 at 10:21:43AM +0000, Haifeng Xu wrote: >> We could bail out early when psi was disabled. >> >> Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> > > Acked-by: Johannes Weiner <hannes@cmpxchg.org> > > Can you please resend this with Peter Ziljstra <peterz@infradead.org> > in CC? Thanks thanks, I'll send a new mail later.
We could bail out early when psi was disabled.
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
---
kernel/sched/psi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 81fca77397f6..e74e14762d49 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -1005,6 +1005,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta)
struct psi_group_cpu *groupc;
u64 now;
+ if (static_branch_likely(&psi_disabled))
+ return;
+
if (!task->pid)
return;
--
2.25.1
On Tue, Sep 26, 2023 at 11:57:22AM +0000, Haifeng Xu wrote: > We could bail out early when psi was disabled. > > Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> Thanks! > --- > kernel/sched/psi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c > index 81fca77397f6..e74e14762d49 100644 > --- a/kernel/sched/psi.c > +++ b/kernel/sched/psi.c > @@ -1005,6 +1005,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta) > struct psi_group_cpu *groupc; > u64 now; > > + if (static_branch_likely(&psi_disabled)) > + return; > + > if (!task->pid) > return; > > -- > 2.25.1 >
On 2023/9/26 19:57, Haifeng Xu wrote: > We could bail out early when psi was disabled. > > Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com> > --- > kernel/sched/psi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c > index 81fca77397f6..e74e14762d49 100644 > --- a/kernel/sched/psi.c > +++ b/kernel/sched/psi.c > @@ -1005,6 +1005,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta) > struct psi_group_cpu *groupc; > u64 now; > > + if (static_branch_likely(&psi_disabled)) > + return; > + > if (!task->pid) > return; > Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com> Thanks.
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 0c2924079f5a83ed715630680e338b3685a0bf7d
Gitweb: https://git.kernel.org/tip/0c2924079f5a83ed715630680e338b3685a0bf7d
Author: Haifeng Xu <haifeng.xu@shopee.com>
AuthorDate: Tue, 26 Sep 2023 11:57:22
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 13 Oct 2023 09:56:29 +02:00
sched/psi: Bail out early from irq time accounting
We could bail out early when psi was disabled.
Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
Link: https://lore.kernel.org/r/20230926115722.467833-1-haifeng.xu@shopee.com
---
kernel/sched/psi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 44a7877..519bc92 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -998,6 +998,9 @@ void psi_account_irqtime(struct task_struct *task, u32 delta)
struct psi_group_cpu *groupc;
u64 now;
+ if (static_branch_likely(&psi_disabled))
+ return;
+
if (!task->pid)
return;
© 2016 - 2026 Red Hat, Inc.