Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1503262
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] early_printk: Add simple serialization to early_vprintk() |
| Date | 2016-10-18 20:00 +0200 |
| Message-ID | <stGQa-55X-7@gated-at.bofh.it> (permalink) |
| References | <stGdr-4O9-19@gated-at.bofh.it> <stGds-4O9-33@gated-at.bofh.it> <stGn7-4Sx-5@gated-at.bofh.it> <stGwN-4WW-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 18 Oct 2016 19:30:46 +0200
Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, Oct 18, 2016 at 01:19:51PM -0400, Steven Rostedt wrote:
> Looking at this again, we really should not spin using cmpxchg(), that
> thrashes the cacheline.
>
> The below is slightly better spinning... then again, this isn't
> performance code.
Yeah, this is similar to the hack I had.
May want to fold this in your previous version.
-- Steve
>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -376,10 +376,16 @@ static int early_vprintk(const char *fmt
>
> cpu = get_cpu();
> for (;;) {
> - old = cmpxchg(&early_printk_cpu, -1, cpu);
> - if (old == -1 || old == cpu)
> + old = READ_ONCE(early_printk_cpu);
> + if (old == cpu)
> break;
>
> + if (old == -1) {
> + old = cmpxchg(&early_printk_cpu, -1, cpu);
> + if (old == -1 || old == cpu)
> + break;
> + }
> +
> cpu_relax();
> }
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] make printk work again Peter Zijlstra <peterz@infradead.org> - 2016-10-18 19:20 +0200
[PATCH 1/3] printk: Fix kdb_trap_printk placement Peter Zijlstra <peterz@infradead.org> - 2016-10-18 19:20 +0200
Re: [PATCH 1/3] printk: Fix kdb_trap_printk placement Petr Mladek <pmladek@suse.com> - 2016-10-19 16:50 +0200
Re: [PATCH 1/3] printk: Fix kdb_trap_printk placement Peter Zijlstra <peterz@infradead.org> - 2016-10-19 17:20 +0200
Re: [PATCH 1/3] printk: Fix kdb_trap_printk placement Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-20 15:10 +0200
[PATCH 3/3] early_printk: Add simple serialization to early_vprintk() Peter Zijlstra <peterz@infradead.org> - 2016-10-18 19:20 +0200
Re: [PATCH 3/3] early_printk: Add simple serialization to early_vprintk() Steven Rostedt <rostedt@goodmis.org> - 2016-10-18 19:30 +0200
Re: [PATCH 3/3] early_printk: Add simple serialization to early_vprintk() Peter Zijlstra <peterz@infradead.org> - 2016-10-18 19:40 +0200
Re: [PATCH 3/3] early_printk: Add simple serialization to early_vprintk() Steven Rostedt <rostedt@goodmis.org> - 2016-10-18 20:00 +0200
[PATCH 2/3] early_printk: Add force_early_printk kernel parameter Peter Zijlstra <peterz@infradead.org> - 2016-10-18 19:20 +0200
Re: [PATCH 0/3] make printk work again Peter Zijlstra <peterz@infradead.org> - 2016-10-19 16:30 +0200
Re: [PATCH 0/3] make printk work again Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-19 16:30 +0200
Re: [PATCH 0/3] make printk work again Jan Kara <jack@suse.cz> - 2016-10-19 17:00 +0200
Re: [PATCH 0/3] make printk work again Peter Zijlstra <peterz@infradead.org> - 2016-10-19 18:20 +0200
csiph-web