* [PATCH] sched/fair: Make hrtimer callback execute in the hard interrupt context
@ 2023-03-06 7:09 Zqiang
2023-03-06 11:06 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Zqiang @ 2023-03-06 7:09 UTC (permalink / raw)
To: mingo, peterz, vincent.guittot, juri.lelli
Cc: dietmar.eggemann, rostedt, vschneid, linux-kernel, qiang1.zhang
The scheduler related hrtimers callback will be executed in softirqd
context for PREEMPT_RT enabled kernel, this commit therefore mark
hrtimers as harded even on PREEMPT_RT enabled kernels, there is no
functional change.
Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
kernel/sched/fair.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index c36aa54ae071..98c48d144089 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5610,7 +5610,7 @@ static void start_cfs_slack_bandwidth(struct cfs_bandwidth *cfs_b)
hrtimer_start(&cfs_b->slack_timer,
ns_to_ktime(cfs_bandwidth_slack_period),
- HRTIMER_MODE_REL);
+ HRTIMER_MODE_REL_HARD);
}
/* we know any runtime found here is valid as update_curr() precedes return */
@@ -5813,9 +5813,9 @@ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
cfs_b->burst = 0;
INIT_LIST_HEAD(&cfs_b->throttled_cfs_rq);
- hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
+ hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
cfs_b->period_timer.function = sched_cfs_period_timer;
- hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
cfs_b->slack_timer.function = sched_cfs_slack_timer;
cfs_b->slack_started = false;
}
@@ -5835,7 +5835,7 @@ void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
cfs_b->period_active = 1;
hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
- hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED);
+ hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED_HARD);
}
static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sched/fair: Make hrtimer callback execute in the hard interrupt context
2023-03-06 7:09 [PATCH] sched/fair: Make hrtimer callback execute in the hard interrupt context Zqiang
@ 2023-03-06 11:06 ` Peter Zijlstra
2023-03-06 14:27 ` Zhang, Qiang1
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2023-03-06 11:06 UTC (permalink / raw)
To: Zqiang
Cc: mingo, vincent.guittot, juri.lelli, dietmar.eggemann, rostedt,
vschneid, linux-kernel
On Mon, Mar 06, 2023 at 03:09:38PM +0800, Zqiang wrote:
> The scheduler related hrtimers callback will be executed in softirqd
> context for PREEMPT_RT enabled kernel, this commit therefore mark
> hrtimers as harded even on PREEMPT_RT enabled kernels, there is no
> functional change.
There very much is a functional change, also your reasoning is
non-existant.
Also:
https://lkml.kernel.org/r/Y1F5sDVGen7ZVW+U@hirez.programming.kicks-ass.net
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
> kernel/sched/fair.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index c36aa54ae071..98c48d144089 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5610,7 +5610,7 @@ static void start_cfs_slack_bandwidth(struct cfs_bandwidth *cfs_b)
>
> hrtimer_start(&cfs_b->slack_timer,
> ns_to_ktime(cfs_bandwidth_slack_period),
> - HRTIMER_MODE_REL);
> + HRTIMER_MODE_REL_HARD);
> }
>
> /* we know any runtime found here is valid as update_curr() precedes return */
> @@ -5813,9 +5813,9 @@ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
> cfs_b->burst = 0;
>
> INIT_LIST_HEAD(&cfs_b->throttled_cfs_rq);
> - hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
> + hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD);
> cfs_b->period_timer.function = sched_cfs_period_timer;
> - hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> + hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
> cfs_b->slack_timer.function = sched_cfs_slack_timer;
> cfs_b->slack_started = false;
> }
> @@ -5835,7 +5835,7 @@ void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
>
> cfs_b->period_active = 1;
> hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
> - hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED);
> + hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED_HARD);
> }
>
> static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] sched/fair: Make hrtimer callback execute in the hard interrupt context
2023-03-06 11:06 ` Peter Zijlstra
@ 2023-03-06 14:27 ` Zhang, Qiang1
0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qiang1 @ 2023-03-06 14:27 UTC (permalink / raw)
To: Peter Zijlstra
Cc: mingo, vincent.guittot, juri.lelli, dietmar.eggemann, rostedt,
vschneid, linux-kernel
> The scheduler related hrtimers callback will be executed in softirqd
> context for PREEMPT_RT enabled kernel, this commit therefore mark
> hrtimers as harded even on PREEMPT_RT enabled kernels, there is no
> functional change.
>
>There very much is a functional change, also your reasoning is non-existant.
>
>Also:
Thanks for reply, I will reorganize the reason and resend
Thanks
Zqiang
>
> https://lkml.kernel.org/r/Y1F5sDVGen7ZVW+U@hirez.programming.kicks-ass.net
>
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
> kernel/sched/fair.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index
> c36aa54ae071..98c48d144089 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5610,7 +5610,7 @@ static void start_cfs_slack_bandwidth(struct
> cfs_bandwidth *cfs_b)
>
> hrtimer_start(&cfs_b->slack_timer,
> ns_to_ktime(cfs_bandwidth_slack_period),
> - HRTIMER_MODE_REL);
> + HRTIMER_MODE_REL_HARD);
> }
>
> /* we know any runtime found here is valid as update_curr() precedes
> return */ @@ -5813,9 +5813,9 @@ void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
> cfs_b->burst = 0;
>
> INIT_LIST_HEAD(&cfs_b->throttled_cfs_rq);
> - hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED);
> + hrtimer_init(&cfs_b->period_timer, CLOCK_MONOTONIC,
> +HRTIMER_MODE_ABS_PINNED_HARD);
> cfs_b->period_timer.function = sched_cfs_period_timer;
> - hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> + hrtimer_init(&cfs_b->slack_timer, CLOCK_MONOTONIC,
> +HRTIMER_MODE_REL_HARD);
> cfs_b->slack_timer.function = sched_cfs_slack_timer;
> cfs_b->slack_started = false;
> }
> @@ -5835,7 +5835,7 @@ void start_cfs_bandwidth(struct cfs_bandwidth
> *cfs_b)
>
> cfs_b->period_active = 1;
> hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
> - hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED);
> + hrtimer_start_expires(&cfs_b->period_timer,
> +HRTIMER_MODE_ABS_PINNED_HARD);
> }
>
> static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-06 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 7:09 [PATCH] sched/fair: Make hrtimer callback execute in the hard interrupt context Zqiang
2023-03-06 11:06 ` Peter Zijlstra
2023-03-06 14:27 ` Zhang, Qiang1
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®