[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190415115045.GL11158@hirez.programming.kicks-ass.net>
Date: Mon, 15 Apr 2019 13:50:45 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Daniel Bristot de Oliveira <bristot@...hat.com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
"Steven Rostedt (VMware)" <rostedt@...dmis.org>,
Jiri Kosina <jkosina@...e.cz>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Chris von Recklinghausen <crecklin@...hat.com>,
Jason Baron <jbaron@...mai.com>, Scott Wood <swood@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Clark Williams <williams@...hat.com>, x86@...nel.org
Subject: Re: [PATCH V5 6/7] jump_label: Batch updates if arch supports it
On Mon, Apr 01, 2019 at 10:58:18AM +0200, Daniel Bristot de Oliveira wrote:
> +int fallback_batch __read_mostly;
> +static void __jump_label_update(struct static_key *key,
> + struct jump_entry *entry,
> + struct jump_entry *stop,
> + bool init)
> +{
> + for_each_label_entry(key, entry, stop) {
> +
> + if (!jump_label_can_update(entry, init))
> + continue;
> +
> + if (unlikely(fallback_batch)) {
> + arch_jump_label_transform(entry, jump_label_type(entry));
> + continue;
> + }
> +
> + if (!arch_jump_label_transform_queue(entry, jump_label_type(entry)))
> + continue;
That reads wrong; 'if we cannot queue, continue'
> +
> + /*
> + * Queue's overflow: Apply the current queue, and then try to
> + * queue again. If it stills fail to queue, fallback to the
> + * non-batch mode!
> + */
> + arch_jump_label_transform_apply();
> +
> + if (arch_jump_label_transform_queue(entry, jump_label_type(entry))) {
> + WARN(1, "jump_label: batch mode failure!\n");
> + fallback_batch = 1;
> + arch_jump_label_transform(entry, jump_label_type(entry));
> + }
> + }
> + arch_jump_label_transform_apply();
> +}
Hurmph...
for_each_whatever(entry, stop, key) {
if (!jump_label_can_update(entry, init))
continue;
if (!arch_jump_label_transform_queue(entry)) {
/* queue full, flush */
arch_jump_label_transform_apply();
BUG_ON(!arch_jump_label_transform_queue(entry));
}
}
arch_jump_label_transform_apply();
Also, see next patch.
Powered by blists - more mailing lists