On Tue, Oct 5, 2021 at 9:39 AM Numan Siddique <[email protected]> wrote: > > On Mon, Oct 4, 2021 at 5:34 AM Anton Ivanov > <[email protected]> wrote: > > > > > > On 04/10/2021 02:37, Han Zhou wrote: > > > Although not used currently, it is better to fix: > > > 1. The type of the mask field should be the same as hmap->mask: size_t. > > > 2. Calculating the index is better to use & instead of %. > > > > > > Signed-off-by: Han Zhou <[email protected]> > > > --- > > > lib/ovn-parallel-hmap.h | 6 +++--- > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > diff --git a/lib/ovn-parallel-hmap.h b/lib/ovn-parallel-hmap.h > > > index 2df132ea8..897208ef8 100644 > > > --- a/lib/ovn-parallel-hmap.h > > > +++ b/lib/ovn-parallel-hmap.h > > > @@ -224,7 +224,7 @@ static inline void wait_for_work_completion(struct worker_pool *pool) > > > */ > > > > > > struct hashrow_locks { > > > - ssize_t mask; > > > + size_t mask; > > > struct ovs_mutex *row_locks; > > > }; > > > > > > @@ -235,13 +235,13 @@ void ovn_update_hashrow_locks(struct hmap *lflows, struct hashrow_locks *hrl); > > > /* Lock a hash row */ > > > static inline void lock_hash_row(struct hashrow_locks *hrl, uint32_t hash) > > > { > > > - ovs_mutex_lock(&hrl->row_locks[hash % hrl->mask]); > > > + ovs_mutex_lock(&hrl->row_locks[hash & hrl->mask]); > > > } > > > > > > /* Unlock a hash row */ > > > static inline void unlock_hash_row(struct hashrow_locks *hrl, uint32_t hash) > > > { > > > - ovs_mutex_unlock(&hrl->row_locks[hash % hrl->mask]); > > > + ovs_mutex_unlock(&hrl->row_locks[hash & hrl->mask]); > > > } > > > > > > /* Init the row locks structure */ > > > > +1. > > Acked-by: Numan Siddique <[email protected]> > Thanks Anton and Numan. I applied it to the main branch.
> Numan > > > > > -- > > Anton R. Ivanov > > Cambridgegreys Limited. Registered in England. Company Number 10273661 > > https://www.cambridgegreys.com/ > > > > _______________________________________________ > > dev mailing list > > [email protected] > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
