mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
1 parent
88ef66a283
commit
4e43df38a2
1 file changed
+2
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user