All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: 2.6.0-test9-mm4
Date: Wed, 19 Nov 2003 02:34:19 -0800	[thread overview]
Message-ID: <20031119103419.GR22764@holomorphy.com> (raw)
In-Reply-To: <20031119101322.GQ22764@holomorphy.com>

On Wed, Nov 19, 2003 at 01:33:40AM -0800, William Lee Irwin III wrote:
>> This was a micro-optimization for UP; the SMP case needs to protect
>> against reentry via interrupts due to smp_call_function(). UP can
>> just disable preemption. In principle, the two cases could be made
>> uniform at the cost of disabling interrupts unnecessarily on UP.

On Wed, Nov 19, 2003 at 02:13:22AM -0800, William Lee Irwin III wrote:
> The following, incremental atop the first, removes the smp_local_irq_*()
> macros.

The following, incremental atop the smp_local_irq_*() removal, turns
shrink_pagetable_cache() into a set_shrinker()-registered shrinker_t.

I'm not entirely sure how good an idea this is given my prior remarks
about the vmscan.c code skipping shrink_slab() under highmem pressure.
Maybe the proper solution is teaching true slab shrinkers to honor
the gfp_mask argument?

This is also untested (apart from compiletesting).


-- wli


diff -prauN mm4-2.6.0-test9-3/arch/i386/mm/pgtable.c mm4-2.6.0-test9-4/arch/i386/mm/pgtable.c
--- mm4-2.6.0-test9-3/arch/i386/mm/pgtable.c	2003-11-19 02:07:13.000000000 -0800
+++ mm4-2.6.0-test9-4/arch/i386/mm/pgtable.c	2003-11-19 02:26:04.000000000 -0800
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <linux/spinlock.h>
+#include <linux/init.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -421,7 +422,7 @@ static void shrink_cpu_pagetable_cache(v
 	put_cpu();
 }
 
-void shrink_pagetable_cache(int gfp_mask)
+static int shrink_pagetable_cache(int nr_to_scan, unsigned int gfp_mask)
 {
 	BUG_ON(irqs_disabled());
 
@@ -432,4 +433,13 @@ void shrink_pagetable_cache(int gfp_mask
 
 	smp_call_function(shrink_cpu_pagetable_cache, (void *)gfp_mask, 1, 1);
 	preempt_enable();
+	return 1;
 }
+
+static __init int init_pagetable_cache_shrinker(void)
+{
+	set_shrinker(1, shrink_pagetable_cache);
+	return 0;
+}
+
+__initcall(init_pagetable_cache_shrinker);
diff -prauN mm4-2.6.0-test9-3/include/asm-i386/pgtable.h mm4-2.6.0-test9-4/include/asm-i386/pgtable.h
--- mm4-2.6.0-test9-3/include/asm-i386/pgtable.h	2003-11-19 00:09:43.000000000 -0800
+++ mm4-2.6.0-test9-4/include/asm-i386/pgtable.h	2003-11-19 02:24:14.000000000 -0800
@@ -44,9 +44,6 @@ void pgtable_cache_init(void);
 void paging_init(void);
 void setup_identity_mappings(pgd_t *pgd_base, unsigned long start, unsigned long end);
 
-#define HAVE_ARCH_PAGETABLE_CACHE
-void shrink_pagetable_cache(int gfp_mask);
-
 #endif /* !__ASSEMBLY__ */
 
 /*
diff -prauN mm4-2.6.0-test9-3/mm/vmscan.c mm4-2.6.0-test9-4/mm/vmscan.c
--- mm4-2.6.0-test9-3/mm/vmscan.c	2003-11-19 00:09:43.000000000 -0800
+++ mm4-2.6.0-test9-4/mm/vmscan.c	2003-11-19 02:15:43.000000000 -0800
@@ -838,10 +838,6 @@ shrink_caches(struct zone *classzone, in
 	return ret;
 }
 
-#ifndef HAVE_ARCH_PAGETABLE_CACHE
-#define shrink_pagetable_cache(gfp_mask)		do { } while (0)
-#endif
- 
 /*
  * This is the main entry point to direct page reclaim.
  *
@@ -894,9 +890,6 @@ int try_to_free_pages(struct zone *cz,
 		 */
 		wakeup_bdflush(total_scanned);
 
-		/* shoot down some pagetable caches before napping */
-		shrink_pagetable_cache(gfp_mask);
-
 		/* Take a nap, wait for some writeback to complete */
 		blk_congestion_wait(WRITE, HZ/10);
 		if (cz - cz->zone_pgdat->node_zones < ZONE_HIGHMEM) {
@@ -988,10 +981,8 @@ static int balance_pgdat(pg_data_t *pgda
 		}
 		if (all_zones_ok)
 			break;
-		if (to_free > 0) {
-			shrink_pagetable_cache(GFP_HIGHUSER);
+		if (to_free > 0)
 			blk_congestion_wait(WRITE, HZ/10);
-		}
 	}
 
 	for (i = 0; i < pgdat->nr_zones; i++) {

WARNING: multiple messages have this Message-ID (diff)
From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: 2.6.0-test9-mm4
Date: Wed, 19 Nov 2003 02:34:19 -0800	[thread overview]
Message-ID: <20031119103419.GR22764@holomorphy.com> (raw)
In-Reply-To: <20031119101322.GQ22764@holomorphy.com>

On Wed, Nov 19, 2003 at 01:33:40AM -0800, William Lee Irwin III wrote:
>> This was a micro-optimization for UP; the SMP case needs to protect
>> against reentry via interrupts due to smp_call_function(). UP can
>> just disable preemption. In principle, the two cases could be made
>> uniform at the cost of disabling interrupts unnecessarily on UP.

On Wed, Nov 19, 2003 at 02:13:22AM -0800, William Lee Irwin III wrote:
> The following, incremental atop the first, removes the smp_local_irq_*()
> macros.

The following, incremental atop the smp_local_irq_*() removal, turns
shrink_pagetable_cache() into a set_shrinker()-registered shrinker_t.

I'm not entirely sure how good an idea this is given my prior remarks
about the vmscan.c code skipping shrink_slab() under highmem pressure.
Maybe the proper solution is teaching true slab shrinkers to honor
the gfp_mask argument?

This is also untested (apart from compiletesting).


-- wli


diff -prauN mm4-2.6.0-test9-3/arch/i386/mm/pgtable.c mm4-2.6.0-test9-4/arch/i386/mm/pgtable.c
--- mm4-2.6.0-test9-3/arch/i386/mm/pgtable.c	2003-11-19 02:07:13.000000000 -0800
+++ mm4-2.6.0-test9-4/arch/i386/mm/pgtable.c	2003-11-19 02:26:04.000000000 -0800
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/pagemap.h>
 #include <linux/spinlock.h>
+#include <linux/init.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -421,7 +422,7 @@ static void shrink_cpu_pagetable_cache(v
 	put_cpu();
 }
 
-void shrink_pagetable_cache(int gfp_mask)
+static int shrink_pagetable_cache(int nr_to_scan, unsigned int gfp_mask)
 {
 	BUG_ON(irqs_disabled());
 
@@ -432,4 +433,13 @@ void shrink_pagetable_cache(int gfp_mask
 
 	smp_call_function(shrink_cpu_pagetable_cache, (void *)gfp_mask, 1, 1);
 	preempt_enable();
+	return 1;
 }
+
+static __init int init_pagetable_cache_shrinker(void)
+{
+	set_shrinker(1, shrink_pagetable_cache);
+	return 0;
+}
+
+__initcall(init_pagetable_cache_shrinker);
diff -prauN mm4-2.6.0-test9-3/include/asm-i386/pgtable.h mm4-2.6.0-test9-4/include/asm-i386/pgtable.h
--- mm4-2.6.0-test9-3/include/asm-i386/pgtable.h	2003-11-19 00:09:43.000000000 -0800
+++ mm4-2.6.0-test9-4/include/asm-i386/pgtable.h	2003-11-19 02:24:14.000000000 -0800
@@ -44,9 +44,6 @@ void pgtable_cache_init(void);
 void paging_init(void);
 void setup_identity_mappings(pgd_t *pgd_base, unsigned long start, unsigned long end);
 
-#define HAVE_ARCH_PAGETABLE_CACHE
-void shrink_pagetable_cache(int gfp_mask);
-
 #endif /* !__ASSEMBLY__ */
 
 /*
diff -prauN mm4-2.6.0-test9-3/mm/vmscan.c mm4-2.6.0-test9-4/mm/vmscan.c
--- mm4-2.6.0-test9-3/mm/vmscan.c	2003-11-19 00:09:43.000000000 -0800
+++ mm4-2.6.0-test9-4/mm/vmscan.c	2003-11-19 02:15:43.000000000 -0800
@@ -838,10 +838,6 @@ shrink_caches(struct zone *classzone, in
 	return ret;
 }
 
-#ifndef HAVE_ARCH_PAGETABLE_CACHE
-#define shrink_pagetable_cache(gfp_mask)		do { } while (0)
-#endif
- 
 /*
  * This is the main entry point to direct page reclaim.
  *
@@ -894,9 +890,6 @@ int try_to_free_pages(struct zone *cz,
 		 */
 		wakeup_bdflush(total_scanned);
 
-		/* shoot down some pagetable caches before napping */
-		shrink_pagetable_cache(gfp_mask);
-
 		/* Take a nap, wait for some writeback to complete */
 		blk_congestion_wait(WRITE, HZ/10);
 		if (cz - cz->zone_pgdat->node_zones < ZONE_HIGHMEM) {
@@ -988,10 +981,8 @@ static int balance_pgdat(pg_data_t *pgda
 		}
 		if (all_zones_ok)
 			break;
-		if (to_free > 0) {
-			shrink_pagetable_cache(GFP_HIGHUSER);
+		if (to_free > 0)
 			blk_congestion_wait(WRITE, HZ/10);
-		}
 	}
 
 	for (i = 0; i < pgdat->nr_zones; i++) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2003-11-19 10:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-19  6:51 2.6.0-test9-mm4 Andrew Morton
2003-11-19  6:51 ` 2.6.0-test9-mm4 Andrew Morton
2003-11-19  9:02 ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19  9:02   ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19  9:19   ` 2.6.0-test9-mm4 Andrew Morton
2003-11-19  9:19     ` 2.6.0-test9-mm4 Andrew Morton
2003-11-19  9:33     ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19  9:33       ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19 10:13       ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19 10:13         ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19 10:34         ` William Lee Irwin III [this message]
2003-11-19 10:34           ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19 10:50           ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19 10:50             ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-19 11:13 ` 2.6.0-test9-mm4 Gene Heskett
2003-11-19 11:13   ` 2.6.0-test9-mm4 Gene Heskett
2003-11-21  8:29 ` 2.6.0-test9-mm4 Prakash K. Cheemplavam
2003-11-21  8:41   ` 2.6.0-test9-mm4 Andrew Morton
2003-11-21  8:44     ` 2.6.0-test9-mm4 Prakash K. Cheemplavam
2003-11-21  8:52       ` 2.6.0-test9-mm4 Andrew Morton
     [not found]       ` <200311210809.16049.edt@aei.ca>
2003-11-21 13:36         ` 2.6.0-test9-mm4 Prakash K. Cheemplavam
2003-11-21  8:43   ` 2.6.0-test9-mm4 Prakash K. Cheemplavam
2003-11-21 13:08   ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-21 13:58     ` 2.6.0-test9-mm4 Prakash K. Cheemplavam
2003-11-21 13:58       ` 2.6.0-test9-mm4 William Lee Irwin III
2003-11-24 21:26     ` 2.6.0-test9-mm4 bill davidsen

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=20031119103419.GR22764@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 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.