History

genetlink: use idr to track families

Since generic netlink family IDs are small integers, allocated densely, IDR is an ideal match for lookups. Replace the existing hand-written hash-table with IDR for allocation and lookup. This lets the families only be written to once, during register, since the list_head can be removed and removal of a family won't cause any writes. It also slightly reduces the code size (by about 1.3k on x86-64).

Johannes Berg committed 10 years ago

Commit 2ae0f171 parent 489111e3 files · +123 −181Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/genetlink.h+2−0
@@ -29,6 +29,8 @@ struct genlmsghdr { · 28 unmodified lines
2929 #define GENL_ID_CTRL NLMSG_MIN_TYPE
3030 #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
3131 #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
32+/* must be last reserved + 1 */
33+#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3)
3234
3335 /**************************************************************************
3436 * Controller

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t