public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: john stultz <johnstul@us.ibm.com>,
	Andi Kleen <andi@firstfloor.org>,
	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: Thu, 5 May 2011 17:59:39 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1105051750540.3005@ionos> (raw)
In-Reply-To: <1304608095.3032.95.camel@edumazet-laptop>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2114 bytes --]

On Thu, 5 May 2011, Eric Dumazet wrote:

> Le jeudi 05 mai 2011 à 16:39 +0200, Thomas Gleixner a écrit :
> > On Thu, 5 May 2011, Eric Dumazet wrote:
> > 
> > > I feel xtime_lock seqlock is abused these days.
> > > 
> > > seqlock abstraction is somewhat lazy/dangerous because write_sequnlock()
> > > does both the seqcount increment and spinlock release.
> > > 
> > > I am concerned by fact that readers might wait for long times, because
> > > writers hold the whole seqlock, while sometime they only want to guard
> > > other writers to come in.
> > > 
> > > Maybe it's time to separate the things (the seqcount and the spinlock)
> > > so that writer can manipulate data in different sections : 
> > > - Sections while holding spinlock, allowing "readers" to run
> > > - Very small sections enclosed in a pair of seqcount increments, to
> > > synchronize with readers.
> > 
> > Well, in the case of timekeeping that might be problematic. I'm not
> > sure whether we can calculate the new values under the spinlock and
> > then update the timekeeper under the seqlock because we might adjust
> > the mult/shift pair which then can result in observabcle time going
> > backwards problems. It might be worth a try, though. John ???
> >  
> > The only thing which really can move right away outside the xtime
> > seqlock region is calc_global_load().
> > 
> 
> That would be a start, but we also could have finer granularity in
> locks :
> 
> update_vsyscall() has its own protection and could be done outside of
> the seqcount inc pair used for ktime_get().

Yeah, we could move that out, but it might be interesting to add a few
tracepoints into update_wall_time() first to see which part takes the
most time.

> [ but my patch numbers were for a 32bit kernel, so vsyscall is not
> accounted for. ]

:)
 
> Another idea would be to prime cache lines to be dirtied in cpu cache
> before taking locks, and better pack variables to reduce number of cache
> lines.

Most variables are packed already in struct timekeeper, which should
be pretty cache hot anyway, so I don't know whether we gain much.

Thanks,

	tglx

  reply	other threads:[~2011-05-05 15:59 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 [this message]
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
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=alpine.LFD.2.02.1105051750540.3005@ionos \
    --to=tglx@linutronix.de \
    --cc=andi@firstfloor.org \
    --cc=anton@samba.org \
    --cc=eric.dumazet@gmail.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=paulus@samba.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