From: Liu Ping Fan <kernelfans@gmail.com>
To: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hugh@veritas.com>
Subject: [PATCH] mm: swap: avoid to writepage when a page is !PageSwapCache
Date: Wed, 2 Jul 2014 11:42:53 +0800 [thread overview]
Message-ID: <1404272573-24448-1-git-send-email-pingfank@linux.vnet.ibm.com> (raw)
There is race between do_swap_page() and swap_writepage(), if
do_swap_page() had deleted a page from swap cache, there is no need
to write it. So changing the ret of try_to_free_swap() to make
swap_writepage() aware of this scene.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
mm/swapfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 4c524f7..9d80671 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -910,7 +910,7 @@ int try_to_free_swap(struct page *page)
VM_BUG_ON_PAGE(!PageLocked(page), page);
if (!PageSwapCache(page))
- return 0;
+ return -1;
if (PageWriteback(page))
return 0;
if (page_swapcount(page))
--
1.8.1.4
--
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:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2014-07-02 3:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 3:42 Liu Ping Fan [this message]
2014-07-02 4:29 ` [PATCH] mm: swap: avoid to writepage when a page is !PageSwapCache Hugh Dickins
2014-07-02 6:50 ` Liu ping fan
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=1404272573-24448-1-git-send-email-pingfank@linux.vnet.ibm.com \
--to=kernelfans@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.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;
as well as URLs for NNTP newsgroup(s).