On Mon, Mar 25, 2019 at 05:16:20PM -0700, Han Zhou wrote: > On Mon, Mar 25, 2019 at 4:57 PM Ben Pfaff <b...@ovn.org> wrote: > > > > I was seeing a lot of these messages, including a lot of them suppressed > > by rate-limiting, and I wondered whether any really big messages were > > being suppressed. By reporting the largest bucket, instead of just every > > large bucket, it becomes more likely that the truly too-large buckets get > > reported. > > > > (The problem I saw was a false alarm.) > > > > Signed-off-by: Ben Pfaff <b...@ovn.org> > > --- > > lib/hmap.c | 18 ++++++++++++------ > > 1 file changed, 12 insertions(+), 6 deletions(-) > > > > diff --git a/lib/hmap.c b/lib/hmap.c > > index 1ba4a5716a78..20161698af5d 100644 > > --- a/lib/hmap.c > > +++ b/lib/hmap.c > > @@ -1,5 +1,5 @@ > > /* > > - * Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015 Nicira, Inc. > > + * Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015, 2019 Nicira, Inc. > > * > > * Licensed under the Apache License, Version 2.0 (the "License"); > > * you may not use this file except in compliance with the License. > > @@ -103,6 +103,7 @@ resize(struct hmap *hmap, size_t new_mask, const char > > *where) > > tmp.buckets[i] = NULL; > > } > > } > > + int max_count = 0; > > for (i = 0; i <= hmap->mask; i++) { > > struct hmap_node *node, *next; > > int count = 0; > > @@ -111,15 +112,20 @@ resize(struct hmap *hmap, size_t new_mask, const char > > *where) > > hmap_insert_fast(&tmp, node, node->hash); > > count++; > > } > > - if (count > 5) { > > - static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, > > 10); > > - COVERAGE_INC(hmap_pathological); > > - VLOG_DBG_RL(&rl, "%s: %d nodes in bucket (%"PRIuSIZE" nodes, > > %"PRIuSIZE" buckets)", > > - where, count, hmap->n, hmap->mask + 1); > > + if (count > max_count) { > > + max_count = count; > > } > > } > > hmap_swap(hmap, &tmp); > > hmap_destroy(&tmp); > > + > > + if (max_count > 5) { > > + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, 10); > > + COVERAGE_INC(hmap_pathological); > > + VLOG_DBG_RL(&rl, "%s: %d nodes in bucket " > > + "(%"PRIuSIZE" nodes, %"PRIuSIZE" buckets)", > > + where, max_count, hmap->n, hmap->mask + 1); > > + } > > } > > Would it be more helpful in the same log print out how many buckets > has count > 5? For example, 1 entry with count = 10 maybe is not a big > deal, but too many entries with count > 5 may indicate bad hashing. > The new log may not tell this information.
Good idea, I sent out a v2. _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev