From: Jarkko Lavinen <jarkko.lavinen@nokia.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] mm: Fix nr_good_pages calculation
Date: Wed, 20 Jan 2010 17:19:12 +0200 [thread overview]
Message-ID: <20100120151912.GA27747@angel.research.nokia.com> (raw)
Swapon wastes one page of swap space to no effect.
Mkswap stores the value 'pages - 1' into last_page field, where pages is the
partition size in pages. When nr_good_pages is calculated, last_page + 1
should be used for the number of all the pages header included.
Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
---
mm/swapfile.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6c0585b..50d90ca 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1961,7 +1961,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
if (error)
goto bad_swap;
- nr_good_pages = swap_header->info.last_page -
+ nr_good_pages = swap_header->info.last_page + 1 -
swap_header->info.nr_badpages -
1 /* header page */;
--
1.6.5
next reply other threads:[~2010-01-20 15:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 15:19 Jarkko Lavinen [this message]
2010-01-21 15:13 ` Jarkko Lavinen
2010-01-31 15:57 ` 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=20100120151912.GA27747@angel.research.nokia.com \
--to=jarkko.lavinen@nokia.com \
--cc=akpm@osdl.org \
--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®