From: john stultz <johnstul@us.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>,
Thomas Gleixner <tglx@linutronix.de>,
lkml <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Anton Blanchard <anton@samba.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [RFC] time: xtime_lock is held too long
Date: Fri, 06 May 2011 16:28:39 -0700 [thread overview]
Message-ID: <1304724519.20980.139.camel@work-vm> (raw)
In-Reply-To: <1304722835.2821.192.camel@edumazet-laptop>
On Sat, 2011-05-07 at 01:00 +0200, Eric Dumazet wrote:
> Le vendredi 06 mai 2011 à 15:46 -0700, john stultz a écrit :
> > On Sat, 2011-05-07 at 00:30 +0200, Eric Dumazet wrote:
> > > I can see many cpus entering tick_do_update_jiffies64() and all are
> > > calling write_seqlock(&xtime_lock);
> > >
> > > Only first one can perform the work, but all others are waiting on the
> > > spinlock, get it, change seqcount, and realize they have nothing to
> > > do...
> >
> > Huh. So who is calling tick_do_update_jiffies64 in your case? I know the
> > sched_tick_timer and tick_nohz_handler checks to make sure
> > tick_do_timer_cpu == cpu to avoid exactly the thundering heard problem
> > on the jiffies update.
> >
> > There's other spots that call tick_do_update_jiffies64, but I thought
> > those were more rare. So there may be something else wrong going on
> > here.
> >
>
> That I can answer :
[snip]
> (I added do_timestamp1/do_timestamp2) after/before write_seqlock()/write_sequnlock()
>
> <idle>-0 [003] 920.355377: do_timestamp1 <-tick_do_update_jiffies64
> <idle>-0 [006] 920.355377: tick_do_update_jiffies64 <-tick_sched_timer
> <idle>-0 [003] 920.355378: do_timestamp2 <-tick_do_update_jiffies64
> <idle>-0 [000] 920.355657: tick_do_update_jiffies64 <-tick_check_idle
> <idle>-0 [000] 920.355660: tick_do_update_jiffies64 <-tick_nohz_restart_sched_tick
Thomas, any clues why this would be getting hammered?
> > > /* Reevalute with xtime_lock held */
> > > - write_seqlock(&xtime_lock);
> > > + spin_lock(&xtime_lock.lock);
> >
> > Oof.. No, this is too ugly and really just abuses the seqlock structure.
> >
>
> That was a hack/POC, of course, but we can cleanup seqlock.h to provide
> clean thing. A seqlock_t should include a seqcount_t and a spinlock_t.
Maybe I'm misunderstanding, but you seem to be trying to create some
sort of a layered lock from the seqlock ? I don't quite understand why
your proposing this instead of actually splitting the lock out?
> > If you really want to untangle what xtime_lock protects, you need to
> > introduce a new lock (I suggest in the timekeeper structure) to protect
> > the timekeeping data.
> >
> > Then we can refine xtime_lock to also just protect the jiffies/tick
> > management bits as well if needed.
>
> For the moment I am trying to understand the code. Its quite complex and
> uses a monolithic seqlock, defeating seqlock power.
Defeating seqlock power? My thoughts are that seqlocks are nice
lightweight reader/writer locks that avoid writer starvation. You seem
to be trying to redefine or extend them to be something else which is
more subtle.
I agree, the code is complex! I'm just not sure adding more
complicated/subtle locking mechanisms is a good solution. Instead I'd
suggest simply splitting up the locks (by using new locks) to reduce the
amount of data that is being protected by a single lock.
But again, maybe I'm misunderstanding you?
thanks
-john
next prev parent reply other threads:[~2011-05-06 23:28 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 3:11 [PATCH] time: Add locking to xtime access in get_seconds() John Stultz
2011-05-04 3:52 ` Andi Kleen
2011-05-05 2:54 ` john stultz
2011-05-05 5:44 ` Eric Dumazet
2011-05-05 6:21 ` john stultz
2011-05-05 6:50 ` Eric Dumazet
2011-05-05 8:14 ` Paul E. McKenney
2011-05-05 18:51 ` john stultz
2011-05-05 14:04 ` [RFC] time: xtime_lock is held too long Eric Dumazet
2011-05-05 14:39 ` Thomas Gleixner
2011-05-05 15:08 ` Eric Dumazet
2011-05-05 15:59 ` Thomas Gleixner
2011-05-05 21:01 ` Andi Kleen
2011-05-06 1:41 ` Eric Dumazet
2011-05-06 6:55 ` Andi Kleen
2011-05-06 10:18 ` Thomas Gleixner
2011-05-06 10:22 ` Ingo Molnar
2011-05-06 16:53 ` Andi Kleen
2011-05-07 8:20 ` Ingo Molnar
2011-05-06 16:59 ` Andi Kleen
2011-05-06 17:09 ` Eric Dumazet
2011-05-06 17:17 ` Andi Kleen
2011-05-06 17:42 ` Eric Dumazet
2011-05-06 17:50 ` Andi Kleen
2011-05-06 19:26 ` Eric Dumazet
2011-05-06 20:04 ` Eric Dumazet
2011-05-06 20:24 ` john stultz
2011-05-06 22:30 ` Eric Dumazet
2011-05-06 22:46 ` john stultz
2011-05-06 23:00 ` Eric Dumazet
2011-05-06 23:28 ` john stultz [this message]
2011-05-07 5:02 ` Eric Dumazet
2011-05-07 7:11 ` Henrik Rydberg
2011-05-09 8:40 ` Thomas Gleixner
2011-05-12 9:13 ` [PATCH] seqlock: don't smp_rmb in seqlock reader spin loop, [PATCH] seqlock: don't smp_rmb in seqlock reader spin loop Milton Miller
2011-05-12 9:35 ` Eric Dumazet
2011-05-12 14:08 ` Andi Kleen
2011-05-06 20:18 ` [RFC] time: xtime_lock is held too long john stultz
2011-05-05 17:57 ` [PATCH] time: Add locking to xtime access in get_seconds() Andi Kleen
2011-05-05 20:17 ` john stultz
2011-05-05 20:24 ` Eric Dumazet
2011-05-05 20:40 ` john stultz
2011-05-05 20:43 ` Eric Dumazet
2011-05-05 20:56 ` Andi Kleen
2011-05-04 16:51 ` Max Asbock
2011-05-04 21:05 ` Andi Kleen
2011-05-04 23:05 ` john stultz
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=1304724519.20980.139.camel@work-vm \
--to=johnstul@us.ibm.com \
--cc=andi@firstfloor.org \
--cc=anton@samba.org \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulmck@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/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