Skip to contentSkip to conversation

2.5.42-mm2

DISCUSSION Andrew Morton 6 participants 14 messages Oct 12, 2002 – Oct 27, 2002

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

url: http://www.zip.com.au/~akpm/linux/patches/2.5/2.5.42/2.5.42-mm2/

mm1 had a little problem in the compilation department - missing chunk from fs/fcntl.c.

+fix-pgpgout.patch

Fix /proc/vmstat:pgpgin/pgpgout accounting for 512-byte IOs

+dio-fine-alignment.patch

Bring back the 512-byte alignment patch

+sard.patch

Keep sard ticking over

+remove-kiobufs.patch

Remove the kiobuf infrastructure.

kgdb.patch

oprofile-25.patch

misc.patch
misc

hugetlb-meminfo.patch
change hugetlbpage info in /proc/meminfo

dio-bio-add-fix-1.patch
Fix direct-io for bio_add_page()

net-loopback.patch
Disable second copy in the network loopback driver

swsusp-feature.patch
add shrink_all_memory() for swsusp

large-queue-throttle.patch
Improve writer throttling for small machines

exit-page-referenced.patch
Propagate pte referenced bit into pagecache during unmap

swappiness.patch
swappiness control

mapped-start-active.patch
start anonymous pages on the active list

rename-dirty_async_ratio.patch
rename dirty_async_ratio to dirty_ratio

auto-dirty-memory.patch
adaptive dirty-memory thresholding

batched-slab-asap.patch
batched slab shrinking and shrinker callback API

blkdev-o_direct-short-read.patch
Fix O_DIRECT blockdev reads at end-of-device

fix-pgpgout.patch
Fix block IO accounting for 512-byte requests

orlov-allocator.patch

blk-queue-bounce.patch
inline blk_queue_bounce

lseek-ext2_readdir.patch
remove lock_kernel() from ext2_readdir()

msync-correctness.patch
msync correctness fix

dio-fine-alignment.patch
Allow O_DIRECT to use 512-byte alignment

sard.patch
SARD disk accounting

write-deadlock.patch
Fix the generic_file_write-from-same-mmapped-page deadlock

