[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140513105851.GA30445@twins.programming.kicks-ass.net>
Date: Tue, 13 May 2014 12:58:51 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Mel Gorman <mgorman@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Vlastimil Babka <vbabka@...e.cz>, Jan Kara <jack@...e.cz>,
Michal Hocko <mhocko@...e.cz>, Hugh Dickins <hughd@...gle.com>,
Dave Hansen <dave.hansen@...el.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Linux-FSDevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 04/19] mm: page_alloc: Use jump labels to avoid checking
number_of_cpusets
On Tue, May 13, 2014 at 10:45:35AM +0100, Mel Gorman wrote:
> +#ifdef HAVE_JUMP_LABEL
> +extern struct static_key cpusets_enabled_key;
> +static inline bool cpusets_enabled(void)
> +{
> + return static_key_false(&cpusets_enabled_key);
> +}
> +
> +/* jump label reference count + the top-level cpuset */
> +#define number_of_cpusets (static_key_count(&cpusets_enabled_key) + 1)
> +
> +static inline void cpuset_inc(void)
> +{
> + static_key_slow_inc(&cpusets_enabled_key);
> +}
> +
> +static inline void cpuset_dec(void)
> +{
> + static_key_slow_dec(&cpusets_enabled_key);
> +}
> +
> +static inline void cpuset_init_count(void) { }
> +
> +#else
> extern int number_of_cpusets; /* How many cpusets are defined in system? */
>
> +static inline bool cpusets_enabled(void)
> +{
> + return number_of_cpusets > 1;
> +}
> +
> +static inline void cpuset_inc(void)
> +{
> + number_of_cpusets++;
> +}
> +
> +static inline void cpuset_dec(void)
> +{
> + number_of_cpusets--;
> +}
> +
> +static inline void cpuset_init_count(void)
> +{
> + number_of_cpusets = 1;
> +}
> +#endif /* HAVE_JUMP_LABEL */
I'm still puzzled by the whole #else branch here, why not
unconditionally use the jump-label one? Without HAVE_JUMP_LABEL we'll
revert to a simple atomic_t counter, which should be perfectly fine, no?
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists