Skip to contentSkip to conversation

2.5.46-mm2

DISCUSSION Andrew Morton 6 participants 17 messages Nov 10, 2002 – Nov 11, 2002

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

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

There's some work here to address some of the whacky corner cases which have traditionally knocked the VM over. Some are fixed, some still need work. My latest party trick is to run a 4G highmem machine with 800 megabytes of ZONE_NORMAL under mlock. Can't say that it completely works yet...

Of note in -mm2 is a patch from Chris Mason which teaches reiserfs to use the mpage code for reads - it should show a nice reduction in CPU load under reiserfs reads.

And Jens's rbtree-based insertion code for the request queue. Which means that the queues can be grown a *lot* if people want to play with that. The VM should be able to cope with it fine.

And a new set of block a_ops which never, ever, ever attach buffer_heads to file pagecache. Implemented for ext2 - use `mount -o nobh'.

And several VM tuning and stability tweaks.

Changes since 2.5.46-mm1:

-net-timer-init.patch

Merged

+rcu-stats.patch

Stats in /proc/rcu

-mbcache-atomicity-fix.patch
-htree-fix.patch

Merged

+nuke-disk-stats.patch

Remove the disk stats from /proc/stat: they're in /sys now.

-akpm-deadline.patch

The IO scheduler can now be tuned via /sys/block/hda/iosched

+aio-direct-io-infrastructure.patch
+aio-direct-io.patch

AIO support for direct-io

+reiserfs-readpages.patch

Use mpage in reiserfs3

+remove-inode-buffers.patch

Drop clean metadata buffers from inodes when we're trying to reclaim them.

+unfreeable-zones.patch

Handle weird situations where all of a zone's pages are pinned by something.

+mpage-kmap.patch

s/kmap/kmap_atomic/ in the mpage code

+nobh.patch

Don't attached buffer_heads to pagecache for writes.

+inode-reclaim-balancing.patch

Fix some overeager reclaim of dentries and hence inodes.

+rbtree-iosched.patch

Tree-based IO scheduler insertion, and /sys/block/XXX/iosched tunables

All patches:

linus.patch
cset-1.786.157.7-to-1.801.txt.gz

kgdb.patch

genksyms-hurts.patch
fix exporting of per-cpu symbols for modversions

misc.patch
misc fixes

writev-bad-seg-fix.patch
Fix readv/writev return value

wli-01-iowait.patch
SMP iowait stats

wli-02-zap_hugetlb_resources.patch
hugetlb: fix zap_hugetlb_resources()

wli-03-remove-unlink_vma.patch
hugetlb: remove unlink_vma()

wli-04-internalize-hugetlb-init.patch
hugetlb: internalize hugetlb init

wli-05-sysctl-cleanup.patch
hugetlb: remove sysctl.c intrusion

wli-06-cleanup-proc.patch
hugetlb: remove /proc/ intrusion

wli-07-hugetlb-static.patch
hugetlb: make private functions static

rcu-stats.patch
RCU statistics reporting

msec-fix.patch
Fix math underflow in disk accounting

touch_buffer-fix.patch
buffer_head refcounting fixes and cleanup

pgalloc-accounting-fix.patch
fix page alloc/free accounting

nuke-disk-stats.patch
duplicate statistics being gathered

irq-save-vm-locks.patch
make mapping->page_lock irq-safe

irq-safe-private-lock.patch
make mapping->private_lock irq-safe

aio-direct-io-infrastructure.patch
AIO support for raw/O_DIRECT

aio-direct-io.patch
AIO support for raw/O_DIRECT

reiserfs-readpages.patch
reiserfs v3 readpages support

remove-inode-buffers.patch
try to remove buffer_heads from to-be-reaped inodes

resurrect-incremental-min.patch
strengthen the `incremental min' logic in the page allocator

unfreeable-zones.patch
VM: handle zones which are ful of unreclaimable pages

mpage-kmap.patch
kmap->kmap_atomic in mpage.c

nobh.patch
no-buffer-head ext2 option

inode-reclaim-balancing.patch
better inode reclaim balancing

rbtree-iosched.patch
Subject: Re: 2.5.46: ide-cd cdrecord success report

page-reservation.patch
Page reservation API

wli-show_free_areas.patch
show_free_areas extensions

dcache_rcu.patch
Use RCU for dcache

shpte-ng.patch
pagetable sharing for ia32

#1 lore raw
Quoted 3 lines · Andrew Morton

And Jens's rbtree-based insertion code for the request queue. Which means that the queues can be grown a *lot* if people want to play with that. The VM should be able to cope with it fine.

I've attached a small document describing the deadline io scheduler tunables. stream_unit is not in Andrew's version, yet, it uses a hard defined 128KiB. Also, Andrew didn't apply the rbtree patch only the tunable patch. So it uses the same insertion algorithm as the default kernel, two linked lists.

Signature · 1 line
Jens Axboe

Deadline IO scheduler tunables
==============================

This little file attempts to document how the deadline io scheduler works. In particular, it will clarify the meaning of the exposed tunables that may be of interest to power users.

Each io queue has a set of io scheduler tunables associated with it. These tunables control how the io scheduler works. You can find these entries in:

/sys/block/<device>/iosched

assuming that you have sysfs mounted on /sys. If you don't have sysfs mounted, you can do so by typing:

# mount none /sys -t sysfs

********************************************************************************

read_expire (in ms)
-----------

The goal of the deadline io scheduler is to attempt to guarentee a start service time for a request. As we focus mainly on read latencies, this is tunable. When a read request first enters the io scheduler, it is assigned a deadline that is the current time + the read_expire value in units of miliseconds.

fifo_batch
----------

When a read request expires its deadline, we must move some requests from the sorted io scheduler list to the block device dispatch queue. fifo_batch controls how many requests we move, based on the cost of each request. A request is either qualified as a seek or a stream. The io scheduler knows the last request that was serviced by the drive (or will be serviced right before this one). See seek_cost and stream_unit.

seek_cost
---------

The cost of a seek compared to a stream_unit (see below).

stream_unit (in KiB)
-----------

How many KiB we qualify as a single stream unit. A stream unit has a cost of 1, so if a request is X KiB big, it has a cost of

cost = (X + stream_unit - 1) / stream_unit

stream_unit, seek_cost, and fifo_batch control how many requests we potentially move to the dispatch queue when a request expires.

write_starved (number of dispatches)
-------------

When we have to move requests from the io scheduler queue to the block device dispatch queue, we always give a preference to reads. However, we don't want to starve writes indefinitely either. So writes_starved controls how many times we give preference to reads over writes. When that has been done writes_starved number of times, we dispatch some writes based on the same criteria as reads.

front_merges (bool)
------------

Sometimes it happens that a request enters the io scheduler that is contigious with a request that is already on the queue. Either it fits in the back of that request, or it fits at the front. That is called either a back merge candidate or a front merge candidate. Due to the way files are typically laid out, back merges are much more common than front merges. For some work loads, you may even know that it is a waste of time to spend any time attempting to front merge requests. Setting front_merges to 0 disables this functionality. Front merges may still occur due to the cached last_merge hint, but since that comes at basically 0 cost we leave that on. We simply disable the rbtree front sector lookup when the io scheduler merge function is called.

Nov 11 2002, Jens Axboe <[email protected]>

#2 lore raw
Quoted 3 lines · Andrew Morton
Quoted 3 lines

And Jens's rbtree-based insertion code for the request queue. Which means that the queues can be grown a *lot* if people want to play with that. The VM should be able to cope with it fine.

Quoted 5 lines · Jens Axboe

I've attached a small document describing the deadline io scheduler tunables. stream_unit is not in Andrew's version, yet, it uses a hard defined 128KiB. Also, Andrew didn't apply the rbtree patch only the tunable patch. So it uses the same insertion algorithm as the default kernel, two linked lists.

Okay, then I'll want the rbtree code for benchmarking.

Thanks,
Bill

#3 lore raw
Quoted 5 lines · William Lee Irwin III
Quoted 3 lines · Andrew Morton
Quoted 3 lines

And Jens's rbtree-based insertion code for the request queue. Which means that the queues can be grown a *lot* if people want to play with that. The VM should be able to cope with it fine.

Quoted 8 lines
Quoted 5 lines · Jens Axboe

I've attached a small document describing the deadline io scheduler tunables. stream_unit is not in Andrew's version, yet, it uses a hard defined 128KiB. Also, Andrew didn't apply the rbtree patch only the tunable patch. So it uses the same insertion algorithm as the default kernel, two linked lists.

Okay, then I'll want the rbtree code for benchmarking.

Sure, I want to talk akpm into merging the rbtree code for real. Or I can just drop you my current version, if you want.

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 5 lines · Jens Axboe
Quoted 5 lines
Quoted 5 lines

I've attached a small document describing the deadline io scheduler tunables. stream_unit is not in Andrew's version, yet, it uses a hard defined 128KiB. Also, Andrew didn't apply the rbtree patch only the tunable patch. So it uses the same insertion algorithm as the default kernel, two linked lists.

Quoted 1 line · William Lee Irwin III
Quoted 1 line

Okay, then I'll want the rbtree code for benchmarking.

Quoted 2 lines · Jens Axboe

Sure, I want to talk akpm into merging the rbtree code for real. Or I can just drop you my current version, if you want.

Go for it, I'm just trying to get tiobench to actually run (seems to have new/different "die from too many threads" behavior wrt. --threads). Dropping me a fresh kernel shouldn't slow anything down.

Bill

P.S.: elvtune gets hung for a long time, it says:
ioctl get: Inappropriate ioctl for device
did it schedule with something held and get out of deadlock free?

P.P.S: kgdb broke wchan reporting... investigating

#5 lore raw
Quoted 10 lines · William Lee Irwin III
Quoted 5 lines · Jens Axboe
Quoted 5 lines
Quoted 5 lines

I've attached a small document describing the deadline io scheduler tunables. stream_unit is not in Andrew's version, yet, it uses a hard defined 128KiB. Also, Andrew didn't apply the rbtree patch only the tunable patch. So it uses the same insertion algorithm as the default kernel, two linked lists.

Quoted 1 line · William Lee Irwin III
Quoted 1 line

Okay, then I'll want the rbtree code for benchmarking.

Quoted 7 lines
Quoted 2 lines · Jens Axboe

Sure, I want to talk akpm into merging the rbtree code for real. Or I can just drop you my current version, if you want.

Go for it, I'm just trying to get tiobench to actually run (seems to have new/different "die from too many threads" behavior wrt. --threads). Dropping me a fresh kernel shouldn't slow anything down.

Complete diff against 2.5.46-BK current attached.

Quoted 3 lines

P.S.: elvtune gets hung for a long time, it says:
ioctl get: Inappropriate ioctl for device
did it schedule with something held and get out of deadlock free?

