mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm: Fix nr_good_pages calculation
@ 2010-01-20 15:19 Jarkko Lavinen
  2010-01-21 15:13 ` Jarkko Lavinen
  2010-01-31 15:57 ` Hugh Dickins
  0 siblings, 2 replies; 3+ messages in thread
From: Jarkko Lavinen @ 2010-01-20 15:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-31 15:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-20 15:19 [PATCH] mm: Fix nr_good_pages calculation Jarkko Lavinen
2010-01-21 15:13 ` Jarkko Lavinen
2010-01-31 15:57 ` Hugh Dickins

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®