rd-cleanup.patch
Cleanup and fix the ramdisk driver (doesn't work right yet)

spin-lock-check.patch
spinlock/rwlock checking infrastructure

hugetlb-prefault.patch
hugetlbpages: factor out some code for hugetlbfs

ramfs-aops.patch
Move ramfs address_space ops into libfs

hugetlb-header-split.patch
Move hugetlb declarations into their own header

hugetlbfs.patch
hugetlbfs file system

hugetlb-shm.patch
hugetlbfs backing for SYSV shared memory

page_reserved-accounting.patch
Global PageReserved accounting

use-page_reserved_accounting.patch
Use PG_reserved accounting in the VM

ramfs-prepare-write-speedup.patch
correctness fixes in libfs address_space ops

akpm-deadline.patch
deadline scheduler tweaks

intel-user-copy.patch
Faster copt_*_user for Intel ia32 CPUs

raid0-fix.patch
RAID0 fix

rmqueue_bulk.patch
bulk page allocator

free_pages_bulk.patch
Bulk page freeing function

hot_cold_pages.patch
Hot/Cold pages and zone->lock amortisation

readahead-cold-pages.patch
Use cache-cold pages for pagecache reads.

pagevec-hot-cold-hint.patch
hot/cold hints for truncate and page reclaim

page-reservation.patch
Page reservation API

o_streaming.patch
O_STREAMING support

remove-kiobufs.patch
Remove kiobufs and kiovecs

slab-split-01-rename.patch
slab cleanup: rename static functions

slab-split-02-SMP.patch
slab: enable the cpu arrays on uniprocessor

slab-split-03-tail.patch
slab: reduced internal fragmentation

slab-split-04-drain.patch
slab: take the spinlock in the drain function.

slab-split-05-name.patch
slab: remove spaces from /proc identifiers

slab-split-06-mand-cpuarray.patch
slab: cleanups and speedups

slab-split-07-inline.patch
slab: uninline poisoning checks

slab-split-08-reap.patch
slab: reap timers

cpucache_init-fix.patch
cpucache_init fix

slab-split-10-list_for_each_fix.patch
slab: for a list walking bug

shpte.patch

shpte-ifdef.patch
reduced ifdeffery in the shared pagetable code

shpte-mprotect-fix.patch
fix shared pagetable handling of mprotect

shpte-unmap-fix.patch
shared pagetable unmap fix

shmmap.patch
Proactively share page tables for shared memory

read_barrier_depends.patch
extended barrier primitives

rcu_ltimer.patch
RCU core

dcache_rcu.patch
Use RCU for dcache

#1 lore raw

Hi,

This builds fine but gets errors in depmod.

make -f arch/i386/lib/Makefile modules_install
if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.5.42-mm2; fi

depmod: *** Unresolved symbols in /lib/modules/2.5.42-mm2/kernel/fs/ext3/ext3.o
depmod:         generic_file_aio_read
depmod:         generic_file_aio_write
depmod: *** Unresolved symbols in /lib/modules/2.5.42-mm2/kernel/fs/nfs/nfs.o
depmod:         generic_file_aio_read
depmod:         generic_file_aio_write
depmod: *** Unresolved symbols in /lib/modules/2.5.42-mm2/kernel/fs/nfsd/nfsd.o
depmod:         auth_domain_find
depmod:         cache_fresh
depmod:         unix_domain_find
depmod:         auth_domain_put
depmod:         cache_flush
depmod:         cache_unregister
depmod:         add_hex
depmod:         cache_check
depmod:         svcauth_unix_purge
depmod:         get_word
depmod:         cache_clean
depmod:         cache_register
depmod:         auth_unix_lookup
depmod:         auth_unix_add_addr
depmod:         cache_init
depmod:         auth_unix_forget_old
depmod:         add_word

Hope this helps,
Ed Tomlinson

#2 lore raw
In reply to Andrew Morton

Hi Andrew,

Quoted 3 lines · Andrew Morton

+remove-kiobufs.patch

Remove the kiobuf infrastructure.

Stupid question: Would you accept a patch that extends get_user_pages() to accept an additional "struct scatterlist vector[]"?

Because otherwise we have a senseless pages[] array in memory, which we copy then into a scatterlist.

A different function using most of get_user_pages() is also possible.

And last but not least: EXPORT_SYMBOL_GPL() of both, to make it usable in modules.

Rationale: Most users of get_user_pages() and kiobufs really want a struct scatterlist sooner or later to transmit it via DMA.

PIO-Users would need a copy_from_user_to_io() and the counterpart. ALSA implements it somewhere.

So while we are at it... ;-)

Regards

Ingo Oeser

Signature · 5 lines
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/
#3 lore raw
Quoted 10 lines · Ingo Oeser

Hi Andrew,

Quoted 3 lines · Andrew Morton

+remove-kiobufs.patch

Remove the kiobuf infrastructure.

Stupid question: Would you accept a patch that extends get_user_pages() to accept an additional "struct scatterlist vector[]"?

It's not really my area Ingo. But I can wave such a patch about on the mailing lists, generally get it some review and attention I guess.

Such nfrastructure would need something which used it, as a proof-of-concept, testbed, etc...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#4 lore raw

Hi Andrew,

