summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorQingfang Deng <dqfext@gmail.com>2025-08-28 04:20:16 +0300
committerJakub Kicinski <kuba@kernel.org>2025-08-29 23:39:53 +0300
commit72cdc67e7fa74931b055df3a76852bab551f1a04 (patch)
tree2e62cddcf0bb3f7728f804c49151fe689d71ec59 /include/linux
parentd23ad54de795ec0054f90ecb03b41e8f2c410f3a (diff)
downloadlinux-72cdc67e7fa74931b055df3a76852bab551f1a04.tar.xz
pppoe: remove rwlock usage
Like ppp_generic.c, convert the PPPoE socket hash table to use RCU for lookups and a spinlock for updates. This removes rwlock usage and allows lockless readers on the fast path. - Mark hash table and list pointers as __rcu. - Use spin_lock() to protect writers. - Readers use rcu_dereference() under rcu_read_lock(). All known callers of get_item() already hold the RCU read lock, so no additional locking is needed. - get_item() now uses refcount_inc_not_zero() instead of sock_hold() to safely take a reference. This prevents crashes if a socket is already in the process of being freed (sk_refcnt == 0). - Set SOCK_RCU_FREE to defer socket freeing until after an RCU grace period. - Move skb_queue_purge() into sk_destruct callback to ensure purge happens after an RCU grace period. Signed-off-by: Qingfang Deng <dqfext@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250828012018.15922-1-dqfext@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/if_pppox.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index ff3beda1312c..db45d6f1c4f4 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -43,7 +43,7 @@ struct pppox_sock {
/* struct sock must be the first member of pppox_sock */
struct sock sk;
struct ppp_channel chan;
- struct pppox_sock *next; /* for hash table */
+ struct pppox_sock __rcu *next; /* for hash table */
union {
struct pppoe_opt pppoe;
struct pptp_opt pptp;