pm misc cleanups
Subsystems (2)
Geliang Tang
reviewercover pm misc cleanups
From: Geliang Tang <[email protected]>
Resend two pm related cleanups.
The set "add sock_kmemdup helper" is accepted by upstream, so I think similar patch (patch 1, use kmemdup helper) is valid too.
Geliang Tang (2):
mptcp: pm: in-kernel: use kmemdup helper
mptcp: pm: use pm variable instead of msk->pm
net/mptcp/pm.c | 8 ++++---- net/mptcp/pm_kernel.c | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-)
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH 1/2 mptcp: pm: in-kernel: use kmemdup helper
From: Geliang Tang <[email protected]>
Instead of using kmalloc() or kzalloc() to allocate an entry and then immediately duplicate another entry to the newly allocated one, kmemdup() helper can be used to simplify the code.
--- net/mptcp/pm_kernel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/mptcp/pm_kernel.c +2 -4
@@ -710,11 +710,10 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk,return ret;/* address not found, add to local list */ - entry =kmalloc (sizeof (*entry),GFP_ATOMIC ); + entry =kmemdup (skc,sizeof (*skc),GFP_ATOMIC );if (!entry)return -ENOMEM ; - *entry = *skc; entry->addr.port =0 ; ret =mptcp_pm_nl_append_new_local_addr (pernet, entry, true, false);if (ret <0 )
@@ -817,13 +816,12 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info)return -EINVAL ; } - entry =kzalloc (sizeof (*entry),GFP_KERNEL_ACCOUNT ); + entry =kmemdup (&addr,sizeof (addr),GFP_KERNEL_ACCOUNT );if (!entry) {GENL_SET_ERR_MSG (info,"can't allocate addr" );return -ENOMEM ; } - *entry = addr;if (entry->addr.port) { ret =mptcp_pm_nl_create_listen_socket (skb->sk, entry);if (ret) {
Signature · 1 line
2.43.0
Geliang Tang
reviewerPATCH 2/2 mptcp: pm: use pm variable instead of msk->pm
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
The variable "pm" has been defined in mptcp_pm_fully_established() and mptcp_pm_data_reset() as "sk->pm", so use "pm" directly instead of using "sk->pm".
--- net/mptcp/pm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/mptcp/pm.c +4 -4
@@ -511,13 +511,13 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk)* be sure to serve this event only once. */ if (READ_ONCE (pm->work_pending) && - !(msk->pm.status &BIT (MPTCP_PM_ALREADY_ESTABLISHED ))) + !(pm->status &BIT (MPTCP_PM_ALREADY_ESTABLISHED )))mptcp_pm_schedule_work (msk,MPTCP_PM_ESTABLISHED ); -if ((msk->pm.status &BIT (MPTCP_PM_ALREADY_ESTABLISHED )) ==0 ) +if ((pm->status &BIT (MPTCP_PM_ALREADY_ESTABLISHED )) ==0 ) announce = true; - msk->pm.status |=BIT (MPTCP_PM_ALREADY_ESTABLISHED ); + pm->status |=BIT (MPTCP_PM_ALREADY_ESTABLISHED );spin_unlock_bh (&pm->lock);if (announce)
@@ -1009,7 +1009,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk)WRITE_ONCE (pm->addr_signal,0 );WRITE_ONCE (pm->remote_deny_join_id0, false); pm->status =0 ; -bitmap_fill (msk->pm.id_avail_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); +bitmap_fill (pm->id_avail_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); }void mptcp_pm_data_init (struct mptcp_sock *msk)
Signature · 1 line
2.43.0
Geliang Tang
reviewerRe: [PATCH mptcp-next v1 2/2] mptcp: pm: use pm variable instead of msk->pm
Hi Matt,
Quoted 5 lines · Geliang Tang
From: Geliang Tang <[email protected]>
The variable "pm" has been defined in
mptcp_pm_fully_established()andmptcp_pm_data_reset()as "sk->pm", so use "pm" directly instead of using "sk->pm".
This commit log needs to be updated. Should be "msk->pm", not "sk->pm". Please update this for me:
'''
and mptcp_pm_data_reset() as "msk->pm", so use "pm" directly instead of using "msk->pm".
'''
Thanks,
-Geliang
Quoted 40 lines
Signed-off-by Geliang Tang <[email protected]>---
net/mptcp/pm.c | 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)net/mptcp/pm.c +0
-0@@ -511,13 +511,13 @@ void mptcp_pm_fully_established(structmptcp_sock *msk, const struct sock *ssk) * be sure to serve this event only once. */ if (
READ_ONCE(pm->work_pending)&&net/mptcp/pm.c +1
-1- !(msk->pm.status & BIT(MPTCP_PM_ALREADY_ESTABLISHED))) + !(pm->status & BIT(MPTCP_PM_ALREADY_ESTABLISHED)))
mptcp_pm_schedule_work(msk, MPTCP_PM_ESTABLISHED);net/mptcp/pm.c +0
-1- if ((msk->pm.status & BIT(MPTCP_PM_ALREADY_ESTABLISHED)) ==0)
net/mptcp/pm.c +1
-0+if ((pm->status &BIT (MPTCP_PM_ALREADY_ESTABLISHED )) ==0 )announce = true;
net/mptcp/pm.c +1
-1- msk->pm.status |=BIT (MPTCP_PM_ALREADY_ESTABLISHED ); + pm->status |=BIT (MPTCP_PM_ALREADY_ESTABLISHED );
spin_unlock_bh(&pm->lock);
if (announce)net/mptcp/pm.c +1
-1@@ -1009,7 +1009,7 @@ void mptcp_pm_data_reset(struct mptcp_sock *msk) WRITE_ONCE(pm->addr_signal, 0); WRITE_ONCE(pm->remote_deny_join_id0, false); pm->status = 0; -bitmap_fill (msk->pm.id_avail_bitmap,MPTCP_PM_MAX_ADDR_ID + 1); +bitmap_fill (pm->id_avail_bitmap,MPTCP_PM_MAX_ADDR_ID +1 ); }
voidmptcp_pm_data_init(struct mptcp_sock *msk)
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v1 2/2] mptcp: pm: use pm variable instead of msk->pm
Hi Geliang,
Quoted 9 lines · Geliang Tang
Hi Matt,
Quoted 5 lines · Geliang Tang
From: Geliang Tang <[email protected]>
The variable "pm" has been defined in
mptcp_pm_fully_established()andmptcp_pm_data_reset()as "sk->pm", so use "pm" directly instead of using "sk->pm".
Quoted 7 lines
This commit log needs to be updated. Should be "
msk->pm", not "sk->pm". Please update this for me:'''
andmptcp_pm_data_reset()as "msk->pm", so use "pm" directly instead of using "msk->pm".
'''
Thanks, done:
- 568332d0da48: tg:msg: s/sk/msk/
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Geliang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal: Success! ✅
- KVM Validation: debug: Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/13649066260
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/88e393d9b0da
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=939900
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Resend two pm related cleanups.
The set "add
sock_kmemduphelper" is accepted by upstream, so I think similar patch (patch 1, use kmemdup helper) is valid too.
Thank you for the follow-up!
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Resend two pm related cleanups.
The set "add
sock_kmemduphelper" is accepted by upstream, so I think similar patch (patch 1, use kmemdup helper) is valid too.
Thank you for the patches, now in our tree (feat. for net-next):
New patches for t/upstream:
- ab6672511dbe: mptcp: pm: in-kernel: use kmemdup helper
- 84e8a48a2088: mptcp: pm: use pm variable instead of msk->pm
- Results: c6a94c37f925..9b16a0d6640c (export)
Tests are now in progress:
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.