linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Nick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>,
	linux-arch@vger.kernel.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Paul McKenney <paulmck@us.ibm.com>
Subject: Re: [patch 2/2] fix SMP data race in pagetable setup vs walking
Date: Mon, 5 May 2008 08:32:30 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0805050828120.32269@woody.linux-foundation.org> (raw)
In-Reply-To: <20080505121240.GD5018@wotan.suse.de>


On Mon, 5 May 2008, Nick Piggin wrote:
> 
> Index: linux-2.6/include/asm-x86/pgtable_32.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86/pgtable_32.h
> +++ linux-2.6/include/asm-x86/pgtable_32.h
> @@ -133,7 +133,12 @@ extern int pmd_bad(pmd_t pmd);
>   * pgd_offset() returns a (pgd_t *)
>   * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
>   */
> -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address)))
> +#define pgd_offset(mm, address)						\
> +({									\
> +	pgd_t *ret = ((mm)->pgd + pgd_index((address)));		\
> +	smp_read_barrier_depends(); /* see mm/memory.c:__pte_alloc */	\
> +	ret;								\
> +})

Is there some fundamental reason this needs to be a macro?

It is really ugly, and it would be much nicer to make this an inline 
function if at all possible.

Yeah, maybe it requires some more #include's, but ..

(Especially since it apparently gets worse, and the pgd load needs a 
ACCESS_ONCE() too - the code generated is the same, but the source gets 
more and more involved)

That said, I *also* think that it's sad that you do this at all, since 
smp_read_barrier_depends() is a no-op on x86, so why should we have it in 
an x86-specific header file?

In short, I think the fixes are real, but the patch itself is really just 
confusing things for no apparent good reason.

		Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2008-05-05 15:32 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-05 11:20 [patch 1/2] read_barrier_depends fixlets Nick Piggin
2008-05-05 12:12 ` [patch 2/2] fix SMP data race in pagetable setup vs walking Nick Piggin
2008-05-05 14:35   ` Paul E. McKenney
2008-05-06  9:38     ` Nick Piggin
2008-05-06 13:32       ` Paul E. McKenney
2008-05-13  7:55         ` Nick Piggin
2008-05-13 13:26           ` Paul E. McKenney
2008-05-05 15:32   ` Linus Torvalds [this message]
2008-05-05 16:37     ` Hugh Dickins
2008-05-06  9:51     ` Nick Piggin
2008-05-06 14:53       ` Linus Torvalds
2008-05-06 19:11         ` Paul E. McKenney
2008-05-14  4:27           ` Nick Piggin
2008-05-13  8:01         ` Nick Piggin
2008-05-13 15:45           ` Linus Torvalds
2008-05-14  0:34             ` Nick Piggin
2008-05-14  0:55               ` Linus Torvalds
2008-05-14  1:18                 ` Nick Piggin
2008-05-14  4:35                 ` [patch 1/2] read_barrier_depends arch fixlets Nick Piggin
2008-05-14  4:37                   ` [patch 2/2] fix SMP data race in pagetable setup vs walking Nick Piggin
2008-05-14 13:26                   ` [patch 1/2] read_barrier_depends arch fixlets Paul E. McKenney
2008-05-05 16:57   ` [patch 2/2] fix SMP data race in pagetable setup vs walking Hugh Dickins
2008-05-06  9:52     ` Nick Piggin
2008-05-06  7:08   ` David Miller, Nick Piggin
2008-05-06  9:56     ` Nick Piggin
2008-05-05 14:27 ` [patch 1/2] read_barrier_depends fixlets Paul E. McKenney
2008-05-06  9:01   ` Nick Piggin
2008-05-06 14:06     ` Paul E. McKenney
2008-05-06 15:29 ` David Howells
2008-05-06 19:09   ` Paul E. McKenney
2008-05-13  8:05   ` Nick Piggin

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.LFD.1.10.0805050828120.32269@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=hugh@veritas.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=paulmck@us.ibm.com \
    /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