Skip to contentSkip to conversation

2.6.0-test11-wli-1

DISCUSSION William Lee Irwin III 6 participants 13 messages Dec 4, 2003 – Dec 11, 2003

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

This release is vastly cleaned up compared to the test8 release, and features the wchan and major/minor fault accounting fixes. I still need to fold the anobjrmap fixes into the original patches and find some alternative way for smbfs and ncpfs to do whatever d_validate() was doing for them. I also need to find a coherent way to incorporate the cleanups for pte caching suggested by akpm without bloating the pte cache on lowmem boxen (but nothing radical like 4/4 or pgcl).

It's also worth noting that the patches "originally due" to someone were just plucked off of the list by me (in some cases, they just first implemented of the idea), so be sure to ascribe all the credit to them, and all the bugs to me. I wasn't sure of a complete (or even partial) list of those to credit for top-down vma allocation, hence "various", though it was jejb who described the glibc workaround.

Available from:
ftp://ftp.kernel.org/pub/linux/kernel/people/wli/kernels/2.6.0-test11/

-- wli

1: highpmd
-- originally due to aa as part of pte-highmem -- from scratch implementation based on 2.6 highpte
2: O(1) buffered_rmqueue()
3: i386 pte caching
4: O(lg(n)) proc_pid_readdir()/proc_task_readdir()
5: O(1) proc_pid_statm()
-- originally due to bcrl
6: kmap_atomic() microoptimizations
7: compile-time mapping->page_lock type selection
8: 4KB i386 stacks
-- originally due to bcrl
9: objrmap
-- originally due to dmc/mbligh
10: RCU mapping->i_shared_lock
11: anobjrmap, phase 1
-- originally due to hugh
12: anobjrmap, phase 2
-- originally due to hugh
13: anobjrmap, phase 3
-- originally due to hugh
14: anobjrmap, phase 4
-- originally due to hugh
15: anobjrmap, phase 5
-- originally due to hugh
16: RCU anon->lock
17: convert copy_strings() to use kmap_atomic() instead of kmap()
18: increase page allocator batch counts
19: node-local i386 per_cpu areas
20: CONFIG_MMAP_TOPDOWN, top-down vma allocation
-- various prior implementations
21: anobjrmap fixes
22: increase static vfs hashtable and VM array sizes
23: intermezzo 4KB stack fixes
-- due to muli
24: /proc/ BKL gunk plus page wait hashtable sizing adjustment
25: invalidate_inodes() speedup
-- originally due to Kirill Korotaev
26: fix the anobjrmap fix and adjust page_alloc.c inlining
27: remove ->valid_addr_bitmap, kern_addr_valid(), and d_validate()
28: fix wchan accounting
29: fix major/minor fault accounting
30: remove mm->swap_address

#1 lore raw
Quoted 3 lines · William Lee Irwin III

was doing for them. I also need to find a coherent way to incorporate the cleanups for pte caching suggested by akpm without bloating the pte cache on lowmem boxen

Maybe the pte caching cleanups should go something like this:

arch/i386/mm/pgtable.c +16 -5
diff -prauN wli-2.6.0-test11-30/arch/i386/mm/pgtable.c wli-2.6.0-test11-31/arch/i386/mm/pgtable.c
@@ -1,5 +1,6 @@
 /*
  *  linux/arch/i386/mm/pgtable.c
+ *  highpte-compatible pte caching, William Irwin, IBM, June 2003
  */
 
 #include <linux/config.h>
@@ -13,6 +14,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>
@@ -176,7 +178,7 @@ static inline struct page *pte_alloc_rea
 	unsigned long flags;
 	struct page *page = NULL;
 
-	smp_local_irq_save(flags);
+	local_irq_save(flags);
 	if (tlb->nr_pte_ready) {
 		int z;
 		for (z = MAX_ZONE_ID - 1; z >= 0; --z) {
@@ -193,7 +195,7 @@ static inline struct page *pte_alloc_rea
 		tlb->ready_count[z]--;
 		tlb->nr_pte_ready--;
 	}
-	smp_local_irq_restore(flags);
+	local_irq_restore(flags);
 	put_cpu();
 	return page;
 }
@@ -305,7 +307,7 @@ static void shrink_cpu_pagetable_cache(v
 	high = !!(gfp_mask & __GFP_HIGHMEM);
 	cpu = get_cpu();
 	tlb = &per_cpu(mmu_gathers, cpu);
-	smp_local_irq_save(flags);
+	local_irq_save(flags);
 
 	if (tlb->nr_pte_active || tlb->nr_nonpte)
 		tlb_flush(tlb);
@@ -342,11 +344,11 @@ static void shrink_cpu_pagetable_cache(v
 		free_pages_bulk(zone_table[zone], head, 0);
 	}
 
-	smp_local_irq_restore(flags);
+	local_irq_restore(flags);
 	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());
 
