Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1376850
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates |
| Date | 2016-04-12 16:30 +0200 |
| Message-ID | <rn7ui-ky-7@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <rlEb2-3RN-63@gated-at.bofh.it> <rlIHD-7v9-3@gated-at.bofh.it> <rmJUZ-6uN-9@gated-at.bofh.it> <rmOL0-1Jw-31@gated-at.bofh.it> <rmOL0-1Jw-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Apr 11, 2016 at 08:21:31PM +0200, Frederic Weisbecker wrote:
> On Mon, Apr 11, 2016 at 10:53:01AM -0400, Chris Metcalf wrote:
> > On 4/11/2016 9:18 AM, Frederic Weisbecker wrote:
> > >So I tried and it warns about the unused variable tickless_load, so I
> > >would need two scattered ifdeffery in the function:
> > >
> > >@@ -4528,7 +4529,9 @@ decay_load_missed(unsigned long load, unsigned long missed_updates, int idx)
> > > static void cpu_load_update(struct rq *this_rq, unsigned long this_load,
> > > unsigned long pending_updates)
> > > {
> > >+#ifdef CONFIG_NO_HZ_COMMON
> > > unsigned long tickless_load = this_rq->cpu_load[0];
> > >+#endif
> >
> > Just move the initialization down to the first use, as a regular
> > assignment, and add __maybe_unused to the declaration, and the compiler
> > will then keep quiet (see Documentation/CodingStyle).
> >
> > I have no comment on which of the approaches looks better overall,
> > but I think using __maybe_unused definitely improves this approach.
>
> I thought about it yeah. I usually avoid __maybe_unused because it's often
> a bad sign concerning the code layout.
>
> Now in this precise case I wouldn't mind though. Peter what's your opinion?
Sure, go with __maybe_unused.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/3] sched: Fix/improve nohz cpu load updates v2 Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-08 03:10 +0200
[PATCH 2/3] sched: Correctly handle nohz ticks cpu load accounting Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-08 03:10 +0200
Re: [PATCH 2/3] sched: Correctly handle nohz ticks cpu load accounting Peter Zijlstra <peterz@infradead.org> - 2016-04-08 11:50 +0200
Re: [PATCH 2/3] sched: Correctly handle nohz ticks cpu load accounting Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-08 15:00 +0200
Re: [PATCH 2/3] sched: Correctly handle nohz ticks cpu load accounting Peter Zijlstra <peterz@infradead.org> - 2016-04-08 19:50 +0200
[PATCH 1/3] sched: Gather cpu load functions under a more conventional namespace Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-08 03:10 +0200
[PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-08 03:10 +0200
Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Peter Zijlstra <peterz@infradead.org> - 2016-04-08 12:50 +0200
Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-08 15:00 +0200
Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Peter Zijlstra <peterz@infradead.org> - 2016-04-08 19:50 +0200
Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-11 15:20 +0200
Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Frederic Weisbecker <fweisbec@gmail.com> - 2016-04-11 20:30 +0200
Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Peter Zijlstra <peterz@infradead.org> - 2016-04-12 16:30 +0200
csiph-web