public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] swsusp: misc cleanups [2/4]
Date: Sat, 23 Apr 2005 23:29:18 +0200	[thread overview]
Message-ID: <200504232329.18407.rjw@sisk.pl> (raw)
In-Reply-To: <200504232320.54477.rjw@sisk.pl>

The following patch removes the unnecessary functions does_collide_order().

This function is no longer necessary, as currently there are only 0-order
allocations in swsusp, and the use of it is confusing.

Please consider for applying.


Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

diff -Nurp a/kernel/power/swsusp.c b/kernel/power/swsusp.c
--- a/kernel/power/swsusp.c	2005-04-22 14:48:04.000000000 +0200
+++ b/kernel/power/swsusp.c	2005-04-23 21:39:57.000000000 +0200
@@ -929,21 +929,6 @@ int swsusp_resume(void)
 	return error;
 }
 
-/* More restore stuff */
-
-/*
- * Returns true if given address/order collides with any orig_address 
- */
-static int does_collide_order(unsigned long addr, int order)
-{
-	int i;
-	
-	for (i=0; i < (1<<order); i++)
-		if (!PageNosaveFree(virt_to_page(addr + i * PAGE_SIZE)))
-			return 1;
-	return 0;
-}
-
 /**
  *	On resume, for storing the PBE list and the image,
  *	we can only use memory pages that do not conflict with the pages
@@ -973,7 +958,7 @@ static unsigned long get_usable_page(uns
 	unsigned long m;
 
 	m = get_zeroed_page(gfp_mask);
-	while (does_collide_order(m, 0)) {
+	while (!PageNosaveFree(virt_to_page(m))) {
 		eat_page((void *)m);
 		m = get_zeroed_page(gfp_mask);
 		if (!m)
@@ -1061,7 +1046,7 @@ static struct pbe * swsusp_pagedir_reloc
 	/* Relocate colliding pages */
 
 	for_each_pb_page (pbpage, pblist) {
-		if (does_collide_order((unsigned long)pbpage, 0)) {
+		if (!PageNosaveFree(virt_to_page((unsigned long)pbpage))) {
 			m = (void *)get_usable_page(GFP_ATOMIC | __GFP_COLD);
 			if (!m) {
 				error = -ENOMEM;

-- 
- Would you tell me, please, which way I ought to go from here?
- That depends a good deal on where you want to get to.
		-- Lewis Carroll "Alice's Adventures in Wonderland"


  parent reply	other threads:[~2005-04-23 21:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-23 21:20 [PATCH] swsusp: misc cleanups [0/4] Rafael J. Wysocki
2005-04-23 21:25 ` [PATCH] swsusp: misc cleanups [1/4] Rafael J. Wysocki
2005-04-23 22:05   ` Pavel Machek
2005-04-23 21:29 ` Rafael J. Wysocki [this message]
2005-04-23 22:02   ` [PATCH] swsusp: misc cleanups [2/4] Pavel Machek
2005-04-23 21:34 ` [PATCH] swsusp: misc cleanups [3/4] Rafael J. Wysocki
2005-04-23 22:18   ` Pavel Machek
2005-04-24 10:41     ` Rafael J. Wysocki
2005-04-24 20:23       ` Pavel Machek
2005-04-23 21:38 ` [PATCH] swsusp: misc cleanups [4/4] Rafael J. Wysocki
2005-04-23 22:07   ` Pavel Machek
2005-04-24 10:30     ` Rafael J. Wysocki
2005-04-24 20:20       ` Pavel Machek
2005-04-24 10:57     ` Stefan Seyfried
2005-04-24 20:22       ` Pavel Machek
2005-04-24 20:43         ` Stefan Seyfried
2005-04-24 21:03           ` Pavel Machek
2005-04-23 21:58 ` [PATCH] swsusp: misc cleanups [0/4] Pavel Machek
2005-04-24 10:06   ` Rafael J. Wysocki

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=200504232329.18407.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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