Add copy-on-fork to get sys command
Subsystems (3)
v2 cover Add copy-on-fork to get sys command
This is the userspace part for the new copy-on-fork attribute added to the get sys netlink command.
The new attribute indicates that the kernel copies DMA pages on fork, hence fork support through madvise and MADV_DONTFORK is not needed.
Kernel series was merged:
https://lore.kernel.org/linux-rdma/[email protected]/
Changelog -v1->v2: https://lore.kernel.org/linux-rdma/[email protected]/
* Rebase kernel headers
* Print attributes on the same line
* Simplify if statement
Thanks
Gal Pressman (2):
rdma: update uapi headers
rdma: Add copy-on-fork to get sys command
rdma/include/uapi/rdma/rdma_netlink.h | 3 +++ rdma/sys.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.31.1
PATCH v2 1/2 rdma: update uapi headers
Update rdma_netlink.h file upto kernel commit6cc9e215eb27 ("RDMA/nldev: Add copy-on-fork attribute to get sys command")
--- rdma/include/uapi/rdma/rdma_netlink.h | 3 +++ 1 file changed, 3 insertions(+)
rdma/include/uapi/rdma/rdma_netlink.h +3 -0
@@ -546,6 +546,9 @@ enum rdma_nldev_attr {RDMA_NLDEV_ATTR_MIN_RANGE ,/* u32 */ RDMA_NLDEV_ATTR_MAX_RANGE ,/* u32 */ + + RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK, /* u8 */ +/* * Always the end */
Signature · 1 line
2.31.1
Re: [PATCH iproute2-next v2 1/2] rdma: update uapi headers
Quoted 8 lines · Gal Pressman
Update
rdma_netlink.hfile upto kernel commit6cc9e215eb27("RDMA/nldev: Add copy-on-fork attribute to get sys command")Signed-off-by Gal Pressman <[email protected]>--- rdma/include/uapi/rdma/rdma_netlink.h | 3 +++ 1 file changed, 3 insertions(+)
Thanks,
PATCH v2 2/2 rdma: Add copy-on-fork to get sys command
In reply to Gal PressmanThe new attribute indicates that the kernel copies DMA pages on fork, hence fork support through madvise and MADV_DONTFORK is not needed.
If the attribute is not reported (expected on older kernels), copy-on-fork is disabled.
Example:
$ rdma sys netns shared copy-on-fork on
--- rdma/sys.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
rdma/sys.c +10 -1
@@ -20,6 +20,7 @@ static const char *netns_modes_str[] = {static int sys_show_parse_cb (const struct nlmsghdr *nlh,void *data) {struct nlattr *tb[RDMA_NLDEV_ATTR_MAX ] = {}; +bool cof = false;mnl_attr_parse (nlh,0 , rd_attr_cb, tb);
@@ -35,9 +36,17 @@ static int sys_show_parse_cb(const struct nlmsghdr *nlh, void *data)else mode_str ="unknown" ; -print_color_string (PRINT_ANY ,COLOR_NONE ,"netns" ,"netns %s\n" , +print_color_string (PRINT_ANY ,COLOR_NONE ,"netns" ,"netns %s " , mode_str); } + +if (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK ]) + cof =mnl_attr_get_u8 (tb[RDMA_NLDEV_SYS_ATTR_COPY_ON_FORK ]); + +print_color_on_off (PRINT_ANY ,COLOR_NONE ,"copy-on-fork" , +"copy-on-fork %s\n" , + cof); +return MNL_CB_OK ; }
Signature · 1 line
2.31.1
Re: [PATCH iproute2-next v2 2/2] rdma: Add copy-on-fork to get sys command
Quoted 6 lines · Gal Pressman
The new attribute indicates that the kernel copies DMA pages on fork, hence fork support through madvise and
MADV_DONTFORKis not needed.If the attribute is not reported (expected on older kernels), copy-on-fork is disabled.
Quoted 9 lines
Example:
$ rdma sys netns shared copy-on-fork onSigned-off-by Gal Pressman <[email protected]>--- rdma/sys.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Thanks,
David Ahern
AppliedQuoted 17 lines · Gal Pressman
This is the userspace part for the new copy-on-fork attribute added to the get sys netlink command.
The new attribute indicates that the kernel copies DMA pages on fork, hence fork support through madvise and
MADV_DONTFORKis not needed.Kernel series was merged:
https://lore.kernel.org/linux-rdma/[email protected]/Changelog -
v1->v2: https://lore.kernel.org/linux-rdma/[email protected]/
* Rebase kernel headers
* Print attributes on the same line
* Simplify if statementThanks
Quoted 8 lines
Gal Pressman (2):
rdma: update uapi headers
rdma: Add copy-on-fork to get sys commandrdma/include/uapi/rdma/rdma_netlink.h | 3 +++ rdma/sys.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
applied to iproute2-next