[I cc'ed the people relevant to this issue]

Quoted 7 lines · Andrew Morton
Quoted 2 lines · Ingo Oeser

Stupid question: Would you accept a patch that extends get_user_pages() to accept an additional "struct scatterlist vector[]"?

It's not really my area Ingo. But I can wave such a patch about on the mailing lists, generally get it some review and attention I guess.

I had waved an example on what is really needed instead of kiobuf crap some time ago[1]. This raised a discussion on linux-scsi[2] (but I'm not subscribed there) and someone[2] actually successfully tested this.

Quoted 2 lines

Such nfrastructure would need something which used it, as a proof-of-concept, testbed, etc...

I would love to test my ideas out, but the special purpose device where I need it for has bit-errors on its big SDRAM chips and I can only use a small 32K area of storage for testing, which is not expected to reveal any noticable performance from that method, due to the high setup overhead. I think you know the numbers from direct-io.

The video hardware, where you (or Geert?) basically implemented the things, we proposed[3] would be a perfect testbed for this.

Thanks & Regards

Ingo Oeser

[1] <[email protected]> on lkml
[2] <[email protected]> on linux-scsi
[3] Attached here.

Signature · 1 line
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth

/* Proposal for User space <-> scatterlist mapping
* by Ingo Oeser <[email protected]>
* and Kai Makisara <[email protected]> */

#define SGMAP_MAX_UDMA_PAGES (1 << (19 - PAGE_SHIFT))
#define SGMAP_MAX_UDMA_PAGES_INLINE 16

/* An experiment ... */
/* Pin down user pages and put them into a scatter gather list */ int sg_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
unsigned long uaddr, size_t count, int rw)

{
	int res, i;
	unsigned int nr_pages = ((uaddr & ~PAGE_MASK) + count - 1 + ~PAGE_MASK) >> PAGE_SHIFT;
	struct page *inline_pages[SGMAP_MAX_UDMA_PAGES_INLINE];
	struct page **pages = inline_pages;

	/* User attempted Overflow! 
	 * NOTE: This kind of request must be split by the caller. 
	 */
	if ((uaddr + count) < uaddr)
		return -EINVAL;

	/* To big for provided scatterlist array */
	if (nr_pages > max_pages)
		return -ENOMEM;

	/* Hmm? */
	if (count == 0)
		return 0;

	if (unlikely(nr_pages > SGMAP_MAX_UDMA_PAGES_INLINE)) {
		pages = kmalloc(nr_pages * sizeof(pages[0]), GFP_USER);
		if (!pages)
			return -ENOMEM;
	}
	down_read(&current->mm->mmap_sem);
	res = get_user_pages(
		    current,
		    current->mm,
		    uaddr,
		    nr_pages,
		    rw == READ,	/* logic is perversed^Wreversed here :-( */
		    0,	/* don't force */
		    &pages[0],
		    NULL);
	up_read(&current->mm->mmap_sem);

	/* Errors and no page mapped should return here */
	if (res <= 0)
		goto out_free;

	memset(sgl, 0, sizeof(*sgl) * nr_pages);

	sgl[0].page = pages[0];
	sgl[0].offset = uaddr & ~PAGE_MASK;

	/* FIXME: flush superflous for rw==READ, 
	 *  probably wrong function for rw==WRITE
	 */
	flush_dcache_page(pages[0]);

	/* Page crossing transfers need these adjustments */
	if (res > 1) {
		for (i = 1; i < res; i++) {
			sgl[i].offset = 0;
			sgl[i].page = pages[i];
			sgl[i].length = PAGE_SIZE;

			flush_dcache_page(pages[i]);
		}
		sgl[0].length = PAGE_SIZE - sgl[0].offset;
		count -= sgl[0].length;
		count -= (res - 2) * PAGE_SIZE;
	}
	sgl[res - 1].length = count;

out_free:

	if (pages != inline_pages)
		kfree(pages);
	return res;
}

/* And unmap them... */
int sg_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages)

{
	int i;

	for (i = 0; i < nr_pages; i++)
		page_cache_release(sgl[i].page);

	return 0;
}
#5 lore raw
Quoted 28 lines · Ingo Oeser

Hi Andrew,

[I cc'ed the people relevant to this issue]

Quoted 7 lines · Andrew Morton
Quoted 2 lines · Ingo Oeser

Stupid question: Would you accept a patch that extends get_user_pages() to accept an additional "struct scatterlist vector[]"?

It's not really my area Ingo. But I can wave such a patch about on the mailing lists, generally get it some review and attention I guess.

I had waved an example on what is really needed instead of kiobuf crap some time ago[1]. This raised a discussion on linux-scsi[2] (but I'm not subscribed there) and someone[2] actually successfully tested this.

Quoted 2 lines

Such nfrastructure would need something which used it, as a proof-of-concept, testbed, etc...

I would love to test my ideas out, but the special purpose device where I need it for has bit-errors on its big SDRAM chips and I can only use a small 32K area of storage for testing, which is not expected to reveal any noticable performance from that method, due to the high setup overhead. I think you know the numbers from direct-io.

Quoted 3 lines

The video hardware, where you (or Geert?) basically implemented the things, we proposed[3] would be a perfect testbed for this.

The SCSI tape driver has used an approach nearly similar to [3] from 2.5.32. The same applies to Doug Gilbert's the generic SCSI driver. The mapping and unmapping functions are duplicated in st.c and sg.c. This is meant to be a temporary solution until something useful appears elsewhere in the kernel.

The st.c versions of the mapping and unmapping functions are almost same as [3]:
- GFP_KERNEL is used instead of GFP_USER when allocating the page pointer buffer (is GFP_USER really correct in this case?)
- partial mappings are not accepted
- the unmapping functions marks pages dirty if told to do that
[3] is OK for st.c if it is the most versatile interface for other users.

The only problem so far has been with the sg driver in Doug's sgm_dd that does direct write from a driver buffer mmapped to the user program (i.e., copies data using a buffer within the driver). Doug asked me to look at the problem and try to find out if there is something wrong with an approach like [3]. I inserted some printks into sg and found out that get_user_pages() returned bogus page pointers in this case. I do not understand vm enough to say where the problem is in this special case.

Quoted 8 lines

Thanks & Regards

Ingo Oeser

[1] <[email protected]> on lkml
[2] <[email protected]> on linux-scsi
[3] Attached here.

Signature · 10 lines
Kai





--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/
#6 lore raw
In reply to Andrew Morton
Quoted 1 line · Andrew Morton

url: http://www.zip.com.au/~akpm/linux/patches/2.5/2.5.42/2.5.42-mm2/

This patch does 5 things:

(1) when the OOM killer fails and the system panics, calls show_free_areas()
(2) reorganizes show_free_areas() to use for_each_zone()
(3) adds per-cpu stats to show_free_areas()
(4) tags output from show_free_areas() with node and zone information
(5) initializes zone->per_cpu_pageset[cpu].pcp[temperature].reserved in free_area_init_core()

The net effect is better reporting of where memory went, which was essential to determining the cause of this failure, and that the reserved page stuff can actually boot. Prior to this it was getting total garbage in ->reserved after free_area_init_core():

Node 0, Zone DMA: per-cpu:
cpu 0 hot: low 32, high 96, batch 16, reserved 1683971840 cpu 0 cold: low 0, high 32, batch 16, reserved 1953719651 cpu 1 hot: low 32, high 96, batch 16, reserved 1702256479 cpu 1 cold: low 0, high 32, batch 16, reserved 825241951

And this caused a false bootmem OOM. It would have been impossible to determine the cause of failure without show_free_areas() modifications, and this is a box-killing bug that wipes out a significant fraction of the high-end developer base from 2.5.x contributions as well as preventing all i386 NUMA boxen, which the highest volume high-end configurations, from booting. Furthermore, it also cleans up show_free_areas() in a very straightforward fashion.

Against 2.5.42-mm2.

mm/oom_kill.c +3 -1
diff -urpN mm-2.5.42/mm/oom_kill.c virgin-2.5.42/mm/oom_kill.c
@@ -172,8 +172,10 @@ static void oom_kill(void)
 	p = select_bad_process();
 
 	/* Found nothing?!?! Either we hang forever, or we panic. */
-	if (p == NULL)
+	if (!p) {
+		show_free_areas();
 		panic("Out of memory and no killable processes...\n");
+	}
 
 	/* kill all processes that share the ->mm (i.e. all threads) */
 	do_each_thread(g, q)
mm/page_alloc.c +62 -39

137 lines not on this page · raw message

#7 lore raw

mm/page_alloc.c static void __init free_area_init_core(s · line 1132

Quoted 9 lines · William Lee Irwin III
mm/page_alloc.c +1 -0
@@ -1104,6 +1126,7 @@ static void __init free_area_init_core(s
                        pcp->low = 0;
                        pcp->high = 32;
                        pcp->batch = 16;
+                       pcp->reserved = 0;
                        INIT_LIST_HEAD(&pcp->list);
                }
                INIT_LIST_HEAD(&zone->active_list);

OK. But that's been there since 2.5.40-mm2. Why did it suddenly bite?

#8 lore raw
Quoted 8 lines · William Lee Irwin III
Quoted 8 lines
mm/page_alloc.c +1 -0
@@ -1104,6 +1126,7 @@ static void __init free_area_init_core(s
                        pcp->low = 0;
                        pcp->high = 32;
                        pcp->batch = 16;
+                       pcp->reserved = 0;
                        INIT_LIST_HEAD(&pcp->list);
                }
                INIT_LIST_HEAD(&zone->active_list);
Quoted 2 lines · Andrew Morton

OK. But that's been there since 2.5.40-mm2. Why did it suddenly bite?

I must have been way too tired or something:

(1) It's embedded in struct zone, hence bootmem allocated, hence already zeroed.

(2) The logs still show the show_free_areas() call immediately after

	free_all_bootmem_core() seeing the garbage ->reserved values.

Bill

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

(1) It's embedded in struct zone, hence bootmem allocated, hence already zeroed.

The struct zone doesn't get automatically zeroed on all architectures.

Rik

Signature · 3 lines
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/		http://distro.conectiva.com/
Current spamtrap:  <a href=mailto:"[email protected]">[email protected]</a>
#10 lore raw
Quoted 2 lines · William Lee Irwin III
Quoted 2 lines

(1) It's embedded in struct zone, hence bootmem allocated, hence already zeroed.

Quoted 1 line · Rik van Riel

The struct zone doesn't get automatically zeroed on all architectures.

It actually doesn't come out of bootmem. It's tacked onto min_low_pfn because it's being dynamically allocated prior to init_bootmem().

Bill

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

(2) The logs still show the show_free_areas() call immediately after

	free_all_bootmem_core() seeing the garbage ->reserved values.

Disregard this. I reread the logs too early in the morning.

Bill

#12 lore raw
In reply to William Lee Irwin III
Quoted 10 lines · William Lee Irwin III

This patch does 5 things:

(1) when the OOM killer fails and the system panics, calls show_free_areas()
(2) reorganizes show_free_areas() to use for_each_zone()
(3) adds per-cpu stats to show_free_areas()
(4) tags output from show_free_areas() with node and zone information
(5) initializes zone->per_cpu_pageset[cpu].pcp[temperature].reserved in free_area_init_core()

hm. I just ran out of swap and got oom-killed.

Would it make sense to call show_free_areas() for _all_ oom-killings?

I think so. At least during the development cycle. --
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#13 lore raw
In reply to Andrew Morton
Quoted 1 line · Andrew Morton

url: http://www.zip.com.au/~akpm/linux/patches/2.5/2.5.42/2.5.42-mm2/

To future-proof NUMA-Q vs. similar issues to pcp->reserved:

arch/i386/mm/discontig.c +1 -0
@@ -70,6 +70,7 @@ static void __init allocate_pgdat(int ni
 	node_datasz = PFN_UP(sizeof(struct pglist_data));
 	NODE_DATA(nid) = (pg_data_t *)(__va(min_low_pfn << PAGE_SHIFT));
 	min_low_pfn += node_datasz;
+	memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
 }
 
 /*