All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@clear.net.nz>
To: Pavel Machek <pavel@ucw.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Don't refill pcp lists during SWSUSP.
Date: Tue, 18 Mar 2003 11:56:13 +1200	[thread overview]
Message-ID: <1047945372.1714.19.camel@laptop-linux.cunninghams> (raw)

Hi.

Here's another patch (the last for a little while, I promise!). It stops
the pcp lists from being refilled while SWSUSP is running. Despite the
comment in the page, drain_local_pages does only need to get called once
right now, but I have patches coming that will (DV) change that. This
patch is thus groundwork for them.

I see Linus has just done 2.5.65 - I'll rediff if need be.

Regards,

Nigel
-- 
Nigel Cunningham
495 St Georges Road South, Hastings 4201, New Zealand

Be diligent to present yourself approved to God as a workman who does
not need to be ashamed, handling accurately the word of truth.
	-- 2 Timothy 2:14, NASB.

diff -ruN linux-2.5.64-02-free-page-map/include/linux/suspend.h linux-2.5.64-03-do-not-refill-hot-pages/include/linux/suspend.h
--- linux-2.5.64-02-free-page-map/include/linux/suspend.h	2003-03-10 12:36:16.000000000 +1300
+++ linux-2.5.64-03-do-not-refill-hot-pages/include/linux/suspend.h	2003-03-18 11:21:53.000000000 +1200
@@ -63,6 +63,8 @@
 extern unsigned int nr_copy_pages __nosavedata;
 extern suspend_pagedir_t *pagedir_nosave __nosavedata;
 
+extern unsigned int suspend_task;
+
 /* Communication between kernel/suspend.c and arch/i386/suspend.c */
 
 extern void do_magic_resume_1(void);
diff -ruN linux-2.5.64-02-free-page-map/kernel/suspend.c linux-2.5.64-03-do-not-refill-hot-pages/kernel/suspend.c
--- linux-2.5.64-02-free-page-map/kernel/suspend.c	2003-03-18 10:54:31.000000000 +1200
+++ linux-2.5.64-03-do-not-refill-hot-pages/kernel/suspend.c	2003-03-18 11:21:53.000000000 +1200
@@ -68,6 +68,7 @@
 extern int sys_sync(void);
 
 unsigned char software_suspend_enabled = 0;
+unsigned int suspend_task = 0;
 
 #define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
 /* With SUSPEND_CONSOLE defined, it suspend looks *really* cool, but
@@ -232,6 +233,8 @@
 		}
 	} while(todo);
 	
+	suspend_task = current->pid;
+		
 	printk( "|\n" );
 	BUG_ON(in_atomic());
 	return 0;
@@ -253,6 +256,7 @@
 	} while_each_thread(g, p);
 
 	read_unlock(&tasklist_lock);
+	suspend_task = 0;
 	printk( " done\n" );
 	MDELAY(500);
 }
diff -ruN linux-2.5.64-02-free-page-map/mm/page_alloc.c linux-2.5.64-03-do-not-refill-hot-pages/mm/page_alloc.c
--- linux-2.5.64-02-free-page-map/mm/page_alloc.c	2003-03-18 10:53:22.000000000 +1200
+++ linux-2.5.64-03-do-not-refill-hot-pages/mm/page_alloc.c	2003-03-18 11:21:53.000000000 +1200
@@ -486,6 +486,10 @@
  * Really, prep_compound_page() should be called from __rmqueue_bulk().  But
  * we cheat by calling it from here, in the order > 0 path.  Saves a branch
  * or two.
+ *
+ * While suspending, we don't use the pcp structure. It mucks up our
+ * accounting for all the pages and necessitates calling drain_local_pages
+ * multiple times.
  */
 
 static struct page *buffered_rmqueue(struct zone *zone, int order, int cold)
@@ -493,7 +497,7 @@
 	unsigned long flags;
 	struct page *page = NULL;
 
-	if (order == 0) {
+	if ((order == 0) && (!suspend_task)) {
 		struct per_cpu_pages *pcp;
 
 		pcp = &zone->pageset[get_cpu()].pcp[cold];
@@ -700,7 +704,7 @@
 void __free_pages(struct page *page, unsigned int order)
 {
 	if (!PageReserved(page) && put_page_testzero(page)) {
-		if (order == 0)
+		if ((order == 0) && (!suspend_task))
 			free_hot_page(page);
 		else
 			__free_pages_ok(page, order);




             reply	other threads:[~2003-03-17 23:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-17 23:56 Nigel Cunningham [this message]
2003-03-18  0:05 ` [PATCH] Don't refill pcp lists during SWSUSP Andrew Morton
2003-03-18  5:27   ` Nigel Cunningham
     [not found]     ` <20030317222018.5c7f7a56.akpm@digeo.com>
2003-03-18  6:35       ` Nigel Cunningham
2003-03-18  6:40   ` Nigel Cunningham
2003-03-18  8:18 ` Pavel Machek
2003-03-18 10:06   ` Nigel Cunningham
2003-03-18 16:58     ` 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=1047945372.1714.19.camel@laptop-linux.cunninghams \
    --to=ncunningham@clear.net.nz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.