LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH]swap-zero-page-bug
@ 2008-10-29 6:31 Li Xiaodong
2008-11-01 10:33 ` [PATCH]swap-zero-page-bug Hugh Dickins
0 siblings, 1 reply; 2+ messages in thread
From: Li Xiaodong @ 2008-10-29 6:31 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 916 bytes --]
According to Documentation/filesystems/proc.txt, kernel should swap one page
as vm.page-cluster is 0, while it seems not like so in mm/swapfile.c:
...
int our_page_cluster = page_cluster;
...
if (!our_page_cluster) /* no readahead */
return 0;
...
It is better to remove that checkpoint.
Signed-off-by: Li Xiaodong<lixd@cn.fujitsu.com>
--- swapfile.c.orig 2008-10-29 21:29:36.000000000 +0800
+++ swapfile.c 2008-10-29 21:59:49.000000000 +0800
@@ -1810,9 +1810,6 @@
pgoff_t base, end;
int nr_pages = 0;
- if (!our_page_cluster) /* no readahead */
- return 0;
-
si = &swap_info[swp_type(entry)];
target = swp_offset(entry);
base = (target >> our_page_cluster) << our_page_cluster; @@ -1847,5
+1844,5 @@
* if only 1, say 0, since there's then no readahead to be done.
*/
*offset = ++toff;
- return nr_pages? ++nr_pages: 0;
+ return nr_pages ? ++nr_pages : nr_pages;
}
[-- Attachment #2: [PATCH]swap-zero-page-bug.patch --]
[-- Type: application/octet-stream, Size: 619 bytes --]
Signed-off-by: Li Xiaodong<lixd@cn.fujitsu.com>
--- swapfile.c.orig 2008-10-29 21:29:36.000000000 +0800
+++ swapfile.c 2008-10-29 21:59:49.000000000 +0800
@@ -1810,9 +1810,6 @@
pgoff_t base, end;
int nr_pages = 0;
- if (!our_page_cluster) /* no readahead */
- return 0;
-
si = &swap_info[swp_type(entry)];
target = swp_offset(entry);
base = (target >> our_page_cluster) << our_page_cluster;
@@ -1847,5 +1844,5 @@
* if only 1, say 0, since there's then no readahead to be done.
*/
*offset = ++toff;
- return nr_pages? ++nr_pages: 0;
+ return nr_pages ? ++nr_pages : nr_pages;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]swap-zero-page-bug
2008-10-29 6:31 [PATCH]swap-zero-page-bug Li Xiaodong
@ 2008-11-01 10:33 ` Hugh Dickins
0 siblings, 0 replies; 2+ messages in thread
From: Hugh Dickins @ 2008-11-01 10:33 UTC (permalink / raw)
To: Li Xiaodong; +Cc: linux-kernel
On Wed, 29 Oct 2008, Li Xiaodong wrote:
> According to Documentation/filesystems/proc.txt, kernel should swap one page
> as vm.page-cluster is 0, while it seems not like so in mm/swapfile.c:
> ...
> int our_page_cluster = page_cluster;
> ...
> if (!our_page_cluster) /* no readahead */
> return 0;
> ...
>
> It is better to remove that checkpoint.
No, page_cluster 0 allows swapin one page at a time, but disallows
swapin readahead (better named readaround) i.e. disallows reading
more than the one page actually requested.
Compare with how valid_swaphandles() is used from swapin_readahead():
there's actually one extra call to read_swap_cache_async() - because
we must ignore failure on the readaround but not on the page requested.
That "return 0" avoids the overhead of a pointlessly doubled
read_swap_cache_async() when there's only one page to be read.
Your patch might be needed if you'd found that swapin of one page
was not working at all - but you'd be making a stronger case if
you'd found that, I think!
Hugh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-01 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-29 6:31 [PATCH]swap-zero-page-bug Li Xiaodong
2008-11-01 10:33 ` [PATCH]swap-zero-page-bug Hugh Dickins
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).