Skip to content

Commit

Permalink
genetlink: use idr_alloc_cyclic for family->id assignment
Browse files Browse the repository at this point in the history
When allocating the next family->id it makes more sense to use
idr_alloc_cyclic to avoid re-using a previously used family->id as much
as possible.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Marcel Holtmann authored and David S. Miller committed Apr 26, 2019
1 parent 88ef66a commit 4e43df3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ int genl_register_family(struct genl_family *family)
} else
family->attrbuf = NULL;

family->id = idr_alloc(&genl_fam_idr, family,
start, end + 1, GFP_KERNEL);
family->id = idr_alloc_cyclic(&genl_fam_idr, family,
start, end + 1, GFP_KERNEL);
if (family->id < 0) {
err = family->id;
goto errout_free;
Expand Down

0 comments on commit 4e43df3

Please sign in to comment.