History

xskmap: Move non-standard list manipulation to helper

Add a helper in list.h for the non-standard way of clearing a list that is used in xskmap. This makes it easier to reuse it in the other map types, and also makes sure this usage is not forgotten in any list refactorings in the future.

Toke Høiland-Jørgensen committed 7 years ago

Commit c8af5cd1 parent 2d6dbb92 files · +15 −2Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/list.h+14−0
@@ -106,6 +106,20 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) · 105 unmodified lines
106106 WRITE_ONCE(prev->next, next);
107107 }
108108
109+/*
110+ * Delete a list entry and clear the 'prev' pointer.
111+ *
112+ * This is a special-purpose list clearing method used in the networking code
113+ * for lists allocated as per-cpu, where we don't want to incur the extra
114+ * WRITE_ONCE() overhead of a regular list_del_init(). The code that uses this
115+ * needs to check the node 'prev' pointer instead of calling list_empty().
116+ */
117+static inline void __list_del_clearprev(struct list_head *entry)
118+{
119+ __list_del(entry->prev, entry->next);
120+ entry->prev = NULL;
121+}
122+
109123 /**
110124 * list_del - deletes entry from list.
111125 * @entry: the element to delete from the list.

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