[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180515184117.5fb0b7fa@gandalf.local.home>
Date: Tue, 15 May 2018 18:41:17 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Kees Cook <keescook@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
tcharding <me@...in.cc>
Subject: Re: [PATCH] vsprintf: Fix memory barriers of ptr_key to
have_filed_random_ptr_key
On Tue, 15 May 2018 15:31:37 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> > we could always do this:
>
> Ugh. I think I prefer the barriers.
But the ugliness is only at boot up, where the early printing is
important. The benefit of this is here:
@@ -1709,7 +1717,7 @@ static char *ptr_to_id(char *buf, char *end, void *ptr, struct printf_spec spec)
unsigned long hashval;
const int default_width = 2 * sizeof(ptr);
- if (unlikely(!have_filled_random_ptr_key)) {
+ if (static_branch_unlikely(¬_filled_random_ptr_key)) {
spec.field_width = default_width;
/* string length must be less than default_width */
return string(buf, end, "(ptrval)", spec);
Because not only do we not add any barriers, this code basically
becomes a nop once the ptr_key is filled, and this should have a small
speed up in execution (although I have not done any benchmarks).
-- Steve
Powered by blists - more mailing lists