Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1603068
| Path | csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news.in-chemnitz.de!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | "Huang, Ying" <ying.huang@intel.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/5] mm, swap: Fix comment in __read_swap_cache_async |
| Date | Fri, 17 Mar 2017 07:50:01 +0100 |
| Message-ID | <tlTS1-20n-9@gated-at.bofh.it> (permalink) |
| X-Extloop1 | 1 |
| X-Ironport-Av | E=Sophos;i="5.36,175,1486454400"; d="scan'208";a="945345954" |
| X-Mailer | git-send-email 2.11.0 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 50 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Andi Kleen <ak@linux.intel.com>, Dave Hansen <dave.hansen@linux.intel.com>, Shaohua Li <shli@kernel.org>, Rik van Riel <riel@redhat.com>, Huang Ying <ying.huang@intel.com>, Rafael Aquini <aquini@redhat.com>, Tim Chen <tim.c.chen@linux.intel.com>, Michal Hocko <mhocko@suse.com>, Mel Gorman <mgorman@techsingularity.net>, Aaron Lu <aaron.lu@intel.com>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, Gerald Schaefer <gerald.schaefer@de.ibm.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Fri, 17 Mar 2017 14:46:19 +0800 |
| X-Original-Message-ID | <20170317064635.12792-1-ying.huang@intel.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1603068 |
Show key headers only | View raw
From: Huang Ying <ying.huang@intel.com>
The commit cbab0e4eec29 ("swap: avoid read_swap_cache_async() race to
deadlock while waiting on discard I/O completion") fixed a deadlock in
read_swap_cache_async(). Because at that time, in swap allocation
path, a swap entry may be set as SWAP_HAS_CACHE, then wait for
discarding to complete before the page for the swap entry is added to
the swap cache. But in the commit 815c2c543d3a ("swap: make swap
discard async"), the discarding for swap become asynchronous, waiting
for discarding to complete will be done before the swap entry is set
as SWAP_HAS_CACHE. So the comments in code is incorrect now. This
patch fixes the comments.
The cond_resched() added in the commit cbab0e4eec29 is not necessary
now too. But if we added some sleep in swap allocation path in the
future, there may be some hard to debug/reproduce deadlock bug. So it
is kept.
Cc: Shaohua Li <shli@kernel.org>
Cc: Rafael Aquini <aquini@redhat.com>
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
---
mm/swap_state.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 473b71e052a8..7bfb9bd1ca21 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -360,17 +360,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
/*
* We might race against get_swap_page() and stumble
* across a SWAP_HAS_CACHE swap_map entry whose page
- * has not been brought into the swapcache yet, while
- * the other end is scheduled away waiting on discard
- * I/O completion at scan_swap_map().
- *
- * In order to avoid turning this transitory state
- * into a permanent loop around this -EEXIST case
- * if !CONFIG_PREEMPT and the I/O completion happens
- * to be waiting on the CPU waitqueue where we are now
- * busy looping, we just conditionally invoke the
- * scheduler here, if there are some more important
- * tasks to run.
+ * has not been brought into the swapcache yet.
*/
cond_resched();
continue;
--
2.11.0
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/5] mm, swap: Fix comment in __read_swap_cache_async "Huang, Ying" <ying.huang@intel.com> - 2017-03-17 07:50 +0100
[PATCH 3/5] mm, swap: Avoid lock swap_avail_lock when held cluster lock "Huang, Ying" <ying.huang@intel.com> - 2017-03-17 08:00 +0100
[PATCH 4/5] mm, swap: Try kzalloc before vzalloc "Huang, Ying" <ying.huang@intel.com> - 2017-03-17 08:00 +0100
Re: [PATCH 4/5] mm, swap: Try kzalloc before vzalloc David Rientjes <rientjes@google.com> - 2017-03-17 10:00 +0100
Re: [PATCH 4/5] mm, swap: Try kzalloc before vzalloc Michal Hocko <mhocko@kernel.org> - 2017-03-17 12:50 +0100
[PATCH 5/5] mm, swap: Sort swap entries before free "Huang, Ying" <ying.huang@intel.com> - 2017-03-17 08:00 +0100
Re: [PATCH 1/5] mm, swap: Fix comment in __read_swap_cache_async Rafael Aquini <aquini@redhat.com> - 2017-03-17 13:50 +0100
Re: [PATCH 1/5] mm, swap: Fix comment in __read_swap_cache_async "Huang\, Ying" <ying.huang@intel.com> - 2017-03-20 03:10 +0100
csiph-web