@@ -357,8 +359,17 @@ 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);
+
 #define GLIBC_BUFFER	(32*1024*1024)
 
 /*
fs/dcache.c +3 -0
diff -prauN wli-2.6.0-test11-30/fs/dcache.c wli-2.6.0-test11-31/fs/dcache.c
@@ -657,6 +657,9 @@ static int shrink_dcache_memory(int nr, 
 	int nr_unused;
 	const int unused_ratio = 1;
 
+	if (gfp_mask & __GFP_HIGHMEM)
+		return 0;
+
 	if (nr) {
 		/*
 		 * Nasty deadlock avoidance.
fs/dquot.c +3 -0
diff -prauN wli-2.6.0-test11-30/fs/dquot.c wli-2.6.0-test11-31/fs/dquot.c
@@ -386,6 +386,9 @@ static int shrink_dqcache_memory(int nr,
 {
 	int ret;
 
+	if (gfp_mask & __GFP_HIGHMEM)
+		return 0;
+
 	spin_lock(&dq_list_lock);
 	if (nr)
 		prune_dqcache(nr);
fs/inode.c +3 -0
diff -prauN wli-2.6.0-test11-30/fs/inode.c wli-2.6.0-test11-31/fs/inode.c
@@ -467,6 +467,9 @@ static void prune_icache(int nr_to_scan)
  */
 static int shrink_icache_memory(int nr, unsigned int gfp_mask)
 {
+	if (gfp_mask & __GFP_HIGHMEM)
+		return 0;
+
 	if (nr) {
 		/*
 		 * Nasty deadlock avoidance.  We may hold various FS locks,
fs/mbcache.c +3 -0
diff -prauN wli-2.6.0-test11-30/fs/mbcache.c wli-2.6.0-test11-31/fs/mbcache.c
@@ -176,6 +176,9 @@ mb_cache_shrink_fn(int nr_to_scan, unsig
 	struct list_head *l, *ltmp;
 	int count = 0;
 
+	if (gfp_mask & __GFP_HIGHMEM)
+		return 0;
+
 	spin_lock(&mb_cache_spinlock);
 	list_for_each(l, &mb_cache_list) {
 		struct mb_cache *cache =
fs/xfs/quota/xfs_qm.c +2 -0
diff -prauN wli-2.6.0-test11-30/fs/xfs/quota/xfs_qm.c wli-2.6.0-test11-31/fs/xfs/quota/xfs_qm.c
@@ -2206,6 +2206,8 @@ xfs_qm_shake(int nr_to_scan, unsigned in
 {
 	int	ndqused, nfree, n;
 
+	if (gfp_mask & __GFP_HIGHMEM)
+		return 0;
 	if (!(gfp_mask & __GFP_WAIT))
 		return 0;
 	if (!xfs_Gqm)
include/asm-i386/pgtable.h +0 -3
diff -prauN wli-2.6.0-test11-30/include/asm-i386/pgtable.h wli-2.6.0-test11-31/include/asm-i386/pgtable.h
@@ -45,9 +45,6 @@ void pgd_dtor(void *, kmem_cache_t *, un
 void pgtable_cache_init(void);
 void paging_init(void);
 
-#define HAVE_ARCH_PAGETABLE_CACHE
-void shrink_pagetable_cache(int gfp_mask);
-
 #endif /* !__ASSEMBLY__ */
 
 /*
include/asm-i386/system.h +0 -12
diff -prauN wli-2.6.0-test11-30/include/asm-i386/system.h wli-2.6.0-test11-31/include/asm-i386/system.h
@@ -461,18 +461,6 @@ struct alt_instr { 
 /* For spinlocks etc */
 #define local_irq_save(x)	__asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
 
-#ifdef CONFIG_SMP
-#define smp_local_irq_save(x)		local_irq_save(x)
-#define smp_local_irq_restore(x)	local_irq_restore(x)
-#define smp_local_irq_disable()		local_irq_disable()
-#define smp_local_irq_enable()		local_irq_enable()
-#else
-#define smp_local_irq_save(x)		do { (void)(x); } while (0)
-#define smp_local_irq_restore(x)	do { (void)(x); } while (0)
-#define smp_local_irq_disable()		do { } while (0)
-#define smp_local_irq_enable()		do { } while (0)
-#endif /* CONFIG_SMP */
-
 /*
  * disable hlt during certain critical i/o operations
  */
include/asm-i386/tlb.h +4 -4
diff -prauN wli-2.6.0-test11-30/include/asm-i386/tlb.h wli-2.6.0-test11-31/include/asm-i386/tlb.h
@@ -115,7 +115,7 @@ void tlb_flush_mmu(struct mmu_gather *tl
 	tlb->need_flush = 0;
 	tlb_flush(tlb);
 
-	smp_local_irq_save(flags);
+	local_irq_save(flags);
 
 	if (tlb->nr_nonpte) {
 		free_pages_and_swap_cache(tlb->nonpte, tlb->nr_nonpte);
@@ -135,7 +135,7 @@ void tlb_flush_mmu(struct mmu_gather *tl
 	if (tlb->nr_pte_ready >= NR_PTE)
 		tlb_flush_ready(tlb);
 
-	smp_local_irq_restore(flags);
+	local_irq_restore(flags);
 }
 
 static inline
@@ -172,13 +172,13 @@ void tlb_remove_page(struct mmu_gather *
 {
 	unsigned long flags;
 
-	smp_local_irq_save(flags);
+	local_irq_save(flags);
 	tlb->need_flush = 1;
 	if (PagePTE(page))
 		tlb_remove_pte_page(tlb, page);
 	else
 		tlb_remove_nonpte_page(tlb, page);
-	smp_local_irq_restore(flags);
+	local_irq_restore(flags);
 }
 
 #endif /* _I386_TLB_H */
mm/vmscan.c +20 -23

81 lines not on this page · raw message

#2 lore raw
In reply to William Lee Irwin III
Quoted 4 lines · William Lee Irwin III

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Compiles and boots fine with a minimal .config on my thinkpad R30 sacrificial machine.

Cheers,
Muli

Signature · 4 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

"the nucleus of linux oscillates my world" - gccbot@#offtopic
#3 lore raw
Quoted 4 lines · William Lee Irwin III
Quoted 4 lines

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Quoted 2 lines · Muli Ben-Yehuda

Compiles and boots fine with a minimal .config on my thinkpad R30 sacrificial machine.

Good to hear; I hope the various performance improvements (as they're intended to be, at least) do something for the R30.

-- wli

#4 lore raw
In reply to William Lee Irwin III
Quoted 4 lines · On Thu, 4 Dec 2003 12:01:20 -0800 William Lee Irwin III <[email protected]>…

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

I got this in ppc.
fs/built-in.o: In function `proc_task_readdir':
fs/built-in.o(.text+0x2ff44): undefined reference to __cmpdi2' fs/built-in.o(.text+0x2ff44): relocation truncated to fit: R_PPC_REL24 __cmpdi2 fs/built-in.o(.text+0x2ff6c): undefined reference to __cmpdi2' fs/built-in.o(.text+0x2ff6c): relocation truncated to fit: R_PPC_REL24 __cmpdi2
make: *** [.tmp_vmlinux1] Error 1

apply the patch should fix it.

proc/base.c +2 -1
Index: fs/proc/base.c
===================================================================
@@ -1673,12 +1673,13 @@
 	struct inode *inode = dentry->d_inode;
 	int retval = -ENOENT;
 	ino_t ino;
+	unsigned long pos = filp->f_pos;  /* avoiding "long long" filp->f_pos */
 
 	if (!pid_alive(proc_task(inode)))
 		goto out;
 	retval = 0;
 
-	switch (filp->f_pos) {
+	switch (pos) {
 	case 0:
 		ino = inode->i_ino;
 		if (filldir(dirent, ".", 1, filp->f_pos, ino, DT_DIR) < 0)
Signature · 6 lines
Hu Gang / Steve
Email         : [email protected], [email protected]
GPG FinePrint : 4099 3F1D AE01 1817 68F7  D499 A6C2 C418 86C8 610E
GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc
MSN#          : [email protected] [9:00AM - 5:30PM +8:00]
RLU#          : 204016 [1999] (Register Linux User)
#5 lore raw
Quoted 4 lines · On Thu, 4 Dec 2003 12:01:20 -0800 William Lee Irwin III <[email protected]>…
Quoted 4 lines

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Quoted 7 lines · Hugang

I got this in ppc.
fs/built-in.o: In function `proc_task_readdir':
fs/built-in.o(.text+0x2ff44): undefined reference to __cmpdi2' fs/built-in.o(.text+0x2ff44): relocation truncated to fit: R_PPC_REL24 __cmpdi2 fs/built-in.o(.text+0x2ff6c): undefined reference to __cmpdi2' fs/built-in.o(.text+0x2ff6c): relocation truncated to fit: R_PPC_REL24 __cmpdi2
make: *** [.tmp_vmlinux1] Error 1

Thanks, I'll pick that up.

-- wli

#6 lore raw
In reply to William Lee Irwin III
Quoted 4 lines · William Lee Irwin III

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Woops, I missed the target by a few bytes. Probably a bit overwrought:

-- wli

include/asm-i386/processor.h +10 -2
diff -prauN wli-2.6.0-test11-36/include/asm-i386/processor.h wli-2.6.0-test11-37/include/asm-i386/processor.h
@@ -497,11 +497,19 @@ void show_trace(struct task_struct *task
 unsigned long get_wchan(struct task_struct *task);
 
 #define THREAD_SIZE_LONGS	(THREAD_SIZE/sizeof(unsigned long))
+#define KSTK_TOP(info)							\
+({									\
+	unsigned long *__ptr = (unsigned long *)(info);			\
+	(unsigned long)(&__ptr[THREAD_SIZE_LONGS]);			\
+})
+
 #define task_pt_regs(task)						\
 ({									\
-	unsigned long *__ptr = (unsigned long *)(task)->thread_info;	\
-	(struct pt_regs *)(&__ptr[THREAD_SIZE_LONGS-1]);		\
+	struct pt_regs *__regs__;					\
+	__regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info);	\
+	__regs__ - 1;							\
 })
+
 #define KSTK_EIP(task)	(task_pt_regs(task)->eip)
 #define KSTK_ESP(task)	(task_pt_regs(task)->esp)
 
#7 lore raw
Quoted 4 lines · William Lee Irwin III
Quoted 4 lines

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Quoted 1 line · William Lee Irwin III

Woops, I missed the target by a few bytes. Probably a bit overwrought:

These THREAD_SIZE bits are cropping up all over.

-- wli

arch/i386/kernel/traps.c +1 -1
@@ -119,7 +119,7 @@ void show_trace_task(struct task_struct 
 	unsigned long esp = tsk->thread.esp;
 
 	/* User space on another CPU? */
-	if ((esp ^ (unsigned long)tsk->thread_info) & (PAGE_MASK<<1))
+	if ((esp ^ (unsigned long)tsk->thread_info) & ~(THREAD_SIZE - 1))
 		return;
 	show_trace(tsk, (unsigned long *)esp);
 }
#8 lore raw
In reply to William Lee Irwin III
Quoted 4 lines · William Lee Irwin III

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Bill Davidsen reported an issue where compiled kernel images aren't properly distinguished from mainline kernels' by installation scripts.

The following patch should resolve this:

-- wli

Makefile +1 -1
diff -prauN wli-2.6.0-test11-37/Makefile wli-2.6.0-test11-38/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 0
-EXTRAVERSION = -test11
+EXTRAVERSION = -test11-wli-1
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
#9 lore raw
Quoted 10 lines · William Lee Irwin III
Quoted 4 lines · William Lee Irwin III

Successfully tested on a Thinkpad T21. Any feedback regarding performance would be very helpful. Desktop users should notice top(1) is faster, kernel hackers that kernel compiles are faster, and highmem users should see much less per-process lowmem overhead.

Bill Davidsen reported an issue where compiled kernel images aren't properly distinguished from mainline kernels' by installation scripts.

The following patch should resolve this:

Argh, i've been screaming about this for ages...

#10 lore raw

In article <[email protected]>, Zwane Mwaikambo <[email protected]> wrote:

| On Tue, 9 Dec 2003, William Lee Irwin III wrote:
| 
| > On Thu, Dec 04, 2003 at 12:01:20PM -0800, William Lee Irwin III wrote:
| > > Successfully tested on a Thinkpad T21. Any feedback regarding
| > > performance would be very helpful. Desktop users should notice top(1)
| > > is faster, kernel hackers that kernel compiles are faster, and highmem
| > > users should see much less per-process lowmem overhead.
| >
| > Bill Davidsen reported an issue where compiled kernel images aren't
| > properly distinguished from mainline kernels' by installation scripts.
| >
| > The following patch should resolve this:
| 
| Argh, i've been screaming about this for ages...

Look, I'm a big boy now, I should be smart enough to *check* this, because every once in a while other people (you know who you are) do it too. My fault, I just noted it because other people may not be backed up as well as I am and shoot their only working kernel.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
#11 lore raw
Quoted 3 lines · William Lee Irwin III
|> Bill Davidsen reported an issue where compiled kernel images aren't
|> properly distinguished from mainline kernels' by installation scripts.
|> The following patch should resolve this:
Quoted 1 line · Zwane Mwaikambo

| Argh, i've been screaming about this for ages...

Quoted 4 lines · bill davidsen

Look, I'm a big boy now, I should be smart enough to *check* this, because every once in a while other people (you know who you are) do it too. My fault, I just noted it because other people may not be backed up as well as I am and shoot their only working kernel.

You don't have to run into it to report it. =) At any rate, I hope it does prevent confusion elsewhere.

-- wli

#12 lore raw
Quoted 2 lines · William Lee Irwin III

You don't have to run into it to report it. =) At any rate, I hope it does prevent confusion elsewhere.

Especially if there is a wli-2 or 3. :)