All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vagin <avagin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: why this behavior in 3.16 kernel ?
Date: Wed, 3 Aug 2016 18:14:02 -0700	[thread overview]
Message-ID: <20160804011401.GA20044@gmail.com> (raw)
In-Reply-To: <877fbxhhfi.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>

On Wed, Aug 03, 2016 at 12:48:49PM -0500, Eric W. Biederman wrote:
> cool linux <linux.cool.hot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
> 
> > Hi,
> >
> > I have executed below script on 3.16 kernel and it took to finish almost
> > 1.30sec to 2 minutes, where as in my older kernel(3.2.30) it took only 3
> > secs.
> >
> > ================================================
> > date
> >
> > for (( i=1; i <= 2000; i++ ))
> > do
> >  ip netns exec gmk ip link show > /dev/null
> > done
> >
> > date
> > ================================================
> >
> > Please guide me why this behavior in 3.16 kernel ?
> 
> Good question.  What happens on a modern kernel? 4.7 is the most recent
> release, 3.16 was released two years ago.  My hunch is that you just
> started using systemd and it has changed the defaults with all of the
> mounts.  But shrug.  I don't recall how all of those relevant kernel
> pieces operated two years ago.

Hi,

I did a few experiments and saw the same degradation. I used rhel7 and
fedoara 23, they both uses systemd.

I executed this test on the rhel7 kernel (3.10++).
[ ~]# time for (( i=1; i <= 2000; i++ )); do ip netns exec gmk ip link show > /dev/null; done

real	0m4.837s
user	0m0.983s
sys	0m3.885s

Then I executed it in Fedora 23 (4.6.4-201.fc23.x86_64) in the same
hardware. The result time is much worse.
[ ~]# time for i in `seq 2000`; do ip netns exec gmk ip link show; done > /dev/null

real	0m36.067s
user	0m1.374s
sys	0m3.677s

Then I tried to exclude a mount namespace:
[ ~]# time for i in `seq 2000`; do nsenter --net=/run/netns/gmk ip link show; done > /dev/null

real	0m4.476s
user	0m1.039s
sys	0m3.438s

It helps, so the problem is defenetly about mount namespaces.

Then I tried to create a clean mount namespace, but this doesn't affect
results:
[ ~]# cat /proc/self/mountinfo 
84 83 253:0 / / rw,relatime - ext4 /dev/mapper/fedora-root rw,seclabel,data=ordered
90 84 0:4 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw
93 84 0:17 / /sys rw,nosuid,nodev,noexec,relatime - sysfs sysfs rw,seclabel
111 84 0:20 / /run rw,nosuid,nodev - tmpfs tmpfs rw,seclabel,mode=755

[ ~]# time for i in `seq 2000`; do ip netns exec gmk ip
link show; done > /dev/null

real	0m40.129s
user	0m1.272s
sys	0m3.898s

Then I boot the kernel with maxcpus=1. Surprise! Surprise! It works
fast.

[ ~]# ip netns add gmk
[ ~]# time for i in `seq 2000`; do ip netns exec gmk ip
link show; done > /dev/null

real	0m2.445s
user	0m0.604s
sys	0m1.778s


> 
> Eric
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers

  parent reply	other threads:[~2016-08-04  1:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 11:08 why this behavior in 3.16 kernel ? cool linux
     [not found] ` <CAJ5w2CmDcXzOKppojwN2F5H-mFu_OM-XUoTWnTuLKrdoPG9iQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-03 17:48   ` Eric W. Biederman
     [not found]     ` <877fbxhhfi.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2016-08-04  1:14       ` Andrew Vagin [this message]
     [not found]         ` <20160804011401.GA20044-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-04  6:21           ` Andrew Vagin
     [not found]             ` <20160804062150.GB14503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-04  7:19               ` cool linux
     [not found]                 ` <CAJ5w2C=u_sNP4-ZHm1HH=stU-8ngbPDFuY7JimWqYPesPajkMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-08-04 14:15                   ` 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=20160804011401.GA20044@gmail.com \
    --to=avagin-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.