BLKELVGET and SET are not defined anymore, however it's weird that it doesn't just return -ENOTTY immediately. That ioctl interface was a mistake from the beginning. Can you see where it is hanging? It could just be Andrew's patch, it looked somewhat incomplete.

===== arch/mips64/kernel/ioctl32.c 1.8 vs edited =====

arch/mips64/kernel/ioctl32.c +0 -2
@@ -759,8 +759,6 @@
 	IOCTL32_HANDLER(BLKSECTGET, w_long),
 	IOCTL32_DEFAULT(BLKSSZGET),
 	IOCTL32_HANDLER(BLKPG, blkpg_ioctl_trans),
-	IOCTL32_DEFAULT(BLKELVGET),
-	IOCTL32_DEFAULT(BLKELVSET),
 	IOCTL32_DEFAULT(BLKBSZGET),
 	IOCTL32_DEFAULT(BLKBSZSET),
 

===== arch/parisc/kernel/ioctl32.c 1.1 vs edited =====

arch/parisc/kernel/ioctl32.c +0 -3
@@ -3468,9 +3468,6 @@
 COMPATIBLE_IOCTL(DRM_IOCTL_UNLOCK)
 COMPATIBLE_IOCTL(DRM_IOCTL_FINISH)
 #endif /* DRM */
-/* elevator */
-COMPATIBLE_IOCTL(BLKELVGET)
-COMPATIBLE_IOCTL(BLKELVSET)
 /* Big R */
 COMPATIBLE_IOCTL(RNDGETENTCNT)
 COMPATIBLE_IOCTL(RNDADDTOENTCNT)

===== arch/ppc64/kernel/ioctl32.c 1.14 vs edited =====

arch/ppc64/kernel/ioctl32.c +0 -15
@@ -3617,22 +3617,10 @@
 }	
 
 /* Fix sizeof(sizeof()) breakage */
-#define BLKELVGET_32	_IOR(0x12,106,int)
-#define BLKELVSET_32	_IOW(0x12,107,int)
 #define BLKBSZGET_32	_IOR(0x12,112,int)
 #define BLKBSZSET_32	_IOW(0x12,113,int)
 #define BLKGETSIZE64_32	_IOR(0x12,114,int)
 
-static int do_blkelvget(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	return sys_ioctl(fd, BLKELVGET, arg);
-}
-
-static int do_blkelvset(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	return sys_ioctl(fd, BLKELVSET, arg);
-}
-
 static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	return sys_ioctl(fd, BLKBSZGET, arg);
@@ -4464,9 +4452,6 @@
 HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32, do_usbdevfs_reapurb),
 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal),
 /* take care of sizeof(sizeof()) breakage */
-/* elevator */
-HANDLE_IOCTL(BLKELVGET_32, do_blkelvget),
-HANDLE_IOCTL(BLKELVSET_32, do_blkelvset),
 /* block stuff */
 HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget),
 HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset),

===== arch/s390x/kernel/ioctl32.c 1.8 vs edited =====

arch/s390x/kernel/ioctl32.c +0 -3
@@ -802,9 +802,6 @@
 	IOCTL32_DEFAULT(BLKBSZGET),
 	IOCTL32_DEFAULT(BLKGETSIZE64),
 
-	IOCTL32_DEFAULT(BLKELVGET),
-	IOCTL32_DEFAULT(BLKELVSET),
-
 	IOCTL32_HANDLER(HDIO_GETGEO, hd_geometry_ioctl),
 
 	IOCTL32_DEFAULT(TCGETA),

===== arch/sparc64/kernel/ioctl32.c 1.44 vs edited =====

arch/sparc64/kernel/ioctl32.c +0 -15
@@ -4248,22 +4248,10 @@
 }	
 
 /* Fix sizeof(sizeof()) breakage */
-#define BLKELVGET_32	_IOR(0x12,106,int)
-#define BLKELVSET_32	_IOW(0x12,107,int)
 #define BLKBSZGET_32	_IOR(0x12,112,int)
 #define BLKBSZSET_32	_IOW(0x12,113,int)
 #define BLKGETSIZE64_32	_IOR(0x12,114,int)
 
-static int do_blkelvget(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	return sys_ioctl(fd, BLKELVGET, arg);
-}
-
-static int do_blkelvset(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	return sys_ioctl(fd, BLKELVSET, arg);
-}
-
 static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	return sys_ioctl(fd, BLKBSZGET, arg);
@@ -5212,9 +5200,6 @@
 HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32, do_usbdevfs_reapurb)
 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
 /* take care of sizeof(sizeof()) breakage */
-/* elevator */
-HANDLE_IOCTL(BLKELVGET_32, do_blkelvget)
-HANDLE_IOCTL(BLKELVSET_32, do_blkelvset)
 /* block stuff */
 HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget)
 HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset)

===== arch/x86_64/ia32/ia32_ioctl.c 1.11 vs edited =====

arch/x86_64/ia32/ia32_ioctl.c +0 -15
@@ -3566,22 +3566,10 @@
 } 
 
 /* Fix sizeof(sizeof()) breakage */
-#define BLKELVGET_32   _IOR(0x12,106,int)
-#define BLKELVSET_32   _IOW(0x12,107,int)
 #define BLKBSZGET_32   _IOR(0x12,112,int)
 #define BLKBSZSET_32   _IOW(0x12,113,int)
 #define BLKGETSIZE64_32        _IOR(0x12,114,int)
 
