Linus, 
 The md/raid driver runs a small number of kernel threads which
 currently run with the BKL held.
 As all the data structures accessed by these threads are also
 accessed by other threads which are not under the BKL, there is no
 value in keeping the BKL in these threads - and there is some cost as
 memcpys and block XORs often occur in one of these threads (raid5d).

 The only noticable synchronisation that the BKL provides these
 threads is between the threads themselves.  This only manifests in
 the accounting of io requests as "sync_io" - used for reconstructing
 redundancy in an array - and actual io.  (actual_io == sync_io +
 normal_io.  When normal_io is detected, sync_io wound back)

 In particular, the raid5d will record that an IO request is
 "sync_io", and then submit the io which causes it to be recorded as
 actual_io.

 The resync thread regularly checks the difference between the
 actual_io count and the sync_io count.  If this difference changes,
 it backs-off the resync so as not to interfere with regular disc
 traffic.

 The BKL currently ensures that the resync thread never checks the
 difference between the sync_io being accounted and the actual_io
 being accounted.  Without the BKL it can occasionally see small
 differences which don't actually reflect any normal_io.

 This patch drops the BKL in md kernel threads, and makes the test of
 "is there non-sync-io happening" more relaxed.

NeilBrown

Why is it that the smallest patches often need the longest explanation?

--- ./drivers/md/md.c   2001/06/19 01:16:07     1.1
+++ ./drivers/md/md.c   2001/06/19 01:19:56     1.2
@@ -2835,7 +2835,7 @@
         */
        current->policy = SCHED_OTHER;
        current->nice = -20;
-//     md_unlock_kernel();
+       md_unlock_kernel();
 
        up(thread->sem);
 
@@ -3204,8 +3204,8 @@
                                                kstat.dk_drive_wblk[major][idx] ;
                curr_events -= sync_io[major][idx];
 //             printk("events(major: %d, idx: %d): %ld\n", major, idx, curr_events);
-               if (curr_events != rdev->last_events) {
-//                     printk("!I(%ld)", curr_events - rdev->last_events);
+               if ((curr_events - rdev->last_events) > 32) {
+//                     printk("!I(%ld)%x", curr_events - rdev->last_events, 
+rdev->dev);
                        rdev->last_events = curr_events;
                        idle = 0;
                }
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [EMAIL PROTECTED]
  • PATCH Neil Brown

Reply via email to