2023-09-25 17:14:38

by Haifeng Xu

[permalink] [raw]
Subject: [PATCH] sched/psi: bail out early from irq time accounting

We could bail out early when psi was disabled.

Signed-off-by: Haifeng Xu <[email protected]>
---
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


2023-09-26 00:07:16

by Johannes Weiner

[permalink] [raw]
Subject: Re: [PATCH] sched/psi: bail out early from irq time accounting

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 <[email protected]>

Acked-by: Johannes Weiner <[email protected]>

Can you please resend this with Peter Ziljstra <[email protected]>
in CC? Thanks

2023-09-26 14:21:40

by Haifeng Xu

[permalink] [raw]
Subject: [PATCH RESEND] sched/psi: bail out early from irq time accounting

We could bail out early when psi was disabled.

Signed-off-by: Haifeng Xu <[email protected]>
---
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

2023-09-26 17:42:51

by Haifeng Xu

[permalink] [raw]
Subject: Re: [PATCH] sched/psi: bail out early from irq time accounting



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 <[email protected]>
>
> Acked-by: Johannes Weiner <[email protected]>
>
> Can you please resend this with Peter Ziljstra <[email protected]>
> in CC? Thanks

thanks, I'll send a new mail later.

2023-09-26 20:43:53

by Chengming Zhou

[permalink] [raw]
Subject: Re: [PATCH RESEND] sched/psi: bail out early from irq time accounting

On 2023/9/26 19:57, Haifeng Xu wrote:
> We could bail out early when psi was disabled.
>
> Signed-off-by: Haifeng Xu <[email protected]>
> ---
> 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 <[email protected]>

Thanks.

2023-10-03 11:21:08

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH RESEND] sched/psi: bail out early from irq time accounting

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 <[email protected]>

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
>

Subject: [tip: sched/core] sched/psi: Bail out early from irq time accounting

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 <[email protected]>
AuthorDate: Tue, 26 Sep 2023 11:57:22
Committer: Peter Zijlstra <[email protected]>
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 <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Chengming Zhou <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
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;