[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120228081222.GE21106@elte.hu>
Date: Tue, 28 Feb 2012 09:12:22 +0100
From: Ingo Molnar <mingo@...e.hu>
To: John Stultz <john.stultz@...aro.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Eric Dumazet <eric.dumazet@...il.com>,
Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH 4/7] time: Update timekeeper structure using a local
shadow
* John Stultz <john.stultz@...aro.org> wrote:
> static void update_wall_time(void)
> {
> struct clocksource *clock;
> + struct timekeeper tk;
> cycle_t offset;
> int shift = 0, maxshift;
> unsigned long flags;
> @@ -1063,10 +1064,11 @@ static void update_wall_time(void)
> if (unlikely(timekeeping_suspended))
> goto out;
>
> - clock = timekeeper.clock;
> + tk = timekeeper;
'tk' is now an on-stack copy of a very non-trivial (read: large)
structure - including locks, amongst other things. That's a
no-no.
> + timekeeper = tk;
You just broke lockdep here.
It's also ugly code: global data structures should almost always
be updated in situ, instead of updating a local copy and then
copying it back blindly ...
Thanks,
Ingo
--
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