Skip to content

Commit 0def6e5

Browse files
q2venNipaLocal
authored and
NipaLocal
committed
checkpatch: Discourage a new use of rtnl_lock() variants.
rtnl_lock() is a "Big Kernel Lock" in the networking slow path and still serialises most of RTM_(NEW|DEL|SET)* rtnetlink requests. Commit 76aed95 ("rtnetlink: Add per-netns RTNL.") started a very large, in-progress, effort to make the RTNL lock scope per network namespace. However, there are still some patches that newly use rtnl_lock(), which is now discouraged, and we need to revisit it later. Let's warn about the case by checkpatch. The target functions are as follows: * rtnl_lock() * rtnl_trylock() * rtnl_lock_interruptible() * rtnl_lock_killable() and the warning will be like: WARNING: A new use of rtnl_lock() variants is discouraged, try to use rtnl_net_lock(net) variants torvalds#18: FILE: net/core/rtnetlink.c:79: + rtnl_lock(); Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> Signed-off-by: NipaLocal <nipa@local>
1 parent 856003d commit 0def6e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/checkpatch.pl

+6
Original file line numberDiff line numberDiff line change
@@ -6995,6 +6995,12 @@ sub process {
69956995
# }
69966996
# }
69976997

6998+
# A new use of rtnl_lock() is discouraged as it's being converted to rtnl_net_lock(net).
6999+
if ($line =~ /^\+.*\brtnl_(try)?lock(_interruptible|_killable)?\(\)/) {
7000+
WARN("rtnl_lock()",
7001+
"A new use of rtnl_lock() variants is discouraged, try to use rtnl_net_lock(net) variants\n" . $herecurr);
7002+
}
7003+
69987004
# strcpy uses that should likely be strscpy
69997005
if ($line =~ /\bstrcpy\s*\(/) {
70007006
WARN("STRCPY",

0 commit comments

Comments
 (0)