FreeBSD/sys/kern/kern_sharedpage.c
/*
 * Push the timehands update to the shared page.
 *
 * The lockless update scheme is similar to the one used to update the
 * in-kernel timehands, see sys/kern/kern_tc.c:tc_windup() (which
 * calls us after the timehands are updated).
 */
Push the timehands update to the shared page.
The lockless update scheme is similar to the one used to update the
in-kernel timehands, see sys/kern/kern_tc.c:tc_windup() (which
calls us after the timehands are updated).
Push the timehands update to the shared page . The lockless update scheme is similar to the one used to update the in - kernel timehands see sys / kern / kern_tc . c : tc_windup () ( which calls us after the timehands are updated ) .
static void
timehands_update(struct vdso_sv_tk *svtk)
{
	struct vdso_timehands th;
	struct vdso_timekeep *tk;
	uint32_t enabled, idx;
	enabled = tc_fill_vdso_timehands(&th);
	th.th_gen = 0;
	idx = svtk->sv_timekeep_curr;
	if (++idx >= VDSO_TH_NUM)
		idx = 0;
	svtk->sv_timekeep_curr = idx;
	if (++svtk->sv_timekeep_gen == 0)
		svtk->sv_timekeep_gen = 1;
	tk = (struct vdso_timekeep *)(shared_page_mapping +
	    svtk->sv_timekeep_off);
	tk->tk_th[idx].th_gen = 0;
	atomic_thread_fence_rel();
	if (enabled)
		tk->tk_th[idx] = th;
	atomic_store_rel_32(&tk->tk_th[idx].th_gen, svtk->sv_timekeep_gen);
	atomic_store_rel_32(&tk->tk_current, idx);
	tk->tk_enabled = enabled;
}
static void timehands_update ( struct vdso_sv_tk * svtk ) { struct vdso_timehands th ; struct vdso_timekeep * tk ; uint32_t enabled , idx ; enabled = tc_fill_vdso_timehands ( & th ) ; th . th_gen = 0 ; idx = svtk -> sv_timekeep_curr ; if ( ++ idx >= VDSO_TH_NUM ) idx = 0 ; svtk -> sv_timekeep_curr = idx ; if ( ++ svtk -> sv_timekeep_gen == 0 ) svtk -> sv_timekeep_gen = 1 ; tk = ( struct vdso_timekeep * ) ( shared_page_mapping + svtk -> sv_timekeep_off ) ; tk -> tk_th [ idx ] . th_gen = 0 ; atomic_thread_fence_rel ( ) ; if ( enabled ) tk -> tk_th [ idx ] = th ; atomic_store_rel_32 ( & tk -> tk_th [ idx ] . th_gen , svtk -> sv_timekeep_gen ) ; atomic_store_rel_32 ( & tk -> tk_current , idx ) ; tk -> tk_enabled = enabled ; }
Push the timehands update to the shared page.
Push the timehands update to the shared page .
/*
	 * The ordering of the assignment to tk_enabled relative to
	 * the update of the vdso_timehands is not important.
	 */