From: Peter Zijlstra <peterz@infradead.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
g@hirez.programming.kicks-ass.net
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, x86@kernel.org,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 1/5] kernel/jump_label: abstract jump_entry member accessors
Date: Thu, 28 Jun 2018 10:40:02 +0200 [thread overview]
Message-ID: <20180628084002.GZ2494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180627160604.8154-2-ard.biesheuvel@linaro.org>
On Wed, Jun 27, 2018 at 06:06:00PM +0200, Ard Biesheuvel wrote:
> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index 01ebdf1f9f40..c3524c9b3004 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -38,10 +38,12 @@ static int jump_label_cmp(const void *a, const void *b)
> const struct jump_entry *jea = a;
> const struct jump_entry *jeb = b;
>
> - if (jea->key < jeb->key)
> + if ((unsigned long)jump_entry_key(jea) <
> + (unsigned long)jump_entry_key(jeb))
> return -1;
>
> - if (jea->key > jeb->key)
> + if ((unsigned long)jump_entry_key(jea) >
> + (unsigned long)jump_entry_key(jeb))
> return 1;
I think you can ditch the unsigned long cast and directly compare
pointers. That leads to much prettier code:
if (jump_entry_key(jea) < jump_entry_key(jeb))
return -1;
etc..
next prev parent reply other threads:[~2018-06-28 8:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 16:05 [PATCH 0/5] add support for relative references in jump tables Ard Biesheuvel
2018-06-27 16:06 ` [PATCH 1/5] kernel/jump_label: abstract jump_entry member accessors Ard Biesheuvel
2018-06-28 8:40 ` Peter Zijlstra [this message]
2018-06-27 16:06 ` [PATCH 2/5] kernel/jump_label: implement generic support for relative references Ard Biesheuvel
2018-06-28 8:50 ` Peter Zijlstra
2018-06-28 9:02 ` Ard Biesheuvel
2018-06-28 9:04 ` Ard Biesheuvel
2018-06-28 9:25 ` Peter Zijlstra
2018-06-28 9:29 ` Ard Biesheuvel
2018-06-28 9:37 ` Peter Zijlstra
2018-06-27 16:06 ` [PATCH 3/5] arm64/kernel: jump_label: switch to " Ard Biesheuvel
2018-06-28 9:17 ` Will Deacon
2018-06-27 16:06 ` [PATCH 4/5] x86: jump_label: switch to jump_entry accessors Ard Biesheuvel
2018-06-28 9:11 ` Peter Zijlstra
2018-06-28 9:14 ` Ard Biesheuvel
2018-06-27 16:06 ` [PATCH 5/5] x86/kernel: jump_table: use relative references Ard Biesheuvel
2018-06-28 8:31 ` Peter Zijlstra
2018-06-28 8:34 ` Ard Biesheuvel
2018-06-28 9:28 ` Peter Zijlstra
2018-07-02 5:14 ` [lkp-robot] [x86/kernel] b1ff47aace: WARNING:at_kernel/jump_label.c:#__jump_label_update kernel test robot
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=20180628084002.GZ2494@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ard.biesheuvel@linaro.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=g@hirez.programming.kicks-ass.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
--cc=x86@kernel.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
Powered by JetHome