netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [Patch net-next v2] pktgen: support net namespace
Date: Tue, 29 Jan 2013 11:54:37 +0800	[thread overview]
Message-ID: <1359431677.20729.18.camel@cr0> (raw)
In-Reply-To: <877gmwirx5.fsf@xmission.com>

On Mon, 2013-01-28 at 19:33 -0800, Eric W. Biederman wrote:
> Cong Wang <amwang@redhat.com> writes:
> 
> > On Mon, 2013-01-28 at 18:36 -0800, Eric W. Biederman wrote:
> >> Cong Wang <amwang@redhat.com> writes:
> >> 
> >> > From: Cong Wang <amwang@redhat.com>
> >> >
> >> > v2: remove a useless check
> >> >
> >> > This patch add net namespace to pktgen, so that
> >> > we can use pktgen in different namespaces.
> >> >
> >> > Cc: Eric W. Biederman <ebiederm@xmission.com>
> >> > Cc: David S. Miller <davem@davemloft.net>
> >> > Signed-off-by: Cong Wang <amwang@redhat.com>
> >> >
> >> > ---
> >> >  net/core/pktgen.c |  123 +++++++++++++++++++++++++++++++++++------------------
> >> >  1 files changed, 81 insertions(+), 42 deletions(-)
> >> 
> >> Skiming through this again I have spotted what looks like a pretty
> >> major bug.  You are limiting yourself to one network device per network
> >> namespace when the actual limit is one network device per thread.
> >> 
> >> I think you can just kill the dev member of pktgen_net and the two or
> >> three lines of code that touch it.
> >
> > Good point!
> >
> > It is used by pktgen_device_event() to check if the device generates the
> > event is the one in our namespace.
> 
> Which of course is trivial with dev_net()...;
> 
> > It is safe to continue the search even if it is not in our namespace,
> > but it is not efficient. Probably we need to make pktgen_threads list
> > per-namespace.
> 
> Having looked at the code a bit more I think the solution really is to
> make the proc files per network namespace as you are doing, but to leave
> the threads per cpu.  Then it is just a matter of adding for_each_net
> loops in the in the paths that add and remove the proc files.

Hmm?

pktgen creates each thread/proc file for each cpu, since proc files are
per-namespace, we will have nr_cpu*nr_ns such proc files and threads.

It hard to improve this due to this kind of design.

I already finished v3 patch which makes pktgen_threads list per-ns, so
far it works well. I am still testing it.

  reply	other threads:[~2013-01-29  3:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29  1:53 [Patch net-next v2] pktgen: support net namespace Cong Wang
2013-01-29  2:36 ` Eric W. Biederman
2013-01-29  3:02   ` Cong Wang
2013-01-29  3:33     ` Eric W. Biederman
2013-01-29  3:54       ` Cong Wang [this message]
2013-01-29  4:17         ` Eric W. Biederman

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=1359431677.20729.18.camel@cr0 \
    --to=amwang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).