)]}'
{
  "commit": "32b66b94c86f009b49668de7340f2ed65aad2dc5",
  "tree": "5fb422748dffb22866b703925f281935a34fe273",
  "parents": [
    "ea80d2afd285332fa88412c03d43e23d664f506f"
  ],
  "author": {
    "name": "Qi Wu",
    "email": "shijing.wuqi@linux.alibaba.com",
    "time": "Mon Nov 16 22:53:18 2026 +0800"
  },
  "committer": {
    "name": "Alexei Starovoitov",
    "email": "ast@kernel.org",
    "time": "Tue Nov 17 05:18:49 2026 +0000"
  },
  "message": "bpf, mprog: Defer RCU synchronization until peer reuse\n\nbpf_mprog_attach() swaps the active entry and the caller then waits\nfor a grace period (tcx_entry_sync() / netkit_entry_sync()) before\nreturning. But attach releases nothing: the old entry only has to\nstay intact until the next attach or detach overwrites it as the\npeer. The unconditional wait buys nothing on the attach path, yet it\nruns inside rtnl_lock() and serializes the whole machine\u0027s network\ncontrol plane. Creating containers in bulk pays 2N grace periods for\nN devices, one first attach per direction.\n\nBorrow the scheme used by mini_qdisc_pair_swap() in commit 267463823adb\n(\"net: sch: eliminate unnecessary RCU waits in mini_qdisc_pair_swap()\"):\nrecord the grace-period state after the swap and only wait before the\nold buffer is written again. bpf_mprog_defer_sync() records\nstart_poll_synchronize_rcu() on the attach swap, bpf_mprog_peer() calls\ncond_synchronize_rcu() before returning the peer to be overwritten, and\na new bundle starts with get_completed_synchronize_rcu() so the first\nattach never waits. The state is recorded only on the attach swap, not\nin bpf_mprog_commit(): a detach or replace leaves it alone, so it does\nnot charge an extra grace period to the next change. This removes the\nattach-path sync from both tcx and netkit with no \u0027created\u0027 special\ncase, and covers a clsact qdisc having published the entry first.\n\nA/B on the same bpf-next base (8835113107b2), identical configs apart\nfrom LOCALVERSION, lock/RCU debugging off, 64 vCPU KVM guest. Average\noperation latency. The attach rows use 30 samples each. The detach\nrow measures close(link_fd), excluding the first detach in each run:\n35 samples across five runs of eight links.\n\n  scenario                 base        v3        speedup\n  first link attach        14.377 ms   268.4 us    54x\n  first prog attach        12.411 ms   290.0 us    43x\n  clsact qdisc first       11.562 ms   116.2 us    99x\n  detach after detach      6.2 ms     5.2 ms     ~1x\n\nAn attach waits only if the grace period recorded by an earlier\nattach swap has not completed. Detach after detach stays at the base\ncost: recording the cookie on every commit makes a detach following\nanother detach wait twice (N links cost 2N-1 grace periods rather\nthan N, measured 15.0 ms), because bpf_mprog_peer() charges the\nprevious commit\u0027s grace period to the next detach. Recording it only\non the attach swap avoids that.\n\nFunctional checks pass and a 300-cycle attach/detach churn under live\ntraffic shows no splats.\n\nBPF CI: https://github.com/kernel-patches/bpf/pull/14821 (39 passed,\n0 failed; x86_64 gcc-15/llvm-21, aarch64, s390x).\n\nThe implementation and measurement were produced with the help of an\nAI coding assistant; the change was reviewed by the submitter.\n\nSuggested-by: Alexei Starovoitov \u003calexei.starovoitov@gmail.com\u003e\nSigned-off-by: Qi Wu \u003cshijing.wuqi@linux.alibaba.com\u003e\nSigned-off-by: Alexei Starovoitov \u003cast@kernel.org\u003e\nLink: https://patch.msgid.link/20261116145318.34084-1-shijing.wuqi@linux.alibaba.com\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "82e608e733d9ee70f71c374570211c73da76ae2c",
      "old_mode": 33188,
      "old_path": "drivers/net/netkit.c",
      "new_id": "75a1a561e5aab84d6bdd9d159cded39b7a8ced96",
      "new_mode": 33188,
      "new_path": "drivers/net/netkit.c"
    },
    {
      "type": "modify",
      "old_id": "0b9f4caeeb0a327795b16ef16c4802aaaf13c14c",
      "old_mode": 33188,
      "old_path": "include/linux/bpf_mprog.h",
      "new_id": "2e180a43c8a081dc7eaf69dd18f3fc32ce7f619a",
      "new_mode": 33188,
      "new_path": "include/linux/bpf_mprog.h"
    },
    {
      "type": "modify",
      "old_id": "02db0113b8e7c63265c67223a695a066a87e5578",
      "old_mode": 33188,
      "old_path": "kernel/bpf/tcx.c",
      "new_id": "12a16200cb44598fc8785ccb649cfe10577db8d7",
      "new_mode": 33188,
      "new_path": "kernel/bpf/tcx.c"
    }
  ]
}
