All of lore.kernel.org
 help / color / mirror / Atom feed
* why this behavior in 3.16 kernel ?
@ 2016-08-03 11:08 cool linux
       [not found] ` <CAJ5w2CmDcXzOKppojwN2F5H-mFu_OM-XUoTWnTuLKrdoPG9iQg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: cool linux @ 2016-08-03 11:08 UTC (permalink / raw)
  To: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

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 ?

Regards,
Madhu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why this behavior in 3.16 kernel ?
       [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>
  0 siblings, 1 reply; 6+ messages in thread
From: Eric W. Biederman @ 2016-08-03 17:48 UTC (permalink / raw)
  To: cool linux; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

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.

Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why this behavior in 3.16 kernel ?
       [not found]     ` <877fbxhhfi.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
@ 2016-08-04  1:14       ` Andrew Vagin
       [not found]         ` <20160804011401.GA20044-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Vagin @ 2016-08-04  1:14 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why this behavior in 3.16 kernel ?
       [not found]         ` <20160804011401.GA20044-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-08-04  6:21           ` Andrew Vagin
       [not found]             ` <20160804062150.GB14503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Vagin @ 2016-08-04  6:21 UTC (permalink / raw)
  To: cool linux
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Eric W. Biederman

On Wed, Aug 03, 2016 at 06:14:02PM -0700, Andrew Vagin wrote:
> 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.
> 

[snip]

> [ ~]# 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

This degradations is due to synchronize_rcu() in namespace_unlock(),
which was added in 48a066e72d9 ("RCU'd vfsmounts").

Here is timings for all calls during sys_unshare():
https://gist.github.com/avagin/3811fbbb553795a78fc6ae602f86866a

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why this behavior in 3.16 kernel ?
       [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>
  0 siblings, 1 reply; 6+ messages in thread
From: cool linux @ 2016-08-04  7:19 UTC (permalink / raw)
  To: Andrew Vagin
  Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	Eric W. Biederman

Hi Eric/Andrew,

Thanks for your response.

I have commented out the synchronize_rcu()  in namespace_unlock() which is
located in /fs/namespace.c namespace_unlock()

now am able to see the result in fraction of seconds.

Regards
Madhu

On Thu, Aug 4, 2016 at 11:51 AM, Andrew Vagin <avagin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> On Wed, Aug 03, 2016 at 06:14:02PM -0700, Andrew Vagin wrote:
> > 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.
> >
>
> [snip]
>
> > [ ~]# 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
>
> This degradations is due to synchronize_rcu() in namespace_unlock(),
> which was added in 48a066e72d9 ("RCU'd vfsmounts").
>
> Here is timings for all calls during sys_unshare():
> https://gist.github.com/avagin/3811fbbb553795a78fc6ae602f86866a
>
> >
> >
> > >
> > > Eric
> > > _______________________________________________
> > > Containers mailing list
> > > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> > > https://lists.linuxfoundation.org/mailman/listinfo/containers
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: why this behavior in 3.16 kernel ?
       [not found]                 ` <CAJ5w2C=u_sNP4-ZHm1HH=stU-8ngbPDFuY7JimWqYPesPajkMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-08-04 14:15                   ` Eric W. Biederman
  0 siblings, 0 replies; 6+ messages in thread
From: Eric W. Biederman @ 2016-08-04 14:15 UTC (permalink / raw)
  To: cool linux; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

cool linux <linux.cool.hot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hi Eric/Andrew,
>
> Thanks for your response.
>
> I have commented out the synchronize_rcu() in namespace_unlock() which is
> located in /fs/namespace.c namespace_unlock() 
>
> now am able to see the result in fraction of seconds.

Interesting.   So it is just the fact you are serializing things in the
loop that makes things slow.

I would recommend syncrhonize_rcu_expidited but in this case since we
aren't holding a lock this is a case that looks like it will only show
up when testing (because things are needlessly serialized) and not in
the real world.

Eric

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-04 14:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
     [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

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.