summaryrefslogtreecommitdiff
path: root/include/uapi/linux/ip.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-11-02 02:33:29 +0300
committerJakub Kicinski <kuba@kernel.org>2021-11-02 02:33:29 +0300
commit8a75e30e6d473f6f63bc0ca9bdde6caa1563b6d0 (patch)
tree20453ce2f7741682aabd80e1c21c2db8c8562680 /include/uapi/linux/ip.h
parent047304d0bfa5be2ace106974f87eec51e0832cd0 (diff)
parentf1a456f8f3fc5828d8abcad941860380ae147b1d (diff)
downloadlinux-8a75e30e6d473f6f63bc0ca9bdde6caa1563b6d0.tar.xz
Merge branch 'accurate-memory-charging-for-msg_zerocopy'
Talal Ahmad says: ==================== Accurate Memory Charging For MSG_ZEROCOPY This series improves the accuracy of msg_zerocopy memory accounting. At present, when msg_zerocopy is used memory is charged twice for the data - once when user space allocates it, and then again within __zerocopy_sg_from_iter. The memory charging in the kernel is excessive because data is held in user pages and is never actually copied to skb fragments. This leads to incorrectly inflated memory statistics for programs passing MSG_ZEROCOPY. We reduce this inaccuracy by introducing the notion of "pure" zerocopy SKBs - where all the frags in the SKB are backed by pinned userspace pages, and none are backed by copied pages. For such SKBs, tracked via the new SKBFL_PURE_ZEROCOPY flag, we elide sk_mem_charge/uncharge calls, leading to more accurate accounting. However, SKBs can also be coalesced by the stack at present, potentially leading to "impure" SKBs. We restrict this coalescing so it can only happen within the sendmsg() system call itself, for the most recently allocated SKB. While this can lead to a small degree of double-charging of memory, this case does not arise often in practice for workloads that set MSG_ZEROCOPY. Testing verified that memory usage in the kernel is lowered. Instrumentation with counters also showed that accounting at time charging and uncharging is balanced. ==================== Link: https://lore.kernel.org/r/20211030020542.3870542-1-mailtalalahmad@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/uapi/linux/ip.h')
0 files changed, 0 insertions, 0 deletions