Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

genetlink: use idr_alloc_cyclic for family->id assignment

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>

authored by

Marcel Holtmann and committed by
David S. Miller
4e43df38 88ef66a2

+2 -2
+2 -2
net/netlink/genetlink.c
··· 362 362 } else 363 363 family->attrbuf = NULL; 364 364 365 - family->id = idr_alloc(&genl_fam_idr, family, 366 - start, end + 1, GFP_KERNEL); 365 + family->id = idr_alloc_cyclic(&genl_fam_idr, family, 366 + start, end + 1, GFP_KERNEL); 367 367 if (family->id < 0) { 368 368 err = family->id; 369 369 goto errout_free;