-static int do_blkelvget(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-       return sys_ioctl(fd, BLKELVGET, arg);
-}
-
-static int do_blkelvset(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-       return sys_ioctl(fd, BLKELVSET, arg);
-}
-
 static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        return sys_ioctl(fd, BLKBSZGET, arg);
@@ -5005,9 +4993,6 @@
 HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32, do_usbdevfs_reapurb)
 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
 /* take care of sizeof(sizeof()) breakage */
-/* elevator */
-HANDLE_IOCTL(BLKELVGET_32, do_blkelvget)
-HANDLE_IOCTL(BLKELVSET_32, do_blkelvset)
 /* block stuff */
 HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget)
 HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset)

===== drivers/block/deadline-iosched.c 1.12 vs edited =====

drivers/block/deadline-iosched.c +395 -156

819 lines not on this page · raw message

===== drivers/block/elevator.c 1.36 vs edited =====

drivers/block/elevator.c +32 -0
@@ -381,6 +381,38 @@
 	return &q->queue_head;
 }
 
+int elv_register_fs(struct gendisk *disk)
+{
+	request_queue_t *q = disk->queue;
+	elevator_t *e;
+
+	if (!q)
+		return -ENXIO;
+
+	e = &q->elevator;
+
+	kobject_init(&e->kobj);
+
+	e->kobj.parent = kobject_get(&disk->kobj);
+	if (!e->kobj.parent)
+		return -EBUSY;
+
+	snprintf(e->kobj.name, KOBJ_NAME_LEN, "%s", "iosched");
+	e->kobj.subsys = e->elevator_subsys;
+
+	return kobject_register(&e->kobj);
+}
+
+void elv_unregister_fs(struct gendisk *disk)
+{
+	request_queue_t *q = disk->queue;
+	elevator_t *e = &q->elevator;
+
+	kobject_get(&e->kobj);
+	kobject_unregister(&e->kobj);
+	kobject_put(&disk->kobj);
+}
+
 elevator_t elevator_noop = {
 	.elevator_merge_fn		= elevator_noop_merge,
 	.elevator_next_req_fn		= elevator_noop_next_request,

===== drivers/block/genhd.c 1.58 vs edited =====

drivers/block/genhd.c +1 -0
@@ -119,6 +119,7 @@
 	blk_register_region(MKDEV(disk->major, disk->first_minor), disk->minors,
 			NULL, exact_match, exact_lock, disk);
 	register_disk(disk);
+	elv_register_fs(disk);
 }
 
 EXPORT_SYMBOL(add_disk);

===== drivers/block/ioctl.c 1.51 vs edited =====

drivers/block/ioctl.c +0 -4
@@ -128,10 +128,6 @@
 	int ret, n;
 
 	switch (cmd) {
-	case BLKELVGET:
-	case BLKELVSET:
-		/* deprecated, use the /proc/iosched interface instead */
-		return -ENOTTY;
 	case BLKRAGET:
 	case BLKFRAGET:
 		if (!arg)

===== drivers/block/ll_rw_blk.c 1.140 vs edited =====

drivers/block/ll_rw_blk.c +13 -22
@@ -73,7 +73,7 @@
 {
 	int ret;
 
-	ret = queue_nr_requests / 4 - 1;
+	ret = queue_nr_requests / 8 - 1;
 	if (ret < 0)
 		ret = 1;
 	return ret;
@@ -86,7 +86,7 @@
 {
 	int ret;
 
-	ret = queue_nr_requests / 4 + 1;
+	ret = queue_nr_requests / 8 + 1;
 	if (ret > queue_nr_requests)
 		ret = queue_nr_requests;
 	return ret;
@@ -700,31 +700,22 @@
 	seg_size = nr_phys_segs = nr_hw_segs = 0;
 	bio_for_each_segment(bv, bio, i) {
 		if (bvprv && cluster) {
-			int phys, seg;
-
-			if (seg_size + bv->bv_len > q->max_segment_size) {
-				nr_phys_segs++;
+			if (seg_size + bv->bv_len > q->max_segment_size)
 				goto new_segment;
-			}
-
-			phys = BIOVEC_PHYS_MERGEABLE(bvprv, bv);
-			seg = BIOVEC_SEG_BOUNDARY(q, bvprv, bv);
-			if (!phys || !seg)
-				nr_phys_segs++;
-			if (!seg)
+			if (!BIOVEC_PHYS_MERGEABLE(bvprv, bv))
 				goto new_segment;
-
-			if (!BIOVEC_VIRT_MERGEABLE(bvprv, bv))
+			if (!BIOVEC_SEG_BOUNDARY(q, bvprv, bv))
 				goto new_segment;
 
 			seg_size += bv->bv_len;
 			bvprv = bv;
 			continue;
-		} else {
-			nr_phys_segs++;
 		}
 new_segment:
-		nr_hw_segs++;
+		if (!bvprv || !BIOVEC_VIRT_MERGEABLE(bvprv, bv))
+			nr_hw_segs++;
+
+		nr_phys_segs++;
 		bvprv = bv;
 		seg_size = bv->bv_len;
 	}
@@ -1621,7 +1612,7 @@
 	struct list_head *next = rq->queuelist.next;
 	struct list_head *sort_head = elv_get_sort_head(q, rq);
 
-	if (next != sort_head)
+	if (next != sort_head && next != &rq->queuelist)
 		attempt_merge(q, rq, list_entry_rq(next));
 }
 
@@ -1630,7 +1621,7 @@
 	struct list_head *prev = rq->queuelist.prev;
 	struct list_head *sort_head = elv_get_sort_head(q, rq);
 
-	if (prev != sort_head)
+	if (prev != sort_head && prev != &rq->queuelist)
 		attempt_merge(q, list_entry_rq(prev), rq);
 }
 
@@ -2180,8 +2171,8 @@
 	queue_nr_requests = (total_ram >> 9) & ~7;
 	if (queue_nr_requests < 16)
 		queue_nr_requests = 16;
-	if (queue_nr_requests > 128)
-		queue_nr_requests = 128;
+	if (queue_nr_requests > 1024)
+		queue_nr_requests = 1024;
 
 	batch_requests = queue_nr_requests / 8;
 	if (batch_requests > 8)

===== fs/partitions/check.c 1.83 vs edited =====

fs/partitions/check.c +1 -0
@@ -521,6 +521,7 @@
 		invalidate_device(devp, 1);
 		delete_partition(disk, p);
 	}
