[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHGf_=prxk+gJt8Xk_aZdVRcMLifw7jMYNfMb-h34FOEFuUO4g@mail.gmail.com>
Date: Tue, 4 Mar 2014 22:04:42 -0500
From: KOSAKI Motohiro <kosaki.motohiro@...il.com>
To: Miao Xie <miaox@...fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>,
Tang Chen <tangchen@...fujitsu.com>,
Benjamin LaHaise <bcrl@...ck.org>,
Al Viro <viro@...iv.linux.org.uk>,
Jeff Moyer <jmoyer@...hat.com>, guz.fnst@...fujitsu.com,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
linux-aio@...ck.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [Update PATCH 2/2] aio, mem-hotplug: Add memory barrier to aio
ring page migration.
>> + /*
>> + * Ensure that the page's data was copied from old one by
>> + * aio_migratepage().
>> + */
>> + smp_rmb();
>> +
>
> smp_read_barrier_depends() is better.
>
> "One could place an A smp_rmb() primitive between the pointer fetch and
> dereference. However, this imposes unneeded overhead on systems (such as
> i386, IA64, PPC, and SPARC) that respect data dependencies on the read side.
> A smp_read_barrier_depends() primitive has been added to the Linux 2.6 kernel
> to eliminate overhead on these systems."
> -- From Chapter 7.1 of <Memory Barriers: a Hardware View for Software Hackers>
> Written by Paul E. McKenney
>
Right.
The document of memory barrier described this situation.
see https://www.kernel.org/doc/Documentation/memory-barriers.txt
CPU 1 CPU 2
=============== ===============
{ M[0] == 1, M[1] == 2, M[3] = 3, P == 0, Q == 3 }
M[1] = 4;
<write barrier>
ACCESS_ONCE(P) = 1
Q = ACCESS_ONCE(P);
<data dependency barrier>
D = M[Q];
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists