[DTrace-devel] [PATCH 3/7] htab: add dt_htab_insert_unique
Nick Alcock
nick.alcock at oracle.com
Wed Oct 13 05:19:30 PDT 2021
On 8 Oct 2021, Eugene Loh spake thusly:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
>
> Incidentally, an alternative to introducing new_bucket is, instead of
> setting new_bucket=1, just set no_dups=0. That is, the "no dups" flag
> becomes irrelevant if you're introducing a new bucket anyhow. Or,
> branch to "add:" only if no_dups==0. It just seems weird to be using
> both new_bucket and no_dups. But not a big deal. So ignore these
> suggestions if they strike you as worse than the problem.
Yep. I was trying not to change things too much.
Kris thinks I should just drop this entire commit since it's unused
anywhere. I don't think he's wrong.
> Also, though this is "unrelated" to the patch, I was wondering if you
> could explain the pre-existing code. We enter the insert function. We
> look for a match. If none, we'll add a bucket and therefore check the
> htab size. If needed, we resize the htab. At that point, we "retry."
> Why? If we failed to find a bucket the first time, why should we find
> one now? Or, are we rerunning the search merely for the side effect of
> recomputing idx?
The latter :) it avoids having to write the bucket search loop twice.
We're retrying the bucket search.
--
NULL && (void)
More information about the DTrace-devel
mailing list