+	elv_unregister_fs(disk);
 	devp = mk_kdev(disk->major,disk->first_minor);
 	invalidate_device(devp, 1);
 	disk->capacity = 0;

===== fs/sysfs/inode.c 1.59 vs edited =====

fs/sysfs/inode.c +1 -1
@@ -243,7 +243,7 @@
 	if (kobj && kobj->subsys)
 		ops = kobj->subsys->sysfs_ops;
 	if (!ops || !ops->store)
-		return 0;
+		return -EINVAL;
 
 	page = (char *)__get_free_page(GFP_KERNEL);
 	if (!page)

===== include/linux/elevator.h 1.17 vs edited =====

include/linux/elevator.h +5 -12
@@ -35,6 +35,9 @@
 	elevator_exit_fn *elevator_exit_fn;
 
 	void *elevator_data;
+
+	struct kobject kobj;
+	struct subsystem *elevator_subsys;
 };
 
 /*
@@ -49,6 +52,8 @@
 extern void elv_remove_request(request_queue_t *, struct request *);
 extern int elv_queue_empty(request_queue_t *);
 extern inline struct list_head *elv_get_sort_head(request_queue_t *, struct request *);
+extern int elv_register_fs(struct gendisk *);
+extern void elv_unregister_fs(struct gendisk *);
 
 #define __elv_add_request_pos(q, rq, pos)	\
 	(q)->elevator.elevator_add_req_fn((q), (rq), (pos))
@@ -63,18 +68,6 @@
  * starvation
  */
 extern elevator_t iosched_deadline;
-
-/*
- * use the /proc/iosched interface, all the below is history ->
- */
-typedef struct blkelv_ioctl_arg_s {
-	int queue_ID;
-	int read_latency;
-	int write_latency;
-	int max_bomb_segments;
-} blkelv_ioctl_arg_t;
-#define BLKELVGET   _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t))
-#define BLKELVSET   _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t))
 
 extern int elevator_init(request_queue_t *, elevator_t *);
 extern void elevator_exit(request_queue_t *);
Signature · 1 line
Jens Axboe
#10 lore raw
In reply to William Lee Irwin III
Quoted 11 lines · William Lee Irwin III
Quoted 5 lines · Jens Axboe
Quoted 5 lines
Quoted 5 lines

I've attached a small document describing the deadline io scheduler tunables. stream_unit is not in Andrew's version, yet, it uses a hard defined 128KiB. Also, Andrew didn't apply the rbtree patch only the tunable patch. So it uses the same insertion algorithm as the default kernel, two linked lists.

Quoted 1 line · William Lee Irwin III
Quoted 1 line

Okay, then I'll want the rbtree code for benchmarking.

Quoted 7 lines
Quoted 2 lines · Jens Axboe

Sure, I want to talk akpm into merging the rbtree code for real. Or I can just drop you my current version, if you want.

Go for it, I'm just trying to get tiobench to actually run (seems to have new/different "die from too many threads" behavior wrt. --threads). Dropping me a fresh kernel shouldn't slow anything down.

It could be the procps thing? tiobench --threads 256' shows up as a single process in top and ps due to the new thread consolidation feature. If you run ps auxm' or hit 'H' in top, all is revealed. Not my fave feature that.

Quoted 5 lines

Bill

P.S.: elvtune gets hung for a long time, it says:
ioctl get: Inappropriate ioctl for device
did it schedule with something held and get out of deadlock free?

BLKELVGET/SET was removed

Quoted 1 line

P.P.S: kgdb broke wchan reporting... investigating

?

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

Go for it, I'm just trying to get tiobench to actually run (seems to have new/different "die from too many threads" behavior wrt. --threads). Dropping me a fresh kernel shouldn't slow anything down.

Quoted 4 lines · Andrew Morton

It could be the procps thing? tiobench --threads 256' shows up as a single process in top and ps due to the new thread consolidation feature. If you run ps auxm' or hit 'H' in top, all is revealed. Not my fave feature that.

Turns out monitoring things via /proc/ slowed it down by some ridiculous factor while it was trying to spawn threads. 9 hours became less than 1s when I stopped looking.

Quoted 1 line · Andrew Morton

BLKELVGET/SET was removed

Okay, looks like there's an fs to use to get at it with.

Quoted 1 line · Andrew Morton
Quoted 1 line

P.P.S: kgdb broke wchan reporting... investigating

Quoted 1 line · Andrew Morton

?

The wchan reporting needs to get taught about kern_schedule() and user_schedule() so it can trim them off the stack, which consists of moving them between scheduling_functions_start_here() and scheduling_functions_end_here().

Bill

#13 lore raw

Re: 2.5.46-mm2 - oops

In reply to Andrew Morton
Quoted 3 lines · Andrew Morton

Of note in -mm2 is a patch from Chris Mason which teaches reiserfs to use the mpage code for reads - it should show a nice reduction in CPU load under reiserfs reads.

Booting into mm2 I get:

VFS: Mounted root (reiserfs filesystem) readonly.
Freeing unused kernel memory: 96k freed

Unable to handle kernel NULL pointer dereference at virtual address 00000004
 printing eip:
c015f967
*pde = 00000000
Oops: 0000
CPU:    0
EIP:    0060:[<c015f967>]    Not tainted
EFLAGS: 00010203

EIP is at mpage_readpages+0x47/0x140
eax: df8db954 ebx: 00000000 ecx: dff89c30 edx: dff89c30
esi: 00000007 edi: 00000000 ebp: dff89c30 esp: dff89b1c
ds: 0068 es: 0068 ss: 0068
Process swapper (pid: 1, threadinfo=dff88000 task=c151e040)

Stack: 00000000 00000000 00000000 00000000 00000000 c0325760 dfb62cd4 c0145054
       c0325740 c0145078 df90e6bc df90e6bc dfb62cd4 df90e654 df9577f4 df90e6f0
       df90e688 dfb18620 c172f654 dfa33348 dfb62cd4 00002e7c 00000000 00000007
Call Trace:
 [<c0145054>] bh_lru_install+0x94/0x100
 [<c0145078>] bh_lru_install+0xb8/0x100
 [<c0187716>] reiserfs_readpages+0x16/0x20
 [<c01847e0>] reiserfs_get_block+0x0/0x1000
 [<c013b9ac>] read_pages+0xec/0x100
 [<c0135d2c>] buffered_rmqueue+0xcc/0x180
 [<c01360a1>] __alloc_pages+0x81/0x220
 [<c013ba91>] do_page_cache_readahead+0xd1/0x160
 [<c013bb78>] page_cache_readahead+0x58/0x160
 [<c012dc4d>] do_generic_mapping_read+0x8d/0x3c0
 [<c012dfc0>] file_read_actor+0x0/0xe0
 [<c012e23f>] __generic_file_aio_read+0x19f/0x1e0
 [<c012dfc0>] file_read_actor+0x0/0xe0
 [<c012e358>] generic_file_read+0x78/0xa0
 [<c011609e>] mm_init+0xbe/0x100
 [<c0142546>] vfs_read+0xa6/0x100
 [<c014bbf8>] kernel_read+0x38/0x60
 [<c014bfed>] prepare_binprm+0xad/0xc0
 [<c014c570>] do_execve+0x1b0/0x260
 [<c0107833>] sys_execve+0x33/0x60
 [<c0109057>] syscall_call+0x7/0xb
 [<c010511f>] init+0xdf/0x160
 [<c0105040>] init+0x0/0x160
 [<c01070a1>] kernel_thread_helper+0x5/0x24

Code: 8b 43 04 8d 73 f8 8b 13 89 42 04 89 10 ff 76 14 ff 74 24 74
 <0>Kernel panic: Attempted to kill init!

or trying a second time:

found reiserfs format "3.6" with standard journal
Reiserfs journal params: device ide2(33,3), size 8192, journal first block 18, max trans len 1024, max batch 900, max
commit age 30, max trans age 30
reiserfs: checking transaction log (ide2(33,3)) for (ide2(33,3))
Using r5 hash to sort names
VFS: Mounted root (reiserfs filesystem) readonly.
Freeing unused kernel memory: 96k freed

Unable to handle kernel NULL pointer dereference at virtual address 00000004
 printing eip:
c015f967
*pde = 00000000
Oops: 0000
CPU:    0
EIP:    0060:[<c015f967>]    Not tainted
EFLAGS: 00010203

EIP is at mpage_readpages+0x47/0x140
eax: c17d5954 ebx: 00000000 ecx: dff89c30 edx: dff89c30
esi: 00000007 edi: 00000000 ebp: dff89c30 esp: dff89b1c
ds: 0068 es: 0068 ss: 0068
Process swapper (pid: 1, threadinfo=dff88000 task=c151e040)

Stack: 00000000 00000000 00000000 00000000 00000000 c151e040 c0320400 00000000
       c01145a6 dff89b60 00000000 c151e040 00000004 00000004 dffe8b34 dffe8b34
       dff89b88 c03a5b20 c0143d6d 00000000 c151e040 c0115ec0 dff89b94 00000007
Call Trace:
 [<c01145a6>] do_schedule+0x186/0x300
 [<c0143d6d>] __wait_on_buffer+0xad/0xc0
 [<c0115ec0>] autoremove_wake_function+0x0/0x40
 [<c0187716>] reiserfs_readpages+0x16/0x20
 [<c01847e0>] reiserfs_get_block+0x0/0x1000
 [<c013b9ac>] read_pages+0xec/0x100
 [<c0135d2c>] buffered_rmqueue+0xcc/0x180
 [<c01360a1>] __alloc_pages+0x81/0x220
 [<c013ba91>] do_page_cache_readahead+0xd1/0x160
 [<c013bb78>] page_cache_readahead+0x58/0x160
 [<c012dc4d>] do_generic_mapping_read+0x8d/0x3c0
 [<c012dfc0>] file_read_actor+0x0/0xe0
 [<c012e23f>] __generic_file_aio_read+0x19f/0x1e0
 [<c012dfc0>] file_read_actor+0x0/0xe0
 [<c012e358>] generic_file_read+0x78/0xa0
 [<c011609e>] mm_init+0xbe/0x100
 [<c0142546>] vfs_read+0xa6/0x100
 [<c014bbf8>] kernel_read+0x38/0x60
 [<c014bfed>] prepare_binprm+0xad/0xc0
 [<c014c570>] do_execve+0x1b0/0x260
 [<c0107833>] sys_execve+0x33/0x60
 [<c0109057>] syscall_call+0x7/0xb
 [<c010511f>] init+0xdf/0x160
 [<c0105040>] init+0x0/0x160
 [<c01070a1>] kernel_thread_helper+0x5/0x24

Code: 8b 43 04 8d 73 f8 8b 13 89 42 04 89 10 ff 76 14 ff 74 24 74
 <0>Kernel panic: Attempted to kill init!

Hope this helps
Ed Tomlinson

#14 lore raw

Re: 2.5.46-mm2 - oops

Quoted 7 lines · Ed Tomlinson
Quoted 3 lines · Andrew Morton

Of note in -mm2 is a patch from Chris Mason which teaches reiserfs to use the mpage code for reads - it should show a nice reduction in CPU load under reiserfs reads.

Quoted 7 lines

Booting into mm2 I get:

...

Unable to handle kernel NULL pointer dereference at virtual address 00000004

...
EIP is at mpage_readpages+0x47/0x140

whoops. The ->readpages API was changed...

fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c~reiserfs-readpages-fix +1 -1
@@ -2081,7 +2081,7 @@ static int reiserfs_readpage (struct fil
 }
 
 static int
-reiserfs_readpages(struct address_space *mapping,
+reiserfs_readpages(struct file *file, struct address_space *mapping,
                struct list_head *pages, unsigned nr_pages)
 {
     return mpage_readpages(mapping, pages, nr_pages, reiserfs_get_block);

_

#15 lore raw

Re: 2.5.46-mm2 - oops

Quoted 20 lines · Andrew Morton
Quoted 5 lines · Ed Tomlinson
Quoted 3 lines · Andrew Morton

Of note in -mm2 is a patch from Chris Mason which teaches reiserfs to use the mpage code for reads - it should show a nice reduction in CPU load under reiserfs reads.

Quoted 8 lines

Booting into mm2 I get:

...

Unable to handle kernel NULL pointer dereference at virtual address

00000004

...
EIP is at mpage_readpages+0x47/0x140

whoops. The ->readpages API was changed...

fs/reiserfs/inode.c static int reiserfs_readpage (struct fil · line 2087

Quoted 8 lines
fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c~reiserfs-readpages-fix +1 -1
@@ -2081,7 +2081,7 @@ static int reiserfs_readpage (struct fil
 }
 
 static int
-reiserfs_readpages(struct address_space *mapping,
+reiserfs_readpages(struct file *file, struct address_space *mapping,
                struct list_head *pages, unsigned nr_pages)
 {
     return mpage_readpages(mapping, pages, nr_pages, reiserfs_get_block);

That fixes it.

Thanks
Ed Tomlinson

#6 lore raw
In reply to Jens Axboe
Quoted 5 lines · Jens Axboe

Complete diff against 2.5.46-BK current attached.

[rbtree IO scheduler.. ]

Well it's nice to see 250 megabytes under writeback to a single queue, but this could become a bit of a problem:

	blkdev_requests:     5760KB     5767KB   99.86

(gdb) p sizeof(struct request)
$1 = 136

On a Pentium 4, that will be rounded up to 256 bytes, so it'd be up around 10 megabytes. Now imagine 200 disks....

Putting struct request on a diet would help - get it under 128 bytes. Also, I'd suggest that SLAB_HWCACHE_ALIGN not be used in the blkdev_requests slab.

(SLAB_HWCACHE_ALIGN is waaaay overused, btw)

But we'll still have a problem with hundreds of disks.

Of course, I'm assuming that there's a significant benefit in having 1024 requests. Perhaps there isn't, so we don't have a problem. But if it _is_ good (and for some things it will be), we need to do something sterner.

It is hard to justify 1024 read requests, so the read pool and the write pool could be split up. 128 read requests, 1024 write requests.

Still not enough.

Now, 1024 requests is enough to put up to 512 megabytes of memory under I/O. Which is cool, but it is unlikely that anyone would want to put 512 megs under IO against 200 disks at the same time.

Which means that we need a common pool. Maybe a fixed pool of 128 requests per queue, then any additional requests should be dynamically allocated on a best-effort basis. A mempool-per-queue would do that quite neatly. (Using GFP_ATOMIC & ~_GFP_HIGH). The throttling code would need some rework.

All of which is a bit of a hassle. I'll do an mm3 later today which actually has the damn code in it and let's get in and find out whether the huge queue is worth pursuing.

#16 lore raw

Re: 2.5.46-mm2 - oops

In reply to Andrew Morton
Quoted 20 lines · Andrew Morton
Quoted 5 lines · Ed Tomlinson
Quoted 3 lines · Andrew Morton

Of note in -mm2 is a patch from Chris Mason which teaches reiserfs to use the mpage code for reads - it should show a nice reduction in CPU load under reiserfs reads.

Quoted 8 lines

Booting into mm2 I get:

...

Unable to handle kernel NULL pointer dereference at virtual address

00000004

...
EIP is at mpage_readpages+0x47/0x140

whoops. The ->readpages API was changed...

--- 25/fs/reiserfs/inode.c~reiserfs-readpages-fix Sun Nov 10 10:44:28
2002 +++ 25-akpm/fs/reiserfs/inode.c Sun Nov 10 10:44:39 2002

fs/reiserfs/inode.c static int reiserfs_readpage (struct fil · line 2085

Quoted 6 lines
fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c~reiserfs-readpages-fix +1 -1
@@ -2081,7 +2081,7 @@ static int reiserfs_readpage (struct fil
 }
 
 static int
-reiserfs_readpages(struct address_space *mapping,
+reiserfs_readpages(struct file *file, struct address_space *mapping,
                struct list_head *pages, unsigned nr_pages)

Why it wasn't catched by compiler? Does C allow assignments with incompatible pointers without cast?
--
vda

#7 lore raw
In reply to Andrew Morton
Quoted 3 lines · Andrew Morton

All of which is a bit of a hassle. I'll do an mm3 later today which actually has the damn code in it and let's get in and find out whether the huge queue is worth pursuing.

The benchmarks/stress tests take longer to run than I have time left to use the system where nobh really matters, and the driver breakage from the recent SCSI changes (qlogic 2300, vendor code) isn't getting fixed anytime in the next 8 hours anyway, esp. since I have zero SCSI knowledge.

So I'm stuck until next weekend, though I guess I can check to see if it oopses etc. on smaller systems.

Bill

#8 lore raw
In reply to Andrew Morton
Quoted 10 lines · Andrew Morton
Quoted 5 lines · Jens Axboe

Complete diff against 2.5.46-BK current attached.

[rbtree IO scheduler.. ]

Well it's nice to see 250 megabytes under writeback to a single queue, but this could become a bit of a problem:

Quoted 7 lines
	blkdev_requests:     5760KB     5767KB   99.86

(gdb) p sizeof(struct request)
$1 = 136

On a Pentium 4, that will be rounded up to 256 bytes, so it'd be up around 10 megabytes. Now imagine 200 disks....

Yes I'm well aware of this problem...

Quoted 3 lines

Putting struct request on a diet would help - get it under 128 bytes. Also, I'd suggest that SLAB_HWCACHE_ALIGN not be used in the blkdev_requests slab.

I can probably trim it to under 128 bytes.

Quoted 9 lines

But we'll still have a problem with hundreds of disks.

Of course, I'm assuming that there's a significant benefit in having 1024 requests. Perhaps there isn't, so we don't have a problem. But if it _is_ good (and for some things it will be), we need to do something sterner.

It is hard to justify 1024 read requests, so the read pool and the write pool could be split up. 128 read requests, 1024 write requests.

Agree, at least to the idea of making reads and writes different sized pools. The exact split is harder.

Quoted 12 lines

Still not enough.

Now, 1024 requests is enough to put up to 512 megabytes of memory under I/O. Which is cool, but it is unlikely that anyone would want to put 512 megs under IO against 200 disks at the same time.

Which means that we need a common pool. Maybe a fixed pool of 128 requests per queue, then any additional requests should be dynamically allocated on a best-effort basis. A mempool-per-queue would do that quite neatly. (Using GFP_ATOMIC & ~_GFP_HIGH). The throttling code would need some rework.

Quoted 3 lines

All of which is a bit of a hassle. I'll do an mm3 later today which actually has the damn code in it and let's get in and find out whether the huge queue is worth pursuing.

I've already done exactly this (mempool per queue, global slab). I'll share it later today.

But yes, lets see some numbers on huge queues first. Otherwise we can just fall back to using a decent 128/512 split for reads/writes, or whatever is a good split.

Signature · 1 line
Jens Axboe
#12 lore raw
In reply to William Lee Irwin III
Quoted 6 lines · William Lee Irwin III
Quoted 3 lines · William Lee Irwin III
Quoted 3 lines

Go for it, I'm just trying to get tiobench to actually run (seems to have new/different "die from too many threads" behavior wrt. --threads). Dropping me a fresh kernel shouldn't slow anything down.

On Sun, Nov 10, 2002 at 08:58:28AM -0800, Andrew Morton wrote:

Quoted 8 lines
Quoted 4 lines

It could be the procps thing? tiobench --threads 256' shows up as a single process in top and ps due to the new thread consolidation feature. If you run ps auxm' or hit 'H' in top, all is revealed. Not my fave feature that.

Turns out monitoring things via /proc/ slowed it down by some ridiculous factor while it was trying to spawn threads. 9 hours became less than 1s when I stopped looking.

Ah!
You just rediscovered the strange world of quantum physics:
the result of your experiment depends on wether you're looking or not.

:-)

Signature · 4 lines
 /"\                             | "I never much liked Macs.
 \ /     ASCII RIBBON CAMPAIGN   |  All the interesting stuff is hidden away."
  X        AGAINST HTML MAIL     |    --  Linus Torvalds (at the Geek Cruise)
 / \
#9 lore raw
In reply to Jens Axboe
Quoted 5 lines · Jens Axboe

I've already done exactly this (mempool per queue, global slab). I'll share it later today.
But yes, lets see some numbers on huge queues first. Otherwise we can just fall back to using a decent 128/512 split for reads/writes, or whatever is a good split.

This just got real hard real fast and we'll be waiting at least a week for "real" results from me.

Sorry, I can't fix vendor drivers on-demand. Recent SCSI changes broke the out-of-tree crap and I don't have the driver and/or in-kernel SCSI/FC expertise to deal with it.

Bill