MPTCP Linux Development
 help / color / mirror / Atom feed
From: Geliang Tang <geliang.tang@suse.com>
To: Florian Westphal <fw@strlen.de>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH RESEND mptcp-next v5 1/8] mptcp: add struct mptcp_sched_ops
Date: Thu, 24 Mar 2022 22:41:10 +0800	[thread overview]
Message-ID: <20220324144110.GA15636@localhost> (raw)
In-Reply-To: <20220324142753.GD24666@breakpoint.cc>

On Thu, Mar 24, 2022 at 03:27:53PM +0100, Florian Westphal wrote:
> Geliang Tang <geliang.tang@suse.com> wrote:
> > This patch added struct mptcp_sched_ops. And define the scheduler
> > register, unregister and find functions.
> 
> ... but why are they pernet?  Makes no sense to me, so an
> explanation would help.  Or, remove the pernet ops.
> 
> All callers pass &init_net, so I don't think there is any reason
> for pernet data structures here.

v4 used global list instead of pernet list:

https://patchwork.kernel.org/project/mptcp/patch/02c1d2d2eee134713737fe5c5f73127e8c741589.1647942374.git.geliang.tang@suse.com/

Should I go back to v4?

> 
> > +struct mptcp_sched_ops *mptcp_sched_find(const struct net *net,
> > +					 const char *name)
> > +{
> > +	struct sched_pernet *pernet = sched_get_pernet(net);
> > +	struct mptcp_sched_ops *sched, *ret = NULL;
> > +
> > +	spin_lock(&pernet->lock);
> > +	list_for_each_entry_rcu(sched, &pernet->sched_list, list) {
> > +		if (!strcmp(sched->name, name)) {
> > +			ret = sched;
> > +			break;
> > +		}
> > +	}
> > +	spin_unlock(&pernet->lock);
> > +
> 
> Locking isn't needed here if caller holds rcu read lock.
> 
> > +int mptcp_register_scheduler(const struct net *net,
> > +			     struct mptcp_sched_ops *sched)
> > +{
> > +	struct sched_pernet *pernet = sched_get_pernet(net);
> > +
> > +	if (!sched->get_subflow)
> > +		return -EINVAL;
> > +
> > +	if (mptcp_sched_find(net, sched->name))
> > +		return -EEXIST;
> > +
> > +	spin_lock(&pernet->lock);
> > +	list_add_tail_rcu(&sched->list, &pernet->sched_list);
> > +	spin_unlock(&pernet->lock);
> 
> I would use global list/lock, not pernet registration.
> I don't see a reason why that is needed, its just duplicate info.
> 
> > +void mptcp_unregister_scheduler(const struct net *net,
> > +				struct mptcp_sched_ops *sched)
> > +{
> > +	struct sched_pernet *pernet = sched_get_pernet(net);
> > +
> > +	spin_lock(&pernet->lock);
> > +	list_del_rcu(&sched->list);
> > +	spin_unlock(&pernet->lock);
> > +
> > +	synchronize_rcu();
> 
> Why synchronize_rcu()?  Comment please why that is needed, no freeing
> happens?
> 
> > +	struct sched_pernet *pernet = sched_get_pernet(net);
> > +	struct mptcp_sched_ops *sched;
> > +
> > +	spin_lock(&pernet->lock);
> > +	list_for_each_entry_rcu(sched, &pernet->sched_list, list)
> > +		list_del_rcu(&sched->list);
> > +	spin_unlock(&pernet->lock);
> > +
> > +	synchronize_rcu();
> 
> Same, why is it needed?
> 


  reply	other threads:[~2022-03-24 14:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 14:09 [PATCH RESEND mptcp-next v5 0/8] BPF packet scheduler Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 1/8] mptcp: add struct mptcp_sched_ops Geliang Tang
2022-03-24 14:27   ` Florian Westphal
2022-03-24 14:41     ` Geliang Tang [this message]
2022-03-24 15:03       ` Florian Westphal
2022-03-24 16:06         ` Geliang Tang
2022-03-24 17:08           ` Florian Westphal
2022-03-24 22:14   ` Mat Martineau
2022-03-24 23:30     ` Mat Martineau
2022-03-24 23:36       ` Mat Martineau
2022-03-25 16:30         ` Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 2/8] mptcp: register default scheduler Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 3/8] mptcp: add a new sysctl scheduler Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 4/8] mptcp: add sched in mptcp_sock Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 5/8] mptcp: add get_subflow wrapper Geliang Tang
2022-03-24 23:23   ` Mat Martineau
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 6/8] mptcp: add bpf_mptcp_sched_ops Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 7/8] selftests: bpf: add bpf_first scheduler Geliang Tang
2022-03-24 14:09 ` [PATCH RESEND mptcp-next v5 8/8] selftests: bpf: add bpf_first test Geliang Tang
2022-03-24 23:15 ` [PATCH RESEND mptcp-next v5 0/8] BPF packet scheduler Mat Martineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220324144110.GA15636@localhost \
    --to=geliang.tang@suse.com \
    --cc=fw@strlen.de \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox