LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Li Xiaodong" <lixd@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Subject: [PATCH]swap-zero-page-bug
Date: Wed, 29 Oct 2008 14:31:18 +0800	[thread overview]
Message-ID: <2C69C7D31680437FB174C65D043E2455@fujitsulixd> (raw)

[-- 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;
 }

             reply	other threads:[~2008-10-29  6:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-29  6:31 Li Xiaodong [this message]
2008-11-01 10:33 ` [PATCH]swap-zero-page-bug 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=2C69C7D31680437FB174C65D043E2455@fujitsulixd \
    --to=lixd@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH]swap-zero-page-bug' \
    /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

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).