linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tiny MM performance and typo patches for 2.4.2
@ 2001-03-04 21:49 Ulrich Kunitz
  2001-03-04 21:55 ` David S. Miller
  2001-03-05  7:25 ` Mike Galbraith
  0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Kunitz @ 2001-03-04 21:49 UTC (permalink / raw)
  To: linux-kernel, linux-mm

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

Hi folks,

this is a list of patches I collected while looking at the memory
management sources. Two patches might improve the performance of your
box. The others are more or less cosmetic. 

This mail is sent with a kernel using these patches.
Here is a list sorted with decreasing importance:

patch-uk2 	makes use of the pgd, pmd and pte quicklists for x86 too;
		risky: there might be a reason that 2.4.x doesn't use the
		quicklists.

patch-uk6	In 2.4.x _page_hashfn divides struct address_space pointer
		with a parameter derived from the size of struct
		inode. Deriving this parameter from the size of struct
		address_space makes more sense -- at least for me.

patch-uk5	cleans the bd_flush_param union.

patch-uk1	fixes a comment typo in asm-i386/highmem.h.

patch-uk3	fixes a comment typo in asm-i386/pgtable-3level.h.

Ciao,

Uli Kunitz

-- 
Ulrich Kunitz (gefm21@uumail.de)

[-- Attachment #2: patch-uk2 --]
[-- Type: text/plain, Size: 880 bytes --]

--- linux-2.4.2/include/asm-i386/pgalloc.h	Thu Feb 22 01:09:57 2001
+++ linux/include/asm-i386/pgalloc.h	Sun Mar  4 20:14:50 2001
@@ -92,9 +92,9 @@
 	free_page((unsigned long)pte);
 }
 
-#define pte_free_kernel(pte)    free_pte_slow(pte)
-#define pte_free(pte)	   free_pte_slow(pte)
-#define pgd_free(pgd)	   free_pgd_slow(pgd)
+#define pte_free_kernel(pte)    free_pte_fast(pte)
+#define pte_free(pte)	   free_pte_fast(pte)
+#define pgd_free(pgd)	   free_pgd_fast(pgd)
 #define pgd_alloc()	     get_pgd_fast()
 
 extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address)
@@ -145,7 +145,7 @@
  * inside the pgd, so has no extra memory associated with it.
  * (In the PAE case we free the page.)
  */
-#define pmd_free(pmd)	   free_pmd_slow(pmd)
+#define pmd_free(pmd)	   free_pmd_fast(pmd)
 
 #define pmd_free_kernel		pmd_free
 #define pmd_alloc_kernel	pmd_alloc

[-- Attachment #3: patch-uk6 --]
[-- Type: text/plain, Size: 547 bytes --]

--- linux-2.4.2/include/linux/pagemap.h	Thu Feb 22 01:10:01 2001
+++ linux/include/linux/pagemap.h	Sun Mar  4 20:14:50 2001
@@ -58,7 +58,8 @@
  */
 extern inline unsigned long _page_hashfn(struct address_space * mapping, unsigned long index)
 {
-#define i (((unsigned long) mapping)/(sizeof(struct inode) & ~ (sizeof(struct inode) - 1)))
+#define i (((unsigned long) mapping) / \
+	(sizeof(struct address_space) & ~ (sizeof(struct address_space) - 1)))
 #define s(x) ((x)+((x)>>PAGE_HASH_BITS))
 	return s(i+index) & (PAGE_HASH_SIZE-1);
 #undef i

[-- Attachment #4: patch-uk5 --]
[-- Type: text/plain, Size: 1090 bytes --]

--- linux-2.4.2/fs/buffer.c	Fri Feb  9 20:29:44 2001
+++ linux/fs/buffer.c	Sun Mar  4 19:27:31 2001
@@ -112,19 +112,18 @@
  */
 union bdflush_param {
 	struct {
-		int nfract;  /* Percentage of buffer cache dirty to 
-				activate bdflush */
-		int ndirty;  /* Maximum number of dirty blocks to write out per
+		int nfract;   /* Percentage of buffer cache dirty to 
+				 activate bdflush */
+		int ndirty;   /* Maximum number of dirty blocks to write out per
 				wake-cycle */
-		int nrefill; /* Number of clean buffers to try to obtain
-				each time we call refill */
 		int dummy1;   /* unused */
+		int dummy2;   /* unused */
 		int interval; /* jiffies delay between kupdate flushes */
 		int age_buffer;  /* Time for normal buffer to age before we flush it */
 		int nfract_sync; /* Percentage of buffer cache dirty to 
 				    activate bdflush synchronously */
-		int dummy2;    /* unused */
-		int dummy3;    /* unused */
+		int dummy3;   /* unused */
+		int dummy4;   /* unused */
 	} b_un;
 	unsigned int data[N_PARAM];
 } bdf_prm = {{30, 64, 64, 256, 5*HZ, 30*HZ, 60, 0, 0}};

[-- Attachment #5: patch-uk1 --]
[-- Type: text/plain, Size: 447 bytes --]

--- linux-2.4.2/include/asm-i386/highmem.h	Thu Feb 22 01:09:58 2001
+++ linux/include/asm-i386/highmem.h	Sun Mar  4 20:14:50 2001
@@ -9,7 +9,7 @@
  *
  *
  * Redesigned the x86 32-bit VM architecture to deal with 
- * up to 16 Terrabyte physical memory. With current x86 CPUs
+ * up to 16 Terabyte physical memory. With current x86 CPUs
  * we now support up to 64 Gigabytes physical RAM.
  *
  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>

[-- Attachment #6: patch-uk3 --]
[-- Type: text/plain, Size: 578 bytes --]

--- linux-2.4.2/include/asm-i386/pgtable-3level.h	Wed Oct 18 23:25:46 2000
+++ linux/include/asm-i386/pgtable-3level.h	Sun Mar  4 19:25:00 2001
@@ -48,7 +48,7 @@
 /* Rules for using set_pte: the pte being assigned *must* be
  * either not present or in a state where the hardware will
  * not attempt to update the pte.  In places where this is
- * not possible, use pte_get_and_clear to obtain the old pte
+ * not possible, use ptep_get_and_clear to obtain the old pte
  * value and then use set_pte to update it.  -ben
  */
 static inline void set_pte(pte_t *ptep, pte_t pte)

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

* Re: [PATCH] tiny MM performance and typo patches for 2.4.2
  2001-03-04 21:49 [PATCH] tiny MM performance and typo patches for 2.4.2 Ulrich Kunitz
@ 2001-03-04 21:55 ` David S. Miller
  2001-03-05  0:29   ` Rik van Riel
  2001-03-05  7:25 ` Mike Galbraith
  1 sibling, 1 reply; 5+ messages in thread
From: David S. Miller @ 2001-03-04 21:55 UTC (permalink / raw)
  To: Ulrich Kunitz; +Cc: linux-kernel, linux-mm


Ulrich Kunitz writes:
 > patch-uk6	In 2.4.x _page_hashfn divides struct address_space pointer
 > 		with a parameter derived from the size of struct
 > 		inode. Deriving this parameter from the size of struct
 > 		address_space makes more sense -- at least for me.

The address_space is %99 of the time (unless swapping, and in that
case the address is constant :-)) inside of an inode struct so this
change actually makes the hash worse.  I looked at this one time
myself...

Later,
David S. Miller
davem@redhat.com

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

* Re: [PATCH] tiny MM performance and typo patches for 2.4.2
  2001-03-04 21:55 ` David S. Miller
@ 2001-03-05  0:29   ` Rik van Riel
  0 siblings, 0 replies; 5+ messages in thread
From: Rik van Riel @ 2001-03-05  0:29 UTC (permalink / raw)
  To: David S. Miller; +Cc: Ulrich Kunitz, linux-kernel, linux-mm

On Sun, 4 Mar 2001, David S. Miller wrote:
> Ulrich Kunitz writes:
>  > patch-uk6	In 2.4.x _page_hashfn divides struct address_space pointer
>  > 		with a parameter derived from the size of struct
>  > 		inode. Deriving this parameter from the size of struct
>  > 		address_space makes more sense -- at least for me.
> 
> The address_space is %99 of the time (unless swapping, and in that
> case the address is constant :-)) inside of an inode struct so this
> change actually makes the hash worse.  I looked at this one time
> myself...

The other patches look fine to me. Alan, Linus, could
you please include Ulrich's other patches in the next
pre-kernel ?

thanks,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/


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

* Re: [PATCH] tiny MM performance and typo patches for 2.4.2
  2001-03-04 21:49 [PATCH] tiny MM performance and typo patches for 2.4.2 Ulrich Kunitz
  2001-03-04 21:55 ` David S. Miller
@ 2001-03-05  7:25 ` Mike Galbraith
  2001-03-05 14:20   ` Rik van Riel
  1 sibling, 1 reply; 5+ messages in thread
From: Mike Galbraith @ 2001-03-05  7:25 UTC (permalink / raw)
  To: Ulrich Kunitz; +Cc: linux-kernel, linux-mm

On Sun, 4 Mar 2001, Ulrich Kunitz wrote:

> patch-uk2 	makes use of the pgd, pmd and pte quicklists for x86 too;
> 		risky: there might be a reason that 2.4.x doesn't use the
> 		quicklists.

I remember these being taken out (long ago), but not why.  Anyone?

	-Mike


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

* Re: [PATCH] tiny MM performance and typo patches for 2.4.2
  2001-03-05  7:25 ` Mike Galbraith
@ 2001-03-05 14:20   ` Rik van Riel
  0 siblings, 0 replies; 5+ messages in thread
From: Rik van Riel @ 2001-03-05 14:20 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Ulrich Kunitz, linux-kernel, linux-mm

On Mon, 5 Mar 2001, Mike Galbraith wrote:
> On Sun, 4 Mar 2001, Ulrich Kunitz wrote:
> 
> > patch-uk2 	makes use of the pgd, pmd and pte quicklists for x86 too;
> > 		risky: there might be a reason that 2.4.x doesn't use the
> > 		quicklists.
> 
> I remember these being taken out (long ago), but not why.  Anyone?

They probably wasted too much memory ...

Having _2_ quicklists per CPU (on SMP) is probably the way
to go: one with zeroed pages and one with non-zeroed pages.

This should avoid cache contention in __alloc_pages() and
also avoid unneeded zeroing of pages (when we put away a
zeroed page, eg. an freed pagetable page).

On UP we probably want a (smaller) freelist with zeroed
pages only, since that means we can keep more pages on the
inactive_clean list.

regards,

Rik
--
Virtual memory is like a game you can't win;
However, without VM there's truly nothing to lose...

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/


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

end of thread, other threads:[~2001-03-05 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-04 21:49 [PATCH] tiny MM performance and typo patches for 2.4.2 Ulrich Kunitz
2001-03-04 21:55 ` David S. Miller
2001-03-05  0:29   ` Rik van Riel
2001-03-05  7:25 ` Mike Galbraith
2001-03-05 14:20   ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).