Page MenuHomeFreeBSD

pctrie: move iter_remove check from panic to KASSERT
ClosedPublic

Authored by dougm on Fri, Feb 14, 9:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 23, 12:25 AM
Unknown Object (File)
Fri, Feb 21, 6:05 PM
Unknown Object (File)
Wed, Feb 19, 9:17 PM
Unknown Object (File)
Sun, Feb 16, 7:08 PM
Subscribers

Details

Summary

pctrie_iter_remove checks to see if the thing the iterator points to is actually there, and panics if it is not. This panic would likely indicate the same iterator had been used for removal twice, without advancing the iterator in-between. This test takes a bit of time, and as it indicates a programmer error rather than some external condition, it is better handled as a KASSERT. This means with KASSERTs disabled, a wee bit of time is saved.

I've run timing tests with a GENERIC-NODEBUG kernel on 10 buildworlds, with and without this change, with @alc's counters patch to compute cycles spent in several different page-related routines. The change improves performance, slightly,overall:

		original				with change
		#calls		cycles/call		#calls		cycles/call
alloc_gpgs:	752349		3428.1887913720893	752207		3448.633675304803 
alloc_gpgs:	688604		3673.230660873303	688927		3710.4782320913537
alloc_gpgs:	688354		3722.3298956641497	688116		3724.4921830040284
alloc_gpgs:	688962		3757.316590755368	688048		4120.601606283282 
alloc_gpgs:	687899		3819.199016134636	687878		3801.2982563768574
alloc_gpgs:	688253		3840.736903435219	687921		3859.105416174241 
alloc_gpgs:	687737		3916.938853079011	687848		4067.281512776078 
alloc_gpgs:	688070		3894.264330664031	687766		3889.39766577586  
alloc_gpgs:	687625		4084.794888202145	688013		4041.318658223028 
alloc_gpgs:	687966		3926.7651686275194	687906		3940.705464118644 
alloc_grab:	1400  		358.6092857142857	1512		407.0		  
alloc_grab:	294   		531.969387755102	326		611.7484662576687 
alloc_grab:	289   		550.7750865051903	313		615.2875399361022 
alloc_grab:	343   		516.4897959183673	316		608.3924050632911 
alloc_grab:	355   		549.5802816901409	265		571.3358490566038 
alloc_grab:	319   		519.2758620689655	334		520.437125748503  
alloc_grab:	333   		536.6666666666666	362		579.4281767955802 
alloc_grab:	344   		501.11337209302326	295		601.0305084745763 
alloc_grab:	333   		583.3333333333334	207		686.3768115942029 
alloc_grab:	320   		651.315625		202		673.6930693069307 
alloc:		374712247	1675.8303609382695	374732340	1643.712126297933 
alloc:		374653610	1676.1168490836108	374704324	1653.870724144619 
alloc:		374713874	1688.8322359475806	374718690	1653.8408364258532
alloc:		374708445	1676.778351667521	374696574	1653.3047546332782
alloc:		374697461	1684.4900100403936	374705302	1638.5270346588263
alloc:		374688863	1676.2921480935504	374698642	1652.6191449794474
alloc:		374688844	1672.386739464813	374700646	1657.470333856857 
alloc:		374701782	1675.162272430826	374702569	1665.3081380741748
alloc:		374677620	1681.478047856181	374674913	1661.5130839357798
alloc:		374687101	1676.7973868841564	374687104	1650.044201195673 
opr:		1828217		40560.62056801791	1826962		39734.29978510774 
opr:		2055359		36235.20283025983	2047181		35923.51606819328 
opr:		2038435		36655.13261693407	2047645		35899.087803305745
opr:		2054437		36108.527030033045	2046845		36413.1135259387  
opr:		2042965		36446.945129750144	2051528		35715.55915200768 
opr:		2048255		36413.20800974488	2044672		35850.28021071351 
opr:		2049049		36125.79098206046	2047009		35705.91317722589 
opr:		2050466		36237.96061285581	2047915		35803.16550540428 
opr:		2041292		36533.834491096815	2046745		36003.082395217774
opr:		2048117		36405.64849615525	2046896		35861.29891113178 
collapse_scan:	63250  		14201.547083003952	63337		14063.44372167927 
collapse_scan:	63349  		14147.255962998626	63359		14056.012042488044
collapse_scan:	63342  		14876.751255091409	63450		13966.900535855004
collapse_scan:	63368  		14149.313707233936	63349		14086.56566007356 
collapse_scan:	63367  		14291.02242492149	63366		14123.410219991794
collapse_scan:	63359  		14991.783440395207	63390		14352.511295156964
collapse_scan:	63313  		14253.377347464186	63390		14050.656318031235
collapse_scan:	63370  		14283.916269528168	63367		14035.717928890432
collapse_scan:	63351  		14232.290540007261	63269		14686.27188670597 
collapse_scan:	63317  		14235.820853799138	63371		14212.717615312999
osplit:		20483  		3443.438607625836	20480		3364.996435546875 
osplit:		20484  		3410.7627416520213	20487		3326.1856787230927
osplit:		20484  		3438.250829916032	20482		3372.8710086905576
osplit:		20483  		3416.595859981448	20482		3412.3838004101162
osplit:		20482  		3446.5169417049115	20484		3416.813805897286 
osplit:		20482  		3480.830729420955	20481		3530.299692397832 
osplit:		20482  		3432.6595547309835	20480		3423.4177734375	  
osplit:		20483  		3482.1691158521703	20485		3387.187893580669 
osplit:		20480  		3480.79306640625	20480		3397.226904296875 
osplit:		20481  		3453.156291196719	20484		3492.1829720757664
kmem_unback:	172    		4407.302325581395	258		4458.069767441861 
kmem_unback:	264    		4112.325757575758	270		4063.1481481481483
kmem_unback:	266    		4170.845864661655	262		4108.553435114503 
kmem_unback:	270    		4224.303703703704	270		4222.65925925926  
kmem_unback:	264    		4365.159090909091	262		4328.293893129771 
kmem_unback:	270    		4245.27037037037	274		4221.510948905109 
kmem_unback:	264    		4258.784090909091	258		3496.5		  
kmem_unback:	268    		4200.190298507463	264		4192.632575757576 
kmem_unback:	296    		3526.875		268		4234.8432835820895
kmem_unback:	270    		4402.725925925926	266		4299.789473684211 
kmem_back:	913    		3907.9780941949616	1004		3955.609561752988 
kmem_back:	284    		3941.1514084507044	285		3422.305263157895 
kmem_back:	284    		4875.661971830986	218		4214.94495412844  
kmem_back:	272    		3776.720588235294	308		4152.048701298701 
kmem_back:	269    		4171.2342007434945	257		3394.2101167315177
kmem_back:	265    		3388.0830188679247	280		4126.689285714286 
kmem_back:	270    		4399.437037037037	273		3830.7875457875457
kmem_back:	282    		3696.195035460993	262		4268.274809160305 
kmem_back:	262    		3645.0648854961833	269		4769.011152416357 
kmem_back:	287    		4060.4599303135888	273		2565.197802197802 
alloc_stack:	304    		15916.572368421053	300		16141.62	  
alloc_stack:	4      		16613.0			0				  
alloc_stack:	0					6		19770.333333333332
alloc_stack:	0					6		15466.0		  
alloc_stack:	0					0				  
alloc_stack:	0					10		19306.6		  
alloc_stack:	0					4		16224.5		  
alloc_stack:	0					0				  
alloc_stack:	0					0				  
alloc_stack:	0					0

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dougm requested review of this revision.Fri, Feb 14, 9:48 PM
dougm created this revision.
This revision is now accepted and ready to land.Sat, Feb 15, 3:55 PM
sys/kern/subr_pctrie.c
828–831

Doesn't this comment need to be updated, since child is no longer a parameter?

dougm marked an inline comment as done.

Update the comment header on pctrie_remove().

This revision now requires review to proceed.Sat, Feb 15, 6:21 PM
This revision is now accepted and ready to land.Sun, Feb 16, 7:03 PM