svn commit: r333466 - in head: contrib/bmake sys/conf sys/kern sys/modules/epoch_test sys/sys sys/tests/epoch

Mark Johnston markj at FreeBSD.org
Fri May 11 18:47:42 UTC 2018


On Thu, May 10, 2018 at 05:55:25PM +0000, Matt Macy wrote:
> Author: mmacy
> Date: Thu May 10 17:55:24 2018
> New Revision: 333466
> URL: https://svnweb.freebsd.org/changeset/base/333466
> 
> Log:
>   Add simple preempt safe epoch API
>   
>   Read locking is over used in the kernel to guarantee liveness. This API makes
>   it easy to provide livenes guarantees without atomics.
>   
>   Includes epoch_test kernel module to stress test the API.
>   
>   Documentation will follow initial use case.
>   
>   Test case and improvements to preemption handling in response to discussion
>   with mjg@
>   
>   Reviewed by:	imp@, shurd@
>   Approved by:	sbruno@
> 
> Added:
>   head/sys/kern/subr_epoch.c   (contents, props changed)
>   head/sys/modules/epoch_test/
>   head/sys/modules/epoch_test/Makefile   (contents, props changed)
>   head/sys/sys/epoch.h   (contents, props changed)
>   head/sys/tests/epoch/
>   head/sys/tests/epoch/epoch_test.c   (contents, props changed)
> Modified:
>   head/contrib/bmake/job.c
>   head/sys/conf/files
>   head/sys/conf/kern.pre.mk
>   head/sys/kern/kern_malloc.c
>   head/sys/kern/kern_synch.c
>   head/sys/kern/subr_trap.c
>   head/sys/kern/subr_turnstile.c
>   head/sys/sys/proc.h
>   head/sys/sys/turnstile.h
> 
> Modified: head/sys/sys/proc.h
> ==============================================================================
> --- head/sys/sys/proc.h	Thu May 10 17:22:04 2018	(r333465)
> +++ head/sys/sys/proc.h	Thu May 10 17:55:24 2018	(r333466)
> @@ -243,6 +243,7 @@ struct thread {
>  
>  /* Cleared during fork1() */
>  #define	td_startzero td_flags
> +	u_char	td_epochnest; /* (k) Private thread epoch nest counter */

It looks like td_epochnest was inteded to be in the zeroed section, but
td_startzero still points to td_flags.

>  	int		td_flags;	/* (t) TDF_* flags. */
>  	int		td_inhibitors;	/* (t) Why can not run. */
>  	int		td_pflags;	/* (k) Private thread (TDP_*) flags. */
> @@ -355,6 +356,7 @@ struct thread {
>  	int		td_lastcpu;	/* (t) Last cpu we were on. */
>  	int		td_oncpu;	/* (t) Which cpu we are on. */
>  	void		*td_lkpi_task;	/* LinuxKPI task struct pointer */
> +	TAILQ_ENTRY(thread) td_epochq;	/* (t) Epoch queue. */
>  };


More information about the svn-src-all mailing list