From 4a5b5d8040d1438054a49096dfa4e477987d3068 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:36:33 -0500 Subject: [PATCH] Import 2.4.0-test4pre2 --- arch/alpha/kernel/sys_nautilus.c | 5 ++ arch/i386/Makefile | 2 + arch/s390/config.in | 3 - drivers/sound/Makefile | 2 +- fs/buffer.c | 3 - fs/select.c | 111 +++++++++++-------------------- include/asm-i386/pgtable.h | 2 +- include/linux/mm.h | 3 - include/linux/poll.h | 11 ++- include/linux/types.h | 3 + include/linux/wait.h | 2 +- mm/vmscan.c | 1 + 12 files changed, 62 insertions(+), 86 deletions(-) diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 32653e3a7482..2115b8d2c113 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c @@ -53,6 +53,11 @@ static void __init nautilus_init_irq(void) { + if (alpha_using_srm) { + alpha_mv.device_interrupt = srm_device_interrupt; + alpha_mv.kill_arch = NULL; + } + init_i8259a_irqs(); common_init_isa_dma(); } diff --git a/arch/i386/Makefile b/arch/i386/Makefile index 3c418f4ef0f8..b63dcb89e7d7 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile @@ -114,6 +114,8 @@ compressed: zImage zlilo: vmlinux @$(MAKEBOOT) BOOTIMAGE=zImage zlilo +tmp: + @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo bzlilo: vmlinux @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo diff --git a/arch/s390/config.in b/arch/s390/config.in index 96686af33515..9e946365ffeb 100644 --- a/arch/s390/config.in +++ b/arch/s390/config.in @@ -57,9 +57,6 @@ fi source fs/Config.in -# Not sure about this one. dwmw2 -# source drivers/mtd/Config.in - # source drivers/char/Config.in mainmenu_option next_comment diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile index 10fbd5871e58..399148c74129 100644 --- a/drivers/sound/Makefile +++ b/drivers/sound/Makefile @@ -47,7 +47,7 @@ obj-$(CONFIG_SOUND_SOFTOSS) += softoss2.o obj-$(CONFIG_SOUND_SSCAPE) += sscape.o ad1848.o mpu401.o obj-$(CONFIG_SOUND_MAD16) += mad16.o ad1848.o sb_lib.o uart401.o obj-$(CONFIG_SOUND_CS4232) += cs4232.o uart401.o -obj-$(CONFIG_SOUND_OPL3SA2) += opl3sa2.o ad1848.o uart401.o mpu401.o +obj-$(CONFIG_SOUND_OPL3SA2) += opl3sa2.o ad1848.o mpu401.o obj-$(CONFIG_SOUND_MSS) += ad1848.o obj-$(CONFIG_SOUND_PAS) += pas2.o sb_lib.o uart401.o obj-$(CONFIG_SOUND_SB) += sb.o sb_lib.o uart401.o diff --git a/fs/buffer.c b/fs/buffer.c index b1e1c33b73cd..ba02c8be1b7c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1759,9 +1759,6 @@ static int do_kio(int rw, int nr, struct buffer_head *bh[], int size) int i; struct buffer_head *tmp; - struct task_struct *tsk = current; - DECLARE_WAITQUEUE(wait, tsk); - if (rw == WRITE) rw = WRITERAW; ll_rw_block(rw, nr, bh); diff --git a/fs/select.c b/fs/select.c index 86c2793d7377..a9fd61953ee6 100644 --- a/fs/select.c +++ b/fs/select.c @@ -37,51 +37,12 @@ * poll table. */ -/* - * I rewrote this again to make the poll_table size variable, take some - * more shortcuts, improve responsiveness, and remove another race that - * Linus noticed. -- jrs - */ - -static poll_table* alloc_wait(int nfds) +static void free_wait(struct poll_table_page * p) { - poll_table* out; - poll_table* walk; - - out = (poll_table *) __get_free_page(GFP_KERNEL); - if(out==NULL) - return NULL; - out->nr = 0; - out->entry = (struct poll_table_entry *)(out + 1); - out->next = NULL; - nfds -=__MAX_POLL_TABLE_ENTRIES; - walk = out; - while(nfds > 0) { - poll_table *tmp = (poll_table *) __get_free_page(GFP_KERNEL); - if (!tmp) { - while(out != NULL) { - tmp = out->next; - free_page((unsigned long)out); - out = tmp; - } - return NULL; - } - tmp->nr = 0; - tmp->entry = (struct poll_table_entry *)(tmp + 1); - tmp->next = NULL; - walk->next = tmp; - walk = tmp; - nfds -=__MAX_POLL_TABLE_ENTRIES; - } - return out; -} - -static void free_wait(poll_table * p) -{ - struct poll_table_entry * entry; - poll_table *old; - while (p) { + struct poll_table_entry * entry; + struct poll_table_page *old; + entry = p->entry + p->nr; while (p->nr > 0) { p->nr--; @@ -97,19 +58,33 @@ static void free_wait(poll_table * p) void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) { - for (;;) { - if (p->nr < __MAX_POLL_TABLE_ENTRIES) { - struct poll_table_entry * entry; - entry = p->entry + p->nr; - get_file(filp); - entry->filp = filp; - entry->wait_address = wait_address; - init_waitqueue_entry(&entry->wait, current); - add_wait_queue(wait_address,&entry->wait); - p->nr++; + struct poll_table_page *table = p->table; + + if (!table || table->nr >= __MAX_POLL_TABLE_ENTRIES) { + struct poll_table_page *new_table; + + new_table = (struct poll_table_page *) __get_free_page(GFP_KERNEL); + if (!new_table) { + p->error = -ENOMEM; return; } - p = p->next; + new_table->nr = 0; + new_table->entry = (struct poll_table_entry *)(new_table + 1); + new_table->next = table; + p->table = new_table; + table = new_table; + } + + /* Add a new entry */ + { + struct poll_table_entry * entry; + entry = table->entry + table->nr; + table->nr++; + get_file(filp); + entry->filp = filp; + entry->wait_address = wait_address; + init_waitqueue_entry(&entry->wait, current); + add_wait_queue(wait_address,&entry->wait); } } @@ -173,12 +148,10 @@ get_max: int do_select(int n, fd_set_bits *fds, long *timeout) { - poll_table *wait, *orig_wait; + poll_table table, *wait; int retval, i, off; long __timeout = *timeout; - orig_wait = wait = NULL; - read_lock(¤t->files->file_lock); retval = max_select_fd(n, fds); read_unlock(¤t->files->file_lock); @@ -186,11 +159,10 @@ int do_select(int n, fd_set_bits *fds, long *timeout) if (retval < 0) return retval; n = retval; - if (__timeout) { - orig_wait = wait = alloc_wait(n); - if (!wait) - return -ENOMEM; - } + + table.error = 0; + table.table = NULL; + wait = &table; retval = 0; for (;;) { set_current_state(TASK_INTERRUPTIBLE); @@ -233,7 +205,7 @@ int do_select(int n, fd_set_bits *fds, long *timeout) } current->state = TASK_RUNNING; - free_wait(orig_wait); + free_wait(table.table); /* * Up-to-date the caller timeout. @@ -404,7 +376,7 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout) { int i, j, fdcount, err; struct pollfd **fds; - poll_table *wait = NULL; + poll_table table; int nchunks, nleft; /* Do a sanity check on nfds ... */ @@ -419,11 +391,8 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout) timeout = MAX_SCHEDULE_TIMEOUT; } - if (timeout) { - wait = alloc_wait(nfds); - if (!wait) - return -ENOMEM; - } + table.error = 0; + table.table = NULL; err = -ENOMEM; fds = NULL; @@ -460,7 +429,7 @@ asmlinkage long sys_poll(struct pollfd * ufds, unsigned int nfds, long timeout) goto out_fds1; } - fdcount = do_poll(nfds, nchunks, nleft, fds, wait, timeout); + fdcount = do_poll(nfds, nchunks, nleft, fds, &table, timeout); /* OK, now copy the revents fields back to user space. */ for(i=0; i < nchunks; i++) @@ -483,6 +452,6 @@ out_fds: if (nfds != 0) kfree(fds); out: - free_wait(wait); + free_wait(table.table); return err; } diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index cadb5cbf756a..cfa011108cb0 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -244,7 +244,7 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd); * Permanent address of a page. Obviously must never be * called on a highmem page. */ -#define page_address(page) ({ if (!(page)->virtual) BUG(); (page)->virtual; }) +#define page_address(page) ((page)->virtual) #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) #define pte_page(x) (mem_map+pte_pagenr(x)) diff --git a/include/linux/mm.h b/include/linux/mm.h index e6325a2980d5..f418100a9275 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -316,9 +316,6 @@ extern struct page * alloc_pages_node(int nid, int gfp_mask, unsigned long order #ifndef CONFIG_DISCONTIGMEM static inline struct page * alloc_pages(int gfp_mask, unsigned long order) { - /* temporary check. */ - if (contig_page_data.node_zonelists[gfp_mask].gfp_mask != (gfp_mask)) - BUG(); /* * Gets optimized away by the compiler. */ diff --git a/include/linux/poll.h b/include/linux/poll.h index b56cdcf4c2f3..bc0fcde22bc3 100644 --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -17,13 +17,18 @@ struct poll_table_entry { wait_queue_head_t * wait_address; }; -typedef struct poll_table_struct { - struct poll_table_struct * next; +struct poll_table_page { + struct poll_table_page * next; unsigned int nr; struct poll_table_entry * entry; +}; + +typedef struct poll_table_struct { + int error; + struct poll_table_page * table; } poll_table; -#define __MAX_POLL_TABLE_ENTRIES ((PAGE_SIZE - sizeof (poll_table)) / sizeof (struct poll_table_entry)) +#define __MAX_POLL_TABLE_ENTRIES ((PAGE_SIZE - sizeof (struct poll_table_page)) / sizeof (struct poll_table_entry)) extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p); diff --git a/include/linux/types.h b/include/linux/types.h index 196c5f4e0ca1..df4808fcdf45 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -1,7 +1,10 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +#ifdef __KERNEL__ #include +#endif + #include #include diff --git a/include/linux/wait.h b/include/linux/wait.h index 6ac1f0e88fe4..222923acaf57 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -21,7 +21,7 @@ * Temporary debugging help until all code is converted to the new * waitqueue usage. */ -#define WAITQUEUE_DEBUG 1 +#define WAITQUEUE_DEBUG 0 #if WAITQUEUE_DEBUG extern int printk(const char *fmt, ...); diff --git a/mm/vmscan.c b/mm/vmscan.c index d5008c7ec262..f19721ee5920 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -626,6 +626,7 @@ int try_to_free_pages(unsigned int gfp_mask) int retval = 1; if (gfp_mask & __GFP_WAIT) { + current->state = TASK_RUNNING; current->flags |= PF_MEMALLOC; retval = do_try_to_free_pages(gfp_mask); current->flags &= ~PF_MEMALLOC; -- 2.39.5