LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	David Rientjes <rientjes@google.com>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>,
	Steve Capper <steve.capper@linaro.org>
Subject: Re: [PATCH] mm/slub: fix lockups on PREEMPT && !SMP kernels
Date: Fri, 13 Mar 2015 11:29:23 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.11.1503131126550.13899@gentwo.org> (raw)
In-Reply-To: <1426261632-8911-1-git-send-email-mark.rutland@arm.com>

On Fri, 13 Mar 2015, Mark Rutland wrote:

>  	 */
> -	do {
> -		tid = this_cpu_read(s->cpu_slab->tid);
> -		c = raw_cpu_ptr(s->cpu_slab);
> -	} while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != c->tid));
> +	c = raw_cpu_ptr(s->cpu_slab);
> +	tid = READ_ONCE(c->tid);
>

Ok that works for the !SMP case. What about SMP and PREEMPT now?

And yes code like this was deemed safe for years and the race condition is
very subtle and difficult to trigger (also given that PREEMPT is rarely
used these days).


  reply	other threads:[~2015-03-13 16:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 15:47 Mark Rutland
2015-03-13 16:29 ` Christoph Lameter [this message]
2015-03-13 18:16   ` Mark Rutland
2015-03-13 18:27     ` Christoph Lameter
2015-03-16 12:45   ` [PATCHv2] " Mark Rutland
2015-03-17  1:09 ` [PATCH] " Joonsoo Kim
2015-03-17 12:00   ` Mark Rutland
2015-03-17 12:15     ` [PATCHv2] " Mark Rutland
2015-03-17 18:57       ` Christoph Lameter
2015-03-18  5:59       ` Joonsoo Kim
2015-03-18 15:21         ` Mark Rutland
2015-03-19 12:13           ` Joonsoo Kim
2015-03-19 16:16             ` Christoph Lameter
2015-03-24 14:17       ` Ville Syrjälä

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=alpine.DEB.2.11.1503131126550.13899@gentwo.org \
    --to=cl@linux.com \
    --cc=akpm@linux-foundation.org \
    --cc=brouer@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=steve.capper@linaro.org \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [PATCH] mm/slub: fix lockups on PREEMPT && '\!'SMP kernels' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).