From: Linus Torvalds Date: Fri, 28 Apr 2023 21:53:30 +0000 (-0700) Subject: Merge tag 'sched-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git... X-Git-Tag: v6.6-pxa1908~1340 X-Git-Url: https://git.dujemihanovic.xyz/?a=commitdiff_plain;h=586b222d748e91c619d68e9239654ebc7fed9b0c;p=linux.git Merge tag 'sched-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull scheduler updates from Ingo Molnar: - Allow unprivileged PSI poll()ing - Fix performance regression introduced by mm_cid - Improve livepatch stalls by adding livepatch task switching to cond_resched(). This resolves livepatching busy-loop stalls with certain CPU-bound kthreads - Improve sched_move_task() performance on autogroup configs - On core-scheduling CPUs, avoid selecting throttled tasks to run - Misc cleanups, fixes and improvements * tag 'sched-core-2023-04-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/clock: Fix local_clock() before sched_clock_init() sched/rt: Fix bad task migration for rt tasks sched: Fix performance regression introduced by mm_cid sched/core: Make sched_dynamic_mutex static sched/psi: Allow unprivileged polling of N*2s period sched/psi: Extract update_triggers side effect sched/psi: Rename existing poll members in preparation sched/psi: Rearrange polling code in preparation sched/fair: Fix inaccurate tally of ttwu_move_affine vhost: Fix livepatch timeouts in vhost_worker() livepatch,sched: Add livepatch task switching to cond_resched() livepatch: Skip task_call_func() for current task livepatch: Convert stack entries array to percpu sched: Interleave cfs bandwidth timers for improved single thread performance at low utilization sched/core: Reduce cost of sched_move_task when config autogroup sched/core: Avoid selecting the task that is throttled to run when core-sched enable sched/topology: Make sched_energy_mutex,update static --- 586b222d748e91c619d68e9239654ebc7fed9b0c diff --cc drivers/vhost/vhost.c index 10bf35a3db6e,822fbdb54c4f..a92af08e7864 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@@ -358,14 -360,13 +358,13 @@@ static int vhost_worker(void *data llist_for_each_entry_safe(work, work_next, node, node) { clear_bit(VHOST_WORK_QUEUED, &work->flags); __set_current_state(TASK_RUNNING); - kcov_remote_start_common(dev->kcov_handle); + kcov_remote_start_common(worker->kcov_handle); work->fn(work); kcov_remote_stop(); - if (need_resched()) - schedule(); + cond_resched(); } } - kthread_unuse_mm(dev->mm); + return 0; } diff --cc kernel/fork.c index 4342200d5e2b,ad2ee22272a3..eccb35a85216 --- a/kernel/fork.c +++ b/kernel/fork.c @@@ -1308,7 -1179,8 +1313,9 @@@ static struct mm_struct *mm_init(struc fail_pcpu: while (i > 0) percpu_counter_destroy(&mm->rss_stat[--i]); + mm_destroy_cid(mm); + fail_cid: + destroy_context(mm); fail_nocontext: mm_free_pgd(mm); fail_nopgd: diff --cc kernel/sched/core.c index 8d2b6742d02c,898fa3bc2765..54c75af24899 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@@ -5268,10 -5284,13 +5286,13 @@@ context_switch(struct rq *rq, struct ta /* * kernel -> kernel lazy + transfer active - * user -> kernel lazy + mmgrab() active + * user -> kernel lazy + mmgrab_lazy_tlb() active * - * kernel -> user switch + mmdrop() active + * kernel -> user switch + mmdrop_lazy_tlb() active * user -> user switch + * + * switch_mm_cid() needs to be updated if the barriers provided + * by context_switch() are modified. */ if (!next->mm) { // to kernel enter_lazy_tlb(prev->active_mm, next);