public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: akpm@zip.com.au, kernel list <linux-kernel@vger.kernel.org>
Subject: Hot/cold allocation -- swsusp can not handle hot pages
Date: Sat, 2 Nov 2002 19:19:00 +0100	[thread overview]
Message-ID: <20021102181900.GA140@elf.ucw.cz> (raw)

Hi!

Swsusp counts free pages, and relies on fact that when it allocates
page there's one free page less. That is no longer true with hot
pages.

I attempted to work it around but it seems I am getting hot pages even
when I ask for cold one. This seems to fix it. Does it looks like
"possibly mergable" patch?

									Pavel

--- clean/kernel/suspend.c	2002-11-01 00:37:42.000000000 +0100
+++ linux-swsusp/kernel/suspend.c	2002-11-01 22:51:28.000000000 +0100
@@ -549,7 +550,7 @@
 
 	pagedir_order = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages));
 
-	p = pagedir = (suspend_pagedir_t *)__get_free_pages(GFP_ATOMIC, pagedir_order);
+	p = pagedir = (suspend_pagedir_t *)__get_free_pages(GFP_ATOMIC | __GFP_COLD, pagedir_order);
 	if(!pagedir)
 		return NULL;
 
@@ -558,11 +559,11 @@
 		SetPageNosave(page++);
 		
 	while(nr_copy_pages--) {
-		p->address = get_zeroed_page(GFP_ATOMIC);
+		p->address = get_zeroed_page(GFP_ATOMIC | __GFP_COLD);
 		if(!p->address) {
 			free_suspend_pagedir((unsigned long) pagedir);
 			return NULL;
 		}
 		SetPageNosave(virt_to_page(p->address));
 		p->orig_address = 0;
 		p++;
--- clean/mm/page_alloc.c	2002-11-01 00:37:44.000000000 +0100
+++ linux-swsusp/mm/page_alloc.c	2002-11-01 22:53:47.000000000 +0100
@@ -361,7 +361,7 @@
 	unsigned long flags;
 	struct page *page = NULL;
 
-	if (order == 0) {
+	if ((order == 0) && !cold) {
 		struct per_cpu_pages *pcp;
 
 		pcp = &zone->pageset[get_cpu()].pcp[cold];


-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

             reply	other threads:[~2002-11-02 18:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-02 18:19 Pavel Machek [this message]
2002-11-02 18:46 ` Hot/cold allocation -- swsusp can not handle hot pages William Lee Irwin III
2002-11-02 20:22   ` Pavel Machek
2002-11-02 21:48     ` Andrew Morton
2002-11-03 20:08       ` Pavel Machek
2002-11-03 20:14         ` William Lee Irwin III
2002-11-03 20:21         ` Andrew Morton
2002-11-03 20:26           ` Pavel Machek
2002-11-03 20:52         ` William Lee Irwin III
2002-11-03 21:22           ` William Lee Irwin III
2002-11-03 22:53           ` Pavel Machek

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=20021102181900.GA140@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@zip.com.au \
    --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