Skip to contentSkip to conversation

genetlink: use idr_alloc_cyclic for family->id assignment

PATCH Applied Marcel Holtmann 2 participants 2 messages Apr 24, 2019 – Apr 26, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 net/netlink/genetlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netlink/genetlink.c +2 -2
index 288456090710..f1f2cbd7874e 100644
@@ -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;
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

From: Marcel Holtmann <[email protected]>
Date: Wed, 24 Apr 2019 22:18:53 +0200

Quoted 5 lines

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.

Applied, thanks Marcel.