linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* smp_rmb in mm/memory.c in 2.6.10
@ 2005-01-13 20:26 Kanoj Sarcar
  2005-01-13 20:39 ` William Lee Irwin III
  0 siblings, 1 reply; 21+ messages in thread
From: Kanoj Sarcar @ 2005-01-13 20:26 UTC (permalink / raw)
  To: linux-mm

Hi folks,
                                                      
                         
I am trying to understand the usage of smp_rmb() in
mm/memory.c in 2.6.10.
                                                      
                         
This is my understanding of the relevant parts of
do_no_page():
                                                      
                         
1. If vma is file backed, snapshot truncate_count
(without holding page_table_lock).
2. smp_rmb() makes sure the above snapshot is
complete.
3. nopage() then figures out the physical address of
the file page.
4. Get page_table_lock.
5. Reread truncate_count, and decide whether to retry
operation.

What I don't understand is that in step 1,
truncate_count is read without page_table_lock, but in
step 5, it is read with page_table_lock. A consistent
approach would seem to be either always snapshot
truncate_count with page_table_lock, and hence do away
with the smp_rmb() in step 2; or always snapshot
truncate_count without page_table_lock, in which case
do not grab page_table_lock in step 4, but rather do
another smp_rmb() (page_table_lock can be grabbed as
step 6). Isn't that reasonable?

The second question is that even though truncate_count
is declared atomic (ie probably volatile on most
architectures), that does not make gcc guarantee
anything in terms of ordering, right?

Finally, does anyone really believe that a smp_rmb()
is required in step 2? My logic is that nopage() is
guaranteed to grab/release (spin)locks etc as part of
its processing, and that would force the snapshots of
truncate_count to be properly ordered.

Thanks.
 
Kanoj




		
__________________________________ 
Do you Yahoo!? 
All your favorites on one personal page ? Try My Yahoo!
http://my.yahoo.com 
--
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:"aart@kvack.org"> aart@kvack.org </a>

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

end of thread, other threads:[~2005-01-14 23:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-13 20:26 smp_rmb in mm/memory.c in 2.6.10 Kanoj Sarcar
2005-01-13 20:39 ` William Lee Irwin III
2005-01-13 21:02   ` Kanoj Sarcar
2005-01-13 21:06     ` Andi Kleen
2005-01-13 21:29       ` Kanoj Sarcar
2005-01-13 21:59         ` Anton Blanchard
2005-01-13 23:22           ` Kanoj Sarcar
2005-01-14 20:37             ` Hugh Dickins
2005-01-14 21:14               ` Kanoj Sarcar
2005-01-14 21:38                 ` Andrea Arcangeli
2005-01-14 22:09                 ` Hugh Dickins
2005-01-14 22:34                   ` Andrea Arcangeli
2005-01-14 21:25               ` Andrea Arcangeli
2005-01-14 21:32                 ` Andrea Arcangeli
2005-01-14 22:22                   ` Kanoj Sarcar
2005-01-14 22:47                     ` Hugh Dickins
2005-01-14 22:51                     ` Andrea Arcangeli
2005-01-14 23:14                       ` Kanoj Sarcar
2005-01-14 23:26                         ` Andrea Arcangeli
2005-01-14 22:36                   ` Hugh Dickins
2005-01-14 23:01                     ` Andrea Arcangeli

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