📄 1021.lowlatency.patch
字号:
- repeat: list_for_each_prev(p, list) {+ if (TEST_RESCHED_COUNT(32)) {+ RESET_RESCHED_COUNT();+ if (conditional_schedule_needed()) {+ spin_unlock(&lru_list_lock);+ goto repeat;+ }+ } bh = BH_ENTRY(p); if (buffer_locked(bh)) { get_bh(bh);@@ -973,7 +1029,6 @@ if (!buffer_uptodate(bh)) err = -EIO; brelse(bh);- spin_lock(&lru_list_lock); goto repeat; } }@@ -990,12 +1045,24 @@ void invalidate_inode_buffers(struct inode *inode) { struct list_head * entry;- ++repeat:+ conditional_schedule(); spin_lock(&lru_list_lock);- while ((entry = inode->i_dirty_buffers.next) != &inode->i_dirty_buffers)+ while ((entry = inode->i_dirty_buffers.next) != &inode->i_dirty_buffers) {+ if (conditional_schedule_needed()) {+ spin_unlock(&lru_list_lock);+ goto repeat;+ } remove_inode_queue(BH_ENTRY(entry));- while ((entry = inode->i_dirty_data_buffers.next) != &inode->i_dirty_data_buffers)+ }+ while ((entry = inode->i_dirty_data_buffers.next) != &inode->i_dirty_data_buffers) {+ if (conditional_schedule_needed()) {+ spin_unlock(&lru_list_lock);+ goto repeat;+ } remove_inode_queue(BH_ENTRY(entry));+ } spin_unlock(&lru_list_lock); } @@ -1018,6 +1085,7 @@ bh = get_hash_table(dev, block, size); if (bh) { touch_buffer(bh);+ conditional_schedule(); return bh; } diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/dcache.c linuxmips-2.4.30/fs/dcache.c--- linuxmips-2.4.30.ref/fs/dcache.c 2004-11-18 16:28:47.000000000 -0800+++ linuxmips-2.4.30/fs/dcache.c 2005-07-22 09:36:02.000000000 -0700@@ -324,11 +324,23 @@ void prune_dcache(int count) {+ DEFINE_RESCHED_COUNT;++redo: spin_lock(&dcache_lock); for (;;) { struct dentry *dentry; struct list_head *tmp; + if (TEST_RESCHED_COUNT(100)) {+ RESET_RESCHED_COUNT();+ if (conditional_schedule_needed()) {+ spin_unlock(&dcache_lock);+ unconditional_schedule();+ goto redo;+ }+ }+ tmp = dentry_unused.prev; if (tmp == &dentry_unused)@@ -483,6 +495,7 @@ struct dentry *this_parent = parent; struct list_head *next; int found = 0;+ DEFINE_RESCHED_COUNT; spin_lock(&dcache_lock); repeat:@@ -497,6 +510,13 @@ list_add(&dentry->d_lru, dentry_unused.prev); found++; }++ if (TEST_RESCHED_COUNT(500) && found > 10) {+ if (conditional_schedule_needed()) /* Typically sys_rmdir() */+ goto out;+ RESET_RESCHED_COUNT();+ }+ /* * Descend a level if the d_subdirs list is non-empty. */@@ -521,6 +541,7 @@ #endif goto resume; }+out: spin_unlock(&dcache_lock); return found; }@@ -536,8 +557,10 @@ { int found; - while ((found = select_parent(parent)) != 0)+ while ((found = select_parent(parent)) != 0) { prune_dcache(found);+ conditional_schedule(); /* Typically sys_rmdir() */+ } } /*diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/exec.c linuxmips-2.4.30/fs/exec.c--- linuxmips-2.4.30.ref/fs/exec.c 2005-07-21 19:15:31.000000000 -0700+++ linuxmips-2.4.30/fs/exec.c 2005-07-22 09:36:02.000000000 -0700@@ -245,7 +245,7 @@ memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len); }- err = copy_from_user(kaddr+offset, str, bytes_to_copy);+ err = ll_copy_from_user(kaddr+offset, str, bytes_to_copy); if (err) { ret = -EFAULT; goto out;diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/ext2/dir.c linuxmips-2.4.30/fs/ext2/dir.c--- linuxmips-2.4.30.ref/fs/ext2/dir.c 2005-04-05 12:09:57.000000000 -0700+++ linuxmips-2.4.30/fs/ext2/dir.c 2005-07-22 09:36:02.000000000 -0700@@ -153,6 +153,7 @@ struct address_space *mapping = dir->i_mapping; struct page *page = read_cache_page(mapping, n, (filler_t*)mapping->a_ops->readpage, NULL);+ conditional_schedule(); /* Scanning large directories */ if (!IS_ERR(page)) { wait_on_page(page); kmap(page);diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/ext2/inode.c linuxmips-2.4.30/fs/ext2/inode.c--- linuxmips-2.4.30.ref/fs/ext2/inode.c 2004-08-14 11:39:01.000000000 -0700+++ linuxmips-2.4.30/fs/ext2/inode.c 2005-07-22 09:36:02.000000000 -0700@@ -727,8 +727,13 @@ { unsigned long block_to_free = 0, count = 0; unsigned long nr;+ DEFINE_RESCHED_COUNT; for ( ; p < q ; p++) {+ if (TEST_RESCHED_COUNT(32)) {+ RESET_RESCHED_COUNT();+ conditional_schedule();+ } nr = le32_to_cpu(*p); if (nr) { *p = 0;@@ -771,6 +776,7 @@ if (depth--) { int addr_per_block = EXT2_ADDR_PER_BLOCK(inode->i_sb); for ( ; p < q ; p++) {+ conditional_schedule(); /* Deleting large files */ nr = le32_to_cpu(*p); if (!nr) continue;diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/ext3/balloc.c linuxmips-2.4.30/fs/ext3/balloc.c--- linuxmips-2.4.30.ref/fs/ext3/balloc.c 2003-07-04 20:23:44.000000000 -0700+++ linuxmips-2.4.30/fs/ext3/balloc.c 2005-07-22 09:36:02.000000000 -0700@@ -363,6 +363,9 @@ } } #endif+ /* superblock lock is held, so this is safe */+ conditional_schedule();+ BUFFER_TRACE(bitmap_bh, "clear bit"); if (!ext3_clear_bit (bit + i, bitmap_bh->b_data)) { ext3_error(sb, __FUNCTION__,diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/ext3/inode.c linuxmips-2.4.30/fs/ext3/inode.c--- linuxmips-2.4.30.ref/fs/ext3/inode.c 2004-08-14 11:39:01.000000000 -0700+++ linuxmips-2.4.30/fs/ext3/inode.c 2005-07-22 09:36:02.000000000 -0700@@ -930,6 +930,8 @@ prev_blocks = inode->i_blocks; + conditional_schedule(); /* Reading large directories */+ bh = ext3_getblk (handle, inode, block, create, err); if (!bh) return bh;@@ -1633,6 +1635,7 @@ */ for (p = first; p < last; p++) { u32 nr = le32_to_cpu(*p);+ conditional_schedule(); if (nr) { struct buffer_head *bh; @@ -1687,6 +1690,7 @@ } for (p = first; p < last; p++) {+ conditional_schedule(); nr = le32_to_cpu(*p); if (nr) { /* accumulate blocks to free if they're contiguous */diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/ext3/namei.c linuxmips-2.4.30/fs/ext3/namei.c--- linuxmips-2.4.30.ref/fs/ext3/namei.c 2003-02-25 14:03:11.000000000 -0800+++ linuxmips-2.4.30/fs/ext3/namei.c 2005-07-22 09:36:02.000000000 -0700@@ -157,6 +157,7 @@ if ((bh = bh_use[ra_ptr++]) == NULL) goto next; wait_on_buffer(bh);+ conditional_schedule(); if (!buffer_uptodate(bh)) { /* read error, skip block & hope for the best */ brelse(bh);diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/inode.c linuxmips-2.4.30/fs/inode.c--- linuxmips-2.4.30.ref/fs/inode.c 2004-04-15 20:14:19.000000000 -0700+++ linuxmips-2.4.30/fs/inode.c 2005-07-22 09:36:02.000000000 -0700@@ -348,6 +348,8 @@ filemap_fdatawait(inode->i_mapping); + conditional_schedule();+ spin_lock(&inode_lock); inode->i_state &= ~I_LOCK; __refile_inode(inode);@@ -648,6 +650,7 @@ while (!list_empty(head)) { struct inode *inode; + conditional_schedule(); inode = list_entry(head->next, struct inode, i_list); list_del(&inode->i_list); @@ -684,9 +687,22 @@ if (tmp == head) break; inode = list_entry(tmp, struct inode, i_list);++ if (conditional_schedule_needed()) {+ atomic_inc(&inode->i_count);+ spin_unlock(&inode_lock);+ unconditional_schedule();+ spin_lock(&inode_lock);+ atomic_dec(&inode->i_count);+ }+ if (inode->i_sb != sb) continue;+ atomic_inc(&inode->i_count);+ spin_unlock(&inode_lock); invalidate_inode_buffers(inode);+ spin_lock(&inode_lock);+ atomic_dec(&inode->i_count); if (!atomic_read(&inode->i_count)) { list_del_init(&inode->i_hash); list_del(&inode->i_list);@@ -796,15 +812,28 @@ int avg_pages; #endif struct inode * inode;+ int nr_to_scan = inodes_stat.nr_unused; +resume: spin_lock(&inode_lock);- count = 0; entry = inode_unused.prev;- while (entry != &inode_unused)- {+ while (entry != &inode_unused && nr_to_scan--) { struct list_head *tmp = entry; + if (conditional_schedule_needed()) {+ /*+ * Need to drop the lock. Reposition+ * the list head so we start here next time.+ * This can corrupt the LRU nature of the+ * unused list, but this isn't very important.+ */+ list_del(&inode_unused);+ list_add(&inode_unused, entry);+ spin_unlock(&inode_lock);+ unconditional_schedule();+ goto resume;+ } entry = entry->prev; inode = INODE(tmp); if (inode->i_state & (I_FREEING|I_CLEAR|I_LOCK))@@ -1006,6 +1035,8 @@ if (inode) { struct inode * old; + conditional_schedule(); /* sync_old_buffers */+ spin_lock(&inode_lock); /* We released the lock, so.. */ old = find_inode(sb, ino, head, find_actor, opaque);diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/jbd/checkpoint.c linuxmips-2.4.30/fs/jbd/checkpoint.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -