public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* thp and memory barrier assumptions
@ 2012-07-26 20:31 Peter Zijlstra
  2012-07-26 20:33 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2012-07-26 20:31 UTC (permalink / raw)
  To: Andrea Arcangeli, Rik van Riel
  Cc: Andrew Morton, paulmck, Oleg Nesterov, linux-kernel, Hugh Dickins


__do_huge_pmd_anonymous_page() contains:

                /*
                 * The spinlocking to take the lru_lock inside
                 * page_add_new_anon_rmap() acts as a full memory
                 * barrier to be sure clear_huge_page writes become
                 * visible after the set_pmd_at() write.
                 */
                page_add_new_anon_rmap(page, vma, haddr);


page_add_new_anon_rmap() doesn't look to actually do a LOCK+UNLOCK
except for unevictable pages.

But even if it did do an unconditional LOCK+UNLOCK that doesn't make a
full memory barrier, see Documentation/memory-barriers.txt.

In particular:

        *A = a;
        LOCK
        UNLOCK
        *B = b;

may occur as:

        LOCK, STORE *B, STORE *A, UNLOCK


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-03 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26 20:31 thp and memory barrier assumptions Peter Zijlstra
2012-07-26 20:33 ` Peter Zijlstra
2012-08-03 19:30   ` Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox