From: Kanoj Sarcar <kanojsarcar@yahoo.com>
To: linux-mm@kvack.org
Subject: smp_rmb in mm/memory.c in 2.6.10
Date: Thu, 13 Jan 2005 12:26:42 -0800 (PST) [thread overview]
Message-ID: <20050113202642.68138.qmail@web14325.mail.yahoo.com> (raw)
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>
next reply other threads:[~2005-01-13 20:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 20:26 Kanoj Sarcar [this message]
2005-01-13 20:39 ` smp_rmb in mm/memory.c in 2.6.10 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
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=20050113202642.68138.qmail@web14325.mail.yahoo.com \
--to=kanojsarcar@yahoo.com \
--cc=linux-mm@kvack.org \
/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