>>>>> "martin" == Martin Mačok <[EMAIL PROTECTED]> writes:
Hi Lack of time, will look at integrate it. Later, Juan. martin> Hi, martin> why isn't mini-ll patch from Andrew Morton included in standard MDK martin> kernel? It should be harmless/secure/stable, it's a short and simple martin> patch which identifies largest (longest) kernel locks and breaks them martin> into smaller with conditional schedules. It helps desktop martin> interactivity and minimizing audio/video delays (thrashing). martin> Andrea Arcangeli uses it in his -aa tree (so it's probably in standard martin> SuSE kernels, but I haven't checked it) and Alan Cox told it should go martin> to vanilla 2.4 tree. martin> I'm attaching the message/patch. I don't of any problem this could martin> cause and I didn't see a single post on LKML telling something bad of martin> mini-ll. martin> Have a nice day martin> -- martin> Martin Mačok http://underground.cz/ martin> [EMAIL PROTECTED] http://Xtrmntr.org/ORBman/ martin> Date: Sat, 12 Jan 2002 12:23:09 -0800 martin> From: Andrew Morton <[EMAIL PROTECTED]> martin> To: Ed Sweetman <[EMAIL PROTECTED]> martin> Cc: Andrea Arcangeli <[EMAIL PROTECTED]>, [EMAIL PROTECTED], martin> [EMAIL PROTECTED], Robert Love <[EMAIL PROTECTED]>, martin> Alan Cox <[EMAIL PROTECTED]>, [EMAIL PROTECTED], martin> Rob Landley <[EMAIL PROTECTED]>, [EMAIL PROTECTED] martin> Subject: Re: [2.4.17/18pre] VM and swap - it's really unusable martin> Ed Sweetman wrote: >> >> If you want to test the preempt kernel you're going to need something that >> can find the mean latancy or "time to action" for a particular program or >> all programs being run at the time and then run multiple programs that you >> would find on various peoples' systems. That is the "feel" people talk >> about when they praise the preempt patch. martin> Right. And that is precisely why I created the "mini-ll" patch. To martin> give the improved "feel" in a way which is acceptable for merging into martin> the 2.4 kernel. martin> And guess what? Nobody has tested the damn thing, so it's going martin> nowhere. martin> Here it is again: martin> --- linux-2.4.18-pre3/fs/buffer.c Fri Dec 21 11:19:14 2001 martin> +++ linux-akpm/fs/buffer.c Sat Jan 12 12:22:29 2002 martin> @@ -249,12 +249,19 @@ static int wait_for_buffers(kdev_t dev, martin> struct buffer_head * next; martin> int nr; martin> - next = lru_list[index]; martin> nr = nr_buffers_type[index]; martin> +repeat: martin> + next = lru_list[index]; martin> while (next && --nr >= 0) { martin> struct buffer_head *bh = next; martin> next = bh->b_next_free; martin> + if (dev == NODEV && current->need_resched) { martin> + spin_unlock(&lru_list_lock); martin> + conditional_schedule(); martin> + spin_lock(&lru_list_lock); martin> + goto repeat; martin> + } martin> if (!buffer_locked(bh)) { martin> if (refile) martin> __refile_buffer(bh); martin> @@ -1174,8 +1181,10 @@ struct buffer_head * bread(kdev_t dev, i martin> bh = getblk(dev, block, size); martin> touch_buffer(bh); martin> - if (buffer_uptodate(bh)) martin> + if (buffer_uptodate(bh)) { martin> + conditional_schedule(); martin> return bh; martin> + } martin> ll_rw_block(READ, 1, &bh); martin> wait_on_buffer(bh); martin> if (buffer_uptodate(bh)) martin> --- linux-2.4.18-pre3/fs/dcache.c Fri Dec 21 11:19:14 2001 martin> +++ linux-akpm/fs/dcache.c Sat Jan 12 12:22:29 2002 martin> @@ -71,7 +71,7 @@ static inline void d_free(struct dentry martin> * d_iput() operation if defined. martin> * Called with dcache_lock held, drops it. martin> */ martin> -static inline void dentry_iput(struct dentry * dentry) martin> +static void dentry_iput(struct dentry * dentry) martin> { martin> struct inode *inode = dentry->d_inode; martin> if (inode) { martin> @@ -84,6 +84,7 @@ static inline void dentry_iput(struct de martin> iput(inode); martin> } else martin> spin_unlock(&dcache_lock); martin> + conditional_schedule(); martin> } martin> /* martin> --- linux-2.4.18-pre3/fs/jbd/commit.c Fri Dec 21 11:19:14 2001 martin> +++ linux-akpm/fs/jbd/commit.c Sat Jan 12 12:22:29 2002 martin> @@ -212,6 +212,16 @@ write_out_data_locked: martin> __journal_remove_journal_head(bh); martin> refile_buffer(bh); martin> __brelse(bh); martin> + if (current->need_resched) { martin> + if (commit_transaction->t_sync_datalist) martin> + commit_transaction->t_sync_datalist = martin> + next_jh; martin> + if (bufs) martin> + break; martin> + spin_unlock(&journal_datalist_lock); martin> + conditional_schedule(); martin> + goto write_out_data; martin> + } martin> } martin> } martin> if (bufs == ARRAY_SIZE(wbuf)) { martin> --- linux-2.4.18-pre3/fs/proc/array.c Thu Oct 11 09:00:01 2001 martin> +++ linux-akpm/fs/proc/array.c Sat Jan 12 12:22:29 2002 martin> @@ -415,6 +415,8 @@ static inline void statm_pte_range(pmd_t martin> pte_t page = *pte; martin> struct page *ptpage; martin> + conditional_schedule(); martin> + martin> address += PAGE_SIZE; martin> pte++; martin> if (pte_none(page)) martin> --- linux-2.4.18-pre3/fs/proc/generic.c Fri Sep 7 10:53:59 2001 martin> +++ linux-akpm/fs/proc/generic.c Sat Jan 12 12:22:29 2002 martin> @@ -98,7 +98,9 @@ proc_file_read(struct file * file, char martin> retval = n; martin> break; martin> } martin> - martin> + martin> + conditional_schedule(); martin> + martin> /* This is a hack to allow mangling of file pos independent martin> * of actual bytes read. Simply place the data at page, martin> * return the bytes, and set `start' to the desired offset martin> --- linux-2.4.18-pre3/include/linux/condsched.h Thu Jan 1 00:00:00 1970 martin> +++ linux-akpm/include/linux/condsched.h Sat Jan 12 12:22:29 2002 martin> @@ -0,0 +1,18 @@ martin> +#ifndef _LINUX_CONDSCHED_H martin> +#define _LINUX_CONDSCHED_H martin> + martin> +#ifndef __LINUX_COMPILER_H martin> +#include <linux/compiler.h> martin> +#endif martin> + martin> +#ifndef __ASSEMBLY__ martin> +#define conditional_schedule() \ martin> +do { \ martin> + if (unlikely(current->need_resched)) { \ martin> + __set_current_state(TASK_RUNNING); \ martin> + schedule(); \ martin> + } \ martin> +} while(0) martin> +#endif martin> + martin> +#endif martin> --- linux-2.4.18-pre3/include/linux/sched.h Fri Dec 21 11:19:23 2001 martin> +++ linux-akpm/include/linux/sched.h Sat Jan 12 12:22:29 2002 martin> @@ -13,6 +13,7 @@ extern unsigned long event; martin> #include <linux/times.h> martin> #include <linux/timex.h> martin> #include <linux/rbtree.h> martin> +#include <linux/condsched.h> martin> #include <asm/system.h> martin> #include <asm/semaphore.h> martin> --- linux-2.4.18-pre3/mm/filemap.c Thu Jan 10 13:39:50 2002 martin> +++ linux-akpm/mm/filemap.c Sat Jan 12 12:22:29 2002 martin> @@ -296,10 +296,7 @@ static int truncate_list_pages(struct li martin> page_cache_release(page); martin> - if (current->need_resched) { martin> - __set_current_state(TASK_RUNNING); martin> - schedule(); martin> - } martin> + conditional_schedule(); martin> spin_lock(&pagecache_lock); martin> goto restart; martin> @@ -609,6 +606,7 @@ void filemap_fdatasync(struct address_sp martin> UnlockPage(page); martin> page_cache_release(page); martin> + conditional_schedule(); martin> spin_lock(&pagecache_lock); martin> } martin> spin_unlock(&pagecache_lock); martin> @@ -1392,6 +1390,9 @@ page_ok: martin> offset &= ~PAGE_CACHE_MASK; martin> page_cache_release(page); martin> + martin> + conditional_schedule(); martin> + martin> if (ret == nr && desc->count) martin> continue; martin> break; martin> @@ -3025,6 +3026,8 @@ unlock: martin> SetPageReferenced(page); martin> UnlockPage(page); martin> page_cache_release(page); martin> + martin> + conditional_schedule(); martin> if (status < 0) martin> break; martin> --- linux-2.4.18-pre3/drivers/block/ll_rw_blk.c Thu Jan 10 13:39:49 2002 martin> +++ linux-akpm/drivers/block/ll_rw_blk.c Sat Jan 12 12:22:29 2002 martin> @@ -917,6 +917,7 @@ void submit_bh(int rw, struct buffer_hea martin> kstat.pgpgin += count; martin> break; martin> } martin> + conditional_schedule(); martin> } martin> /** martin> - martin> More majordomo info at http://vger.kernel.org/majordomo-info.html martin> Please read the FAQ at http://www.tux.org/lkml/ -- In theory, practice and theory are the same, but in practice they are different -- Larry McVoy
