Peter Zijlstra
2022-Sep-26 13:37 UTC
[PATCH v3 6/6] freezer,sched: Rewrite core freezer logic
On Mon, Sep 26, 2022 at 03:23:10PM +0200, Christian Borntraeger wrote:> Am 26.09.22 um 14:55 schrieb Peter Zijlstra: > > > Could you please test with something like the below on? I can boot that > > with KVM, but obviously I didn't suffer any weirdness to begin with :/ > > > > --- > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 4e6a6417211f..ef9ccfc3a8c0 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -4051,6 +4051,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) > > unsigned long flags; > > int cpu, success = 0; > > + WARN_ON_ONCE(state & TASK_FREEZABLE); > > + > > preempt_disable(); > > if (p == current) { > > /* > > Does not seem to trigger.Moo -- quite the puzzle this :/ I'll go stare at it more then.
Christian Borntraeger
2022-Sep-26 13:54 UTC
[PATCH v3 6/6] freezer,sched: Rewrite core freezer logic
Am 26.09.22 um 15:37 schrieb Peter Zijlstra:> On Mon, Sep 26, 2022 at 03:23:10PM +0200, Christian Borntraeger wrote: >> Am 26.09.22 um 14:55 schrieb Peter Zijlstra: >> >>> Could you please test with something like the below on? I can boot that >>> with KVM, but obviously I didn't suffer any weirdness to begin with :/ >>> >>> --- >>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >>> index 4e6a6417211f..ef9ccfc3a8c0 100644 >>> --- a/kernel/sched/core.c >>> +++ b/kernel/sched/core.c >>> @@ -4051,6 +4051,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) >>> unsigned long flags; >>> int cpu, success = 0; >>> + WARN_ON_ONCE(state & TASK_FREEZABLE); >>> + >>> preempt_disable(); >>> if (p == current) { >>> /* >> >> Does not seem to trigger. > > Moo -- quite the puzzle this :/ I'll go stare at it more then.In the end this is about the end of the sshd process (shutting it down). I can also trigger the problem by sending a SIGTERM so its not about the shutdown itself. Pofiling the guest I see scheduler functions like sched_clock, pick_next_entity, update_min_vruntime and so on with 100% system time.
Christian Borntraeger
2022-Sep-26 15:49 UTC
[PATCH v3 6/6] freezer,sched: Rewrite core freezer logic
Am 26.09.22 um 15:37 schrieb Peter Zijlstra:> On Mon, Sep 26, 2022 at 03:23:10PM +0200, Christian Borntraeger wrote: >> Am 26.09.22 um 14:55 schrieb Peter Zijlstra: >> >>> Could you please test with something like the below on? I can boot that >>> with KVM, but obviously I didn't suffer any weirdness to begin with :/ >>> >>> --- >>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >>> index 4e6a6417211f..ef9ccfc3a8c0 100644 >>> --- a/kernel/sched/core.c >>> +++ b/kernel/sched/core.c >>> @@ -4051,6 +4051,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) >>> unsigned long flags; >>> int cpu, success = 0; >>> + WARN_ON_ONCE(state & TASK_FREEZABLE); >>> + >>> preempt_disable(); >>> if (p == current) { >>> /* >> >> Does not seem to trigger. > > Moo -- quite the puzzle this :/ I'll go stare at it more then.Hmm, #define ___wait_is_interruptible(state) \ (!__builtin_constant_p(state) || \ state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \ That would not trigger when state is also TASK_FREEZABLE, no?