[DTrace-devel] [PATCH 1/7] htab reduction: kernpath

Eugene Loh eugene.loh at oracle.com
Thu Oct 7 17:27:54 PDT 2021


Small nit:  it would seem that cmd/ctf_module_dump.c no longer needs to 
#define BUCKETS.  So that line can be removed.

Mostly, I have some higher level questions about why dtp->dt_nkernpaths 
and dtp->dt_kernpathlist are maintained.

It seems that dtp->dt_nkernpaths is used only to see if the htab is 
empty.  How about an htab function that just tells you at a minimum 
whether it's empty or more realistically how many nbuckets or entries 
there are.  Something like that.

Actually, to test whether we need to initialize dtp->dt_kernpaths, 
instead of checking dt_nkernpaths, how about simply checking 
dtp->dt_kernpaths!=NULL.

The other use of dt_nkernpaths is for destroying the kernpaths htab.  
This is apparently also the only reason that dtp->dt_kernpathlist is 
maintained.  Alternative solutions come to mind.  E.g., instead of 
maintaining dt_kernpathlist, how about dt_htab provides an iterator over 
its entries?  Or, probably better, just allow callers to specify a 
destructor (along with hval, cmp, etc.);  then have dt_htab_destroy() 
iterate over entries, calling the destructor, and finally destroying the 
htab?

Anyhow, I might be missing the big picture here, but those are the 
things I'm wondering.




More information about the DTrace-devel mailing list