On Mon, Jul 13, 2020 at 01:21:25PM +0200, Peter Zijlstra wrote: > + * copy_process() sysctl_uclamp > + * uclamp_min_rt = X; > + * write_lock(&tasklist_lock) read_lock(&tasklist_lock) > + * // link thread smp_mb__after_spinlock() > + * write_unlock(&tasklist_lock) read_unlock(&tasklist_lock); > + * sched_post_fork() for_each_process_thread() > + * __uclamp_sync_rt() __uclamp_sync_rt() > + * > + * Ensures that either sched_post_fork() will observe the new > + * uclamp_min_rt or for_each_process_thread() will observe the new > + * task. > + */
more specifically this has the cases: A) copy_process() sysctl_uclamp uclamp_min_rt = X; write_lock(&tasklist_lock) // link thread write_unlock(&tasklist_lock) sched_post_fork() read_lock(&tasklist_lock) __uclamp_sync_rt() smp_mb__after_spinlock() read_unlock(&tasklist_lock); for_each_process_thread() __uclamp_sync_rt() Where write_unlock()'s RELEASE matches read_lock() ACQUIRE and guarantees for_each_process_thread() must observe the new thread. B) copy_process() sysctl_uclamp uclamp_min_rt = X; read_lock(&tasklist_lock) smp_mb__after_spinlock() read_unlock(&tasklist_lock); write_lock(&tasklist_lock) for_each_process_thread() // link thread __uclamp_sync_rt() write_unlock(&tasklist_lock) sched_post_fork() __uclamp_sync_rt() Where read_unlock()'s RELEASE matches write_lock()'s ACQUIRE and sched_post_fork() must observe the uclamp_min_t STORE. The smp_mb__after_spinlock() might be superfluous, but like said, brain isn't working.