Messages in this thread | | | Date | Tue, 15 May 2018 18:41:17 -0400 | From | Steven Rostedt <> | 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@linux-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
| |