Skip to contentSkip to conversation

2.4.10pre7aa1

DISCUSSION Applied Christoph Hellwig 4 participants 14 messages Sep 10, 2001 – Sep 16, 2001 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 5 lines · In article <[email protected]> you wrote:

Only in 2.4.10pre4aa1: 00_paride-max_sectors-1
Only in 2.4.10pre7aa1: 00_paride-max_sectors-2

Rediffed (also noticed the gendisk list changes deleted too much stuff here so resurrected it).

Do you plan to submit the max_sectors changes to Linus & Alan? Otherwise I will do as they seem to be needed for reliable operation.

Quoted 8 lines

Only in 2.4.10pre7aa1: 00_rcu-1

wait_for_rcu and call_rcu implementation (from IBM). I did some modifications with respect to the original version from IBM. In particular I dropped the vmalloc_rcu/kmalloc_rcu, the rcu_head must always be allocated in the data structures, it has to be a field of a class, rather than hiding it in the allocation and playing dirty and risky with casts on a bigger allocation.

Do we really need yet-another per-CPU thread for this? I'd prefer to have the context thread per-CPU instead (like in Ben's asynchio patch) and do this as well.

BTW, do you plan to merge patches that actually _use_ this into your tree?

Quoted 4 lines

Only in 2.4.10pre4aa1: 10_prefetch-4
Only in 2.4.10pre7aa1: 10_prefetch-5

Part of prefetch in mainline, rediffed the architectural parts.

In my tree I also have an ia64 prefetch patch (I think it's from redhat, not sure though), it's appended if you want to take it.

Christoph

Signature · 30 lines
Of course it doesn't work. We've performed a software upgrade.

--- linux/include/asm-ia64/processor.h.org	Thu Jun 28 12:43:20 2001
+++ linux/include/asm-ia64/processor.h	Thu Jun 28 12:48:28 2001
@@ -958,6 +958,25 @@
 	return result;
 }
 
+
+#define ARCH_HAS_PREFETCH
+#define ARCH_HAS_PREFETCHW
+#define ARCH_HAS_SPINLOCK_PREFETCH
+#define PREFETCH_STRIDE 256
+
+extern inline void prefetch(const void *x)
+{
+         __asm__ __volatile__ ("lfetch [%0]" : : "r"(x));
+}
+         
+extern inline void prefetchw(const void *x)
+{
+	__asm__ __volatile__ ("lfetch.excl [%0]" : : "r"(x));
+}
+
+#define spin_lock_prefetch(x)   prefetchw(x)
+
+                  
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_IA64_PROCESSOR_H */
#2 lore raw
In reply to a message not in the archive
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · In article <[email protected]> you wrote:

Only in 2.4.10pre4aa1: 00_paride-max_sectors-1
Only in 2.4.10pre7aa1: 00_paride-max_sectors-2

Rediffed (also noticed the gendisk list changes deleted too much stuff here so resurrected it).

Do you plan to submit the max_sectors changes to Linus & Alan? Otherwise I will do as they seem to be needed for reliable operation.

agreed, Linus, here it is ready for merging into mainline:

drivers/block/paride/pd.c +9 -53
diff -urN 2.4.10pre6/drivers/block/paride/pd.c paride/drivers/block/paride/pd.c
@@ -287,6 +287,7 @@
 static struct hd_struct pd_hd[PD_DEVS];
 static int pd_sizes[PD_DEVS];
 static int pd_blocksizes[PD_DEVS];
+static int pd_maxsectors[PD_DEVS];
 
 #define PD_NAMELEN	8
 
@@ -385,56 +386,6 @@
 	}
 }
 
-static inline int pd_new_segment(request_queue_t *q, struct request *req, int max_segments)
-{
-	if (max_segments > cluster)
-		max_segments = cluster;
-
-	if (req->nr_segments < max_segments) {
-		req->nr_segments++;
-		return 1;
-	}
-	return 0;
-}
-
-static int pd_back_merge_fn(request_queue_t *q, struct request *req, 
-			    struct buffer_head *bh, int max_segments)
-{
-	if (req->bhtail->b_data + req->bhtail->b_size == bh->b_data)
-		return 1;
-	return pd_new_segment(q, req, max_segments);
-}
-
-static int pd_front_merge_fn(request_queue_t *q, struct request *req, 
-			     struct buffer_head *bh, int max_segments)
-{
-	if (bh->b_data + bh->b_size == req->bh->b_data)
-		return 1;
-	return pd_new_segment(q, req, max_segments);
-}
-
-static int pd_merge_requests_fn(request_queue_t *q, struct request *req,
-				struct request *next, int max_segments)
-{
-	int total_segments = req->nr_segments + next->nr_segments;
-	int same_segment;
-
-	if (max_segments > cluster)
-		max_segments = cluster;
-
-	same_segment = 0;
-	if (req->bhtail->b_data + req->bhtail->b_size == next->bh->b_data) {
-		total_segments--;
-		same_segment = 1;
-	}
-    
-	if (total_segments > max_segments)
-		return 0;
-
-	req->nr_segments = total_segments;
-	return 1;
-}
-
 int pd_init (void)
 
 {       int i;
@@ -448,9 +399,6 @@
         }
 	q = BLK_DEFAULT_QUEUE(MAJOR_NR);
 	blk_init_queue(q, DEVICE_REQUEST);
-	q->back_merge_fn = pd_back_merge_fn;
-	q->front_merge_fn = pd_front_merge_fn;
-	q->merge_requests_fn = pd_merge_requests_fn;
         read_ahead[MAJOR_NR] = 8;       /* 8 sector (4kB) read ahead */
         
 	pd_gendisk.major = major;
@@ -460,6 +408,9 @@
 	for(i=0;i<PD_DEVS;i++) pd_blocksizes[i] = 1024;
 	blksize_size[MAJOR_NR] = pd_blocksizes;
 
+	for(i=0;i<PD_DEVS;i++) pd_maxsectors[i] = cluster;
+	max_sectors[MAJOR_NR] = pd_maxsectors;
+
 	printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
 		name,name,PD_VERSION,major,cluster,nice);
 	pd_init_units();
@@ -642,6 +593,11 @@
 
         devfs_unregister_blkdev(MAJOR_NR,name);
 	del_gendisk(&pd_gendisk);
+
+	for (unit=0;unit<PD_UNITS;unit++) 
+	   if (PD.present) pi_release(PI);
+
+	max_sectors[MAJOR_NR] = NULL;
 }
 
 #endif
Quoted 9 lines
Quoted 8 lines

Only in 2.4.10pre7aa1: 00_rcu-1

wait_for_rcu and call_rcu implementation (from IBM). I did some modifications with respect to the original version from IBM. In particular I dropped the vmalloc_rcu/kmalloc_rcu, the rcu_head must always be allocated in the data structures, it has to be a field of a class, rather than hiding it in the allocation and playing dirty and risky with casts on a bigger allocation.

Quoted 3 lines

Do we really need yet-another per-CPU thread for this? I'd prefer to have the context thread per-CPU instead (like in Ben's asynchio patch) and do this as well.

The first desing solution I proposed to Paul and Dipankar was just to use ksoftirqd for that (in short set need_resched and wait it to be cleared), it worked out nicely and it was a sensible improvement with respect to their previous patches. (also it was reliable, we cannot afford allocations in the wait_for_rcu path to avoid having to introduce fail paths) it was also a noop to the ksoftirqd paths.

However they remarked ksoftirqd wasn't a RT thread so under very high load it could introduce an higher latency to the wait_for_rcu calls. keventd as well isn't a RT task and furthmore currently the schedule_task as the property that only one task in the keventd queue will be run at once (but I guess for the latter issue we can probably ignore it since it's better not to rely on it).

So the obvious next step was to waste another 8k per cpu and to get the best runtime behaviour and also very clean and self contained code. I think that's rasonable.

So in short if you really are in pain for 8k per cpu to get the best runtime behaviour and cleaner code I'd at least suggest to use the ksoftirqd way that should be the next best step.

Quoted 1 line

BTW, do you plan to merge patches that actually _use_ this into your tree?

Long term of course, but with my further changes before the inclusion the plain current patches shouldn't apply any longer, I'd like if the developers of the current rcu fd patches could check my changes and adapt them (if they agree with my changes of course ;).

Quoted 7 lines
Quoted 4 lines

Only in 2.4.10pre4aa1: 10_prefetch-4
Only in 2.4.10pre7aa1: 10_prefetch-5

Part of prefetch in mainline, rediffed the architectural parts.

In my tree I also have an ia64 prefetch patch (I think it's from redhat, not sure though), it's appended if you want to take it.

thanks, applied.

Andrea

#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Andrea Arcangeli
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · In article <[email protected]> you wrote:

Only in 2.4.10pre4aa1: 00_paride-max_sectors-1
Only in 2.4.10pre7aa1: 00_paride-max_sectors-2

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Rediffed (also noticed the gendisk list changes deleted too much stuff here so resurrected it).

Do you plan to submit the max_sectors changes to Linus & Alan? Otherwise I will do as they seem to be needed for reliable operation.

agreed, Linus, here it is ready for merging into mainline:

I think the sd part is much more interesting for most users.. Version from 2.4.10pre7aa1 is here:

drivers/scsi/sd.c +18 -0
diff -urN 2.4.7/drivers/scsi/sd.c sd_max_sectors/drivers/scsi/sd.c
@@ -90,6 +90,7 @@
 static int *sd_sizes;
 static int *sd_blocksizes;
 static int *sd_hardsizes;	/* Hardware sector size */
+static int *sd_max_sectors;
 
 static int check_scsidisk_media_change(kdev_t);
 static int fop_revalidate_scsidisk(kdev_t);
@@ -1095,15 +1096,30 @@
 	if (!sd_hardsizes)
 		goto cleanup_blocksizes;
 
+	sd_max_sectors = kmalloc((sd_template.dev_max << 4) * sizeof(int), GFP_ATOMIC);
+	if (!sd_max_sectors)
+		goto cleanup_max_sectors;
+
 	for (i = 0; i < sd_template.dev_max << 4; i++) {
 		sd_blocksizes[i] = 1024;
 		sd_hardsizes[i] = 512;
+		/*
+		 * Allow lowlevel device drivers to generate 512k large scsi
+		 * commands if they know what they're doing and they ask for it
+		 * explicitly via the SHpnt->max_sectors API.
+		 */
+		sd_max_sectors[i] = MAX_SEGMENTS*8;
 	}
 
 	for (i = 0; i < N_USED_SD_MAJORS; i++) {
 		blksize_size[SD_MAJOR(i)] = sd_blocksizes + i * (SCSI_DISKS_PER_MAJOR << 4);
 		hardsect_size[SD_MAJOR(i)] = sd_hardsizes + i * (SCSI_DISKS_PER_MAJOR << 4);
+		max_sectors[SD_MAJOR(i)] = sd_max_sectors + i * (SCSI_DISKS_PER_MAJOR << 4);
 	}
+	/*
+	 * FIXME: should unregister blksize_size, hardsect_size and max_sectors when
+	 * the module is unloaded.
+	 */
 	sd = kmalloc((sd_template.dev_max << 4) *
 					  sizeof(struct hd_struct),
 					  GFP_ATOMIC);
@@ -1155,6 +1171,8 @@
 cleanup_sd_gendisks:
 	kfree(sd);
 cleanup_sd:
+	kfree(sd_max_sectors);
+cleanup_max_sectors:
 	kfree(sd_hardsizes);
 cleanup_blocksizes:
 	kfree(sd_blocksizes);
drivers/scsi/sym53c8xx.h +1 -0
diff -urN 2.4.7/drivers/scsi/sym53c8xx.h sd_max_sectors/drivers/scsi/sym53c8xx.h
@@ -96,6 +96,7 @@
 			this_id:        7,			\
 			sg_tablesize:   SCSI_NCR_SG_TABLESIZE,	\
 			cmd_per_lun:    SCSI_NCR_CMD_PER_LUN,	\
+			max_sectors:    MAX_SEGMENTS*8,		\
 			use_clustering: DISABLE_CLUSTERING} 
 
 #else
#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Andrea Arcangeli
Quoted 3 lines

Do we really need yet-another per-CPU thread for this? I'd prefer to have the context thread per-CPU instead (like in Ben's asynchio patch) and do this as well.

The first desing solution I proposed to Paul and Dipankar was just to use ksoftirqd for that (in short set need_resched and wait it to be cleared), it worked out nicely and it was a sensible improvement with respect to their previous patches. (also it was reliable, we cannot afford allocations in the wait_for_rcu path to avoid having to introduce fail paths) it was also a noop to the ksoftirqd paths.

Quoted 2 lines

However they remarked ksoftirqd wasn't a RT thread so under very high load it could introduce an higher latency to the wait_for_rcu calls.

Hmm, I don't see why latency is important for rcu - we only want to free datastructures.. (mm load?).

On the other hands they are the experts on RCU, not I so I'll believe them.

Quoted 3 lines

So in short if you really are in pain for 8k per cpu to get the best runtime behaviour and cleaner code I'd at least suggest to use the ksoftirqd way that should be the next best step.

My problem with this appropech is just that we use kernel threads for more and more stuff - always creating new ones. I think at some point they will sum up badly.

Christoph

Signature · 1 line
Of course it doesn't work. We've performed a software upgrade.
#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · Christoph Hellwig
Quoted 8 lines · Andrea Arcangeli
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · In article <[email protected]> you wrote:

Only in 2.4.10pre4aa1: 00_paride-max_sectors-1
Only in 2.4.10pre7aa1: 00_paride-max_sectors-2

Rediffed (also noticed the gendisk list changes deleted too much stuff here so resurrected it).

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Do you plan to submit the max_sectors changes to Linus & Alan? Otherwise I will do as they seem to be needed for reliable operation.

agreed, Linus, here it is ready for merging into mainline:

I think the sd part is much more interesting for most users..

more interesting for most users certainly ;), but it's not needed for reliable operations so I thought you were talking about the paride fixes (also you quoted the 00_paride-... filename).

Andrea

#6 lore raw
In reply to a message not in the archive
Quoted 5 lines · Andrea Arcangeli
Quoted 1 line

I think the sd part is much more interesting for most users..

more interesting for most users certainly ;), but it's not needed for reliable operations so I thought you were talking about the paride fixes (also you quoted the 00_paride-... filename).

I said max_sectors fixes because I meant both. The paride fixes are needed, the sd ones nice - I'd like to see both merged :)

Christoph

Signature · 1 line
Of course it doesn't work. We've performed a software upgrade.
#7 lore raw
In reply to a message not in the archive
Quoted 12 lines · Christoph Hellwig
Quoted 11 lines · Andrea Arcangeli
Quoted 3 lines

Do we really need yet-another per-CPU thread for this? I'd prefer to have the context thread per-CPU instead (like in Ben's asynchio patch) and do this as well.

The first desing solution I proposed to Paul and Dipankar was just to use ksoftirqd for that (in short set need_resched and wait it to be cleared), it worked out nicely and it was a sensible improvement with respect to their previous patches. (also it was reliable, we cannot afford allocations in the wait_for_rcu path to avoid having to introduce fail paths) it was also a noop to the ksoftirqd paths.

Quoted 5 lines
Quoted 2 lines

However they remarked ksoftirqd wasn't a RT thread so under very high load it could introduce an higher latency to the wait_for_rcu calls.

Hmm, I don't see why latency is important for rcu - we only want to free datastructures.. (mm load?).

latency isn't critical, infact the point of rcu is not to care about the performance of the writer, so it wouldn't be a showstopper if it takes more time, but still this doesn't change that with RT threads the writer will be faster.

Quoted 3 lines

My problem with this appropech is just that we use kernel threads for more and more stuff - always creating new ones. I think at some point they will sum up badly.

They almost only costs memory. I also don't like unnecessary kernel threads but I can see usefulness for this one, OTOH as you said the latency of the wait_for_rcu isn't very critical but usually I prefer to save cycles with memory where I can and where it's even cleaner to do so.

Andrea

#14 lore raw
In reply to a message not in the archive
Quoted 8 lines · On Mon, 10 Sep 2001 17:54:17 +0200 Andrea Arcangeli <[email protected]> wrote:

Only in 2.4.10pre7aa1: 00_rcu-1

wait_for_rcu and call_rcu implementation (from IBM). I did some modifications with respect to the original version from IBM. In particular I dropped the vmalloc_rcu/kmalloc_rcu, the rcu_head must always be allocated in the data structures, it has to be a field of a class, rather than hiding it in the allocation and playing dirty and risky with casts on a bigger allocation.

Hi Andrea,

Like the kernel threads approach, but AFAICT it won't work for the case of two CPUs running wait_for_rcu at the same time (on a 4-way or above).

Please try actually *using* the RCU code before you complain about the wrappers: you'll end up writing your own wrappers. I look forward to seeing what you come up with (handling the case of the rcu structure in an arbitrary offset within the structure is possible, but my solutions were all less neat).

Preferred patch below,
Rusty.

include/linux/rcupdate.h +58 -0
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.7-module/include/linux/rcupdate.h working-2.4.7-rcu/include/linux/rcupdate.h
@@ -0,0 +1,58 @@
+#ifndef _LINUX_RCUPDATE_H
+#define _LINUX_RCUPDATE_H
+/* Read-Copy-Update For Linux. */
+#include <linux/malloc.h>
+#include <linux/cache.h>
+#include <linux/vmalloc.h>
+#include <asm/atomic.h>
+
+struct rcu_head
+{
+	struct rcu_head *next;
+	void (*func)(void *obj);
+};
+
+/* Count of pending requests: for optimization in schedule() */
+extern atomic_t rcu_pending;
+
+/* Queues future request. */
+void call_rcu(struct rcu_head *head, void (*func)(void *head));
+
+/* Convenience wrappers: */
+static inline void *kmalloc_rcu(size_t size, int flags)
+{
+	void *ret;
+
+	size += L1_CACHE_ALIGN(sizeof(struct rcu_head));
+	ret = kmalloc(size, flags);
+	if (!ret)
+		return NULL;
+	return ret + L1_CACHE_ALIGN(sizeof(struct rcu_head));
+}
+
+static inline void kfree_rcu(void *obj)
+{
+	call_rcu(obj - L1_CACHE_ALIGN(sizeof(struct rcu_head)),
+		 (void (*)(void *))kfree);
+}
+
+static inline void *vmalloc_rcu(size_t size)
+{
+	void *ret;
+
+	size += L1_CACHE_ALIGN(sizeof(struct rcu_head));
+	ret = vmalloc(size);
+	if (!ret)
+		return NULL;
+	return ret + L1_CACHE_ALIGN(sizeof(struct rcu_head));
+}
+
+static inline void vfree_rcu(void *obj)
+{
+	call_rcu(obj - L1_CACHE_ALIGN(sizeof(struct rcu_head)),
+		 (void (*)(void *))vfree);
+}
+
+/* Called by schedule() when batch reference count drops to zero. */
+void rcu_batch_done(void);
+#endif
kernel/Makefile +2 -2
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.7-module/kernel/Makefile working-2.4.7-rcu/kernel/Makefile
@@ -9,12 +9,12 @@
 
 O_TARGET := kernel.o
 
-export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o
+export-objs = signal.o sys.o kmod.o context.o ksyms.o pm.o rcupdate.o
 
 obj-y     = sched.o dma.o fork.o exec_domain.o panic.o printk.o \
 	    module.o exit.o itimer.o info.o time.o softirq.o resource.o \
 	    sysctl.o acct.o capability.o ptrace.o timer.o user.o \
-	    signal.o sys.o kmod.o context.o
+	    signal.o sys.o kmod.o context.o rcupdate.o
 
 obj-$(CONFIG_UID16) += uid16.o
 obj-$(CONFIG_MODULES) += ksyms.o
kernel/rcupdate.c +65 -0

65 lines not on this page · raw message

kernel/sched.c +22 -1
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.4.7-module/kernel/sched.c working-2.4.7-rcu/kernel/sched.c
@@ -26,6 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 #include <linux/completion.h>
+#include <linux/rcupdate.h>
 
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -99,12 +100,15 @@
 	struct schedule_data {
 		struct task_struct * curr;
 		cycles_t last_schedule;
+		int ring_count, finished_count;
 	} schedule_data;
 	char __pad [SMP_CACHE_BYTES];
-} aligned_data [NR_CPUS] __cacheline_aligned = { {{&init_task,0}}};
+} aligned_data [NR_CPUS] __cacheline_aligned = { {{&init_task,0,0,0}}};
 
 #define cpu_curr(cpu) aligned_data[(cpu)].schedule_data.curr
 #define last_schedule(cpu) aligned_data[(cpu)].schedule_data.last_schedule
+#define ring_count(cpu) aligned_data[(cpu)].schedule_data.ring_count
+#define finished_count(cpu) aligned_data[(cpu)].schedule_data.finished_count
 
 struct kernel_stat kstat;
 
@@ -544,6 +548,10 @@
 
 	release_kernel_lock(prev, this_cpu);
 
+	if (atomic_read(&rcu_pending))
+		goto rcu_process;
+rcu_process_back:
+
 	/*
 	 * 'sched_data' is protected by the fact that we can run
 	 * only one process per CPU.
@@ -693,6 +701,19 @@
 	c = goodness(prev, this_cpu, prev->active_mm);
 	next = prev;
 	goto still_running_back;
+
+rcu_process:
+	/* Avoid cache line effects if value hasn't changed */
+	c = ring_count((this_cpu + 1) % smp_num_cpus) + 1;
+	if (c != ring_count(this_cpu)) {
+		/* Do subtraction to avoid int wrap corner case */
+		if (c - finished_count(this_cpu) >= 0) {
+			rcu_batch_done();
+			finished_count(this_cpu) = c + smp_num_cpus;
+		}
+		ring_count(this_cpu) = c;
+	}
+	goto rcu_process_back;
 
 move_rr_last:
 	if (!prev->counter) {
#8 lore raw
In reply to Andrea Arcangeli
Quoted 8 lines · Andrea Arcangeli
Quoted 3 lines

My problem with this appropech is just that we use kernel threads for more and more stuff - always creating new ones. I think at some point they will sum up badly.

They almost only costs memory. I also don't like unnecessary kernel threads but I can see usefulness for this one, OTOH as you said the latency of the wait_for_rcu isn't very critical but usually I prefer to save cycles with memory where I can and where it's even cleaner to do so.

I can't quite remember if it was Linus or Larry who said:

"Threads are for people who don't understand state machines"

If you cannot make your code clean without adding another thread, it's probably a bad sign ;)

cheers,

Rik

Signature · 5 lines
IA64: a worthy successor to i860.

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

Send all your spam to [email protected] (spam digging piggy)
#9 lore raw
In reply to Andrea Arcangeli
Quoted 11 lines · Rik van Riel
Quoted 8 lines · Andrea Arcangeli
Quoted 3 lines

My problem with this appropech is just that we use kernel threads for more and more stuff - always creating new ones. I think at some point they will sum up badly.

They almost only costs memory. I also don't like unnecessary kernel threads but I can see usefulness for this one, OTOH as you said the latency of the wait_for_rcu isn't very critical but usually I prefer to save cycles with memory where I can and where it's even cleaner to do so.

Quoted 7 lines

I can't quite remember if it was Linus or Larry who said:

"Threads are for people who don't understand state machines"

If you cannot make your code clean without adding another thread, it's probably a bad sign ;)

Ask yourself why libaio in glibc uses threads. When there's no async-io hook you have no choice. Adding the hook is an advantage if you're going to use it during production, much better than rescheduling/creating/destroying various threads during production, but if you only need to register the hook once per day you'd waste time all the production time checking if somebody is registered in the hook.

So while the "Threads are for people who don't understand state machines" argument works for the userspace fileservers, it really doesn't apply to the rcu slow path where we don't want to hurt the schedule fast path with an hook.

However the issue with keventd and the fact we can get away with a single per-cpu counter increase in the scheduler fast path made us to think it's cleaner to just spend such cycle for each schedule rather than having yet another 8k per cpu wasted and longer taskslists (a local cpu increase is cheaper than a conditional jump).

Andrea

#10 lore raw
Quoted 5 lines · Andrea Arcangeli

However the issue with keventd and the fact we can get away with a single per-cpu counter increase in the scheduler fast path made us to think it's cleaner to just spend such cycle for each schedule rather than having yet another 8k per cpu wasted and longer taskslists (a local cpu increase is cheaper than a conditional jump).

So why don't we put the test+branch inside keventd ?

wakeup_krcud(void)

{
	krcud_wanted = 1;
	wakeup(&keventd);
}

cheers,

Rik

Signature · 5 lines
IA64: a worthy successor to i860.

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

Send all your spam to [email protected] (spam digging piggy)
#11 lore raw
In reply to Andrea Arcangeli
Quoted 9 lines · Rik van Riel
Quoted 5 lines · Andrea Arcangeli

However the issue with keventd and the fact we can get away with a single per-cpu counter increase in the scheduler fast path made us to think it's cleaner to just spend such cycle for each schedule rather than having yet another 8k per cpu wasted and longer taskslists (a local cpu increase is cheaper than a conditional jump).

So why don't we put the test+branch inside keventd ?

first keventd runs non RT, second it slowsdown keventd but I agree that would be a minor issue. The best approch to me seems the one I outlined in the last email (per-cpu sequence counter as only additional cost in schedule).

Andrea

#12 lore raw
In reply to Andrea Arcangeli
Quoted 9 lines · Andrea Arcangeli
Quoted 7 lines

I can't quite remember if it was Linus or Larry who said:

"Threads are for people who don't understand state machines"

If you cannot make your code clean without adding another thread, it's probably a bad sign ;)

Ask yourself why libaio in glibc uses threads.

Because glibc always uses the more bloated appropeach if there is a choice?

/me runs

Quoted 6 lines

When there's no async-io
hook you have no choice. Adding the hook is an advantage if you're going to use it during production, much better than rescheduling/creating/destroying various threads during production, but if you only need to register the hook once per day you'd waste time all the production time checking if somebody is registered in the hook.

I'd really like to see Ben's worktodo's in 2.4 - they are usefull even without his whole asynchio framework and don't need big kernel changes..

Christoph

Signature · 1 line
Whip me.  Beat me.  Make me maintain AIX.