smpnotes

来自「桥接软件最新更新 桥接软件最新更新 桥接软件最新更新v」· 代码 · 共 22 行

TXT
22
字号
Notes on the (20000210) SMP-ization of the bridging code:Each bridge has a hash table of MAC addresses. This table is protectedby a rwlock hash_lock. The entries are refcounted; 'getting' an entryis done in the usual way: read_lock the table, find the entry,increment it's refcount and unlock the table. Bottom half contextacquires this lock in read as well as write mode, therefore we alwaysneed to locally disable BHs when acquiring this lock.Each bridge also has an rwlock called lock. This slightly misnamedlock protects the bridge's port_list. All stp code acquires this lockin read mode, the only piece of code that acquires this lock in writemode is the ioctl code (br_ioctl.c). Bottom halves never acquire thislock in write mode, therefore we can use read_lock instead ofread_lock_bh in all cases.All ioctls are globally serialized by the semaphore ioctl_mutex. Allcode which acquires the bridge lock in write mode also acquiresioctl_mutex. Therefore, if we have already grabbed ioctl_mutex wedon't need to read_lock the bridge lock anymore; the ioctl_mutex willprotect against concurrent writers.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?