You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the help of get_addr(), we can modify dump_addr() interfaces
to reuse send_nlmsg code between the netlink PM and userspace PM.
The current dump_addr() flow looks like this:
lock();
for_each_entry(entry)
send_nlmsg(entry);
unlock();
After holding the lock, get every entry by walking the address list,
send each one looply, and finally release the lock.
This set changes the process by copying the address list to an id
bitmap while holding the lock, then release the lock immediately.
After that, without locking, walking the copied id bitmap to get
every copy of entry by using get_addr(), and send each one looply:
lock();
for_each_entry(entry)
set_bit(bitmap);
unlock();
for_each_bit(bitmap) {
copy = get_addr();
send_nlmsg(copy);
}
With this, we can reuse the send_nlmsg() code in dump_addr() interfaces
between the netlink PM and userspace PM. They only need to implement
their own dump_addr() interfaces to hold the different locks, copy the
different address lists to an id bitmap, then release the locks.
Signed-off-by: Geliang Tang <[email protected]>
0 commit comments