On Thu, Nov 19 2020 at 13:12, Peter Zijlstra wrote: > On Thu, Nov 19, 2020 at 12:51:32PM +0100, Peter Zijlstra wrote: >> > +void __kmap_local_sched_in(void) >> > +{ >> > + struct task_struct *tsk = current; >> > + pte_t *kmap_pte = kmap_get_pte(); >> > + int i; >> > + >> > + /* Restore kmaps */ >> > + for (i = 0; i < tsk->kmap_ctrl.idx; i++) { >> > + } >> > +} >> >> So even in the optimal case, this adds an unconditional load of >> tsk->kmap_ctrl.idx to schedule() (2 misses, one pre and one post). >> >> Munging preempt-notifiers behind a static_branch, which in that same >> optimal case, avoided touching curr->preempt_notifier, resulted in a >> measurable performance improvement. See commit: >> >> 1cde2930e154 ("sched/preempt: Add static_key() to preempt_notifiers") >> >> Can we fudge some state in a cacheline we're already touching to avoid >> this? > > The only state we seem to consistently look at after schedule() is > need_resched()'s TIF_NEED_RESCHED. > > But adding a TIF_flag to all archs and setting/clearing it from > kmap_local might be a bit daft.. :/ Yes, and we all agreed that pushing the burden on CONFIG_HIGHMEM is fine. It's slow, so making it a tad slower is not the end of the world. Remember we want to get rid of it :) Thanks, tglx