> +void __rseq_set_sched_state(struct task_struct *t, unsigned int state) > +{ > + if (unlikely(t->flags & PF_EXITING)) > + return; Don't we want to do this even if the task is exciting? If rseq is read only only the current task, then it does not matter (exiting task won't read own rseq anymore). But if we extending expected uses cases to tasks reading rseq of other tasks, we may need to updates even in PF_EXITING case. > + pagefault_disable(); This is a bit concerning. Does this mean updates are not done if the page is currently not in memory? Can we make it reliable as for the main rseq data (cpu_id)? For tcmalloc uses (and other uses that require reliable information) this may be problematic. User-space may start thinking that all "CPU slots" are busy and that there more threads running than there are CPUs. > + (void) put_user(state, &t->rseq_sched_state->state); > + pagefault_enable(); > +}