[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1304722000.20980.130.camel@work-vm>
Date: Fri, 06 May 2011 15:46:40 -0700
From: john stultz <johnstul@...ibm.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Andi Kleen <andi@...stfloor.org>,
Thomas Gleixner <tglx@...utronix.de>,
lkml <linux-kernel@...r.kernel.org>,
Paul Mackerras <paulus@...ba.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Anton Blanchard <anton@...ba.org>, Ingo Molnar <mingo@...e.hu>
Subject: Re: [RFC] time: xtime_lock is held too long
On Sat, 2011-05-07 at 00:30 +0200, Eric Dumazet wrote:
> Le vendredi 06 mai 2011 à 13:24 -0700, john stultz a écrit :
>
> > So would the easier solution be to just break out timekeeper locking
> > from the xtime_lock?
> >
> > So basically we would just add a timekeeper.lock seqlock and use it to
> > protect only the timekeeping code? We can still keep xtime_lock around
> > for the tick/jiffies protection (well, until tglx kills jiffies :), but
> > gettimeofday and friends wouldn't be blocked for so long.
> >
> > That should be pretty straight forward now that the timekeeper data is
> > completely static to timkeeeping.c.
> >
>
> Yes :)
>
> 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.
> Meanwhile, a reader must wait that all writers are finished, because of
> all seqcount changes storm.
>
> Following patch helps. Of course we might find out why so many cpus (on
> my 8 cpus machine !) are calling tick_do_update_jiffies64() at the same
> time...
>
>
> This is basically what I said in my first mail :
>
> Separate logical sections to reduce windows where readers are blocked/spinning.
>
> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> index d5097c4..251b2fe 100644
> --- a/kernel/time/tick-sched.c
> +++ b/kernel/time/tick-sched.c
> @@ -56,7 +56,7 @@ static void tick_do_update_jiffies64(ktime_t now)
> return;
>
> /* 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.
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.
thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists