From: j-nomura@ce.jp.nec.com
To: linux-kernel@vger.kernel.org
Cc: j-nomura@ce.jp.nec.com
Subject: 2.4.18(19) swapcache oops
Date: Thu, 15 Aug 2002 21:39:29 +0900 (JST) [thread overview]
Message-ID: <20020815.213929.846960657.nomura@hpc.bs1.fc.nec.co.jp> (raw)
Hello,
I'm using 2.4.18 kernel and suspect there are swapcache race.
I looked into 2.4.19 patch but could not find the fix to it.
The race condition is described below.
Do you have any idea?
In the situation such as:
- two processes (process A and B) sharing memory space
- one of the pages in the space has been swapped out and
not remained in swapcache
- process A runs on cpu0, process B runs on cpu1
when process A reads the address corresponding to the page,
page fault occurs and the cpu0 reads swapped-out page into memory,
calls add_to_page_cache_unique() to add it to swapcache and then
calls lru_cache_add() to add it to lru list.
If process B reads the same address at that time, cpu1 calls
do_swap_page() and lookup_swap_cache() may succeed before cpu0
calls lru_cache_add() and cpu1 will set the page active by
following mark_page_accessed().
lru_cache_add() checks if the page is active and if it is active,
it calls BUG().
process A process B
cpu0 cpu1
-----------------------------------------------------------
do_swap_page()
spinunlock(mm->page_table_lock)
spinlock(mm->page_table_lock)
lookup_swap_cache()
read_swap_cache_async()
alloc_page()
add_to_swap_cache_unique()
__add_to_page_cache()
do_swap_page()
lookup_swap_cache()
mark_page_accessed()
lru_cache_add()
Best regards.
--
NOMURA, Jun'ichi <j-nomura@ce.jp.nec.com, nomura@hpc.bs1.fc.nec.co.jp>
HPC Operating System Group, 1st Computers Software Division,
Computers Software Operations Unit, NEC Solutions.
next reply other threads:[~2002-08-15 12:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-15 12:39 j-nomura [this message]
2002-08-15 14:32 ` Hugh Dickins
2002-08-15 20:05 ` Andrew Morton
2002-08-15 20:21 ` Andrew Morton
2002-08-16 4:19 ` j-nomura
2002-08-16 4:40 ` Andrew Morton
2002-08-16 8:07 ` j-nomura
2002-08-15 22:59 ` Hugh Dickins
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=20020815.213929.846960657.nomura@hpc.bs1.fc.nec.co.jp \
--to=j-nomura@ce.jp.nec.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®