diff options
| author | Jeff Garzik <jgarzik@mandrakesoft.com> | 2002-09-20 01:57:41 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@mandrakesoft.com> | 2002-09-20 01:57:41 -0400 |
| commit | 8900dac751abbbd100afe39954f7a2547f77580a (patch) | |
| tree | b9cc3d7880b671615072e81c91413e48aea994f4 /include/linux | |
| parent | 7ded02b37c8a8b220cf447133b253b3ff2b6fc2d (diff) | |
| parent | 2188a61733d33ca69bb49c92a2a31b93099028c4 (diff) | |
Merge mandrakesoft.com:/home/jgarzik/repo/linus-2.5
into mandrakesoft.com:/home/jgarzik/repo/net-drivers-2.5
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/fs.h | 8 | ||||
| -rw-r--r-- | include/linux/gfp.h | 19 | ||||
| -rw-r--r-- | include/linux/mm.h | 7 | ||||
| -rw-r--r-- | include/linux/mmzone.h | 23 | ||||
| -rw-r--r-- | include/linux/mpage.h | 8 | ||||
| -rw-r--r-- | include/linux/sysctl.h | 13 | ||||
| -rw-r--r-- | include/linux/uio.h | 6 | ||||
| -rw-r--r-- | include/linux/writeback.h | 30 |
8 files changed, 71 insertions, 43 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 804ea47301f5..56f2bab87d7f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -279,6 +279,7 @@ struct iattr { */ struct page; struct address_space; +struct writeback_control; struct address_space_operations { int (*writepage)(struct page *); @@ -286,10 +287,10 @@ struct address_space_operations { int (*sync_page)(struct page *); /* Write back some dirty pages from this mapping. */ - int (*writepages)(struct address_space *, int *nr_to_write); + int (*writepages)(struct address_space *, struct writeback_control *); /* Perform a writeback as a memory-freeing operation. */ - int (*vm_writeback)(struct page *, int *nr_to_write); + int (*vm_writeback)(struct page *, struct writeback_control *); /* Set a page dirty */ int (*set_page_dirty)(struct page *page); @@ -1259,7 +1260,8 @@ extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); extern int generic_file_open(struct inode * inode, struct file * filp); -extern int generic_vm_writeback(struct page *page, int *nr_to_write); +extern int generic_vm_writeback(struct page *page, + struct writeback_control *wbc); extern struct file_operations generic_ro_fops; diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 10021357c093..437572e2240b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -39,18 +39,25 @@ * can allocate highmem pages, the *get*page*() variants return * virtual kernel addresses to the allocated page(s). */ -extern struct page * FASTCALL(_alloc_pages(unsigned int gfp_mask, unsigned int order)); extern struct page * FASTCALL(__alloc_pages(unsigned int gfp_mask, unsigned int order, struct zonelist *zonelist)); extern struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order); +/* + * We get the zone list from the current node and the gfp_mask. + * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. + * + * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets + * optimized to &contig_page_data at compile-time. + */ static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order) { - /* - * Gets optimized away by the compiler. - */ - if (order >= MAX_ORDER) + pg_data_t *pgdat = NODE_DATA(numa_node_id()); + unsigned int idx = (gfp_mask & GFP_ZONEMASK); + + if (unlikely(order >= MAX_ORDER)) return NULL; - return _alloc_pages(gfp_mask, order); + + return __alloc_pages(gfp_mask, order, pgdat->node_zonelists + idx); } #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) diff --git a/include/linux/mm.h b/include/linux/mm.h index 7483c39e28dd..c63e4947387f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -15,7 +15,10 @@ #include <linux/rbtree.h> #include <linux/fs.h> +#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ extern unsigned long max_mapnr; +#endif + extern unsigned long num_physpages; extern void * high_memory; extern int page_cluster; @@ -345,8 +348,10 @@ static inline int page_mapped(struct page *page) #define VM_FAULT_MINOR 1 #define VM_FAULT_MAJOR 2 -/* The array of struct pages */ +#ifndef CONFIG_DISCONTIGMEM +/* The array of struct pages - for discontigmem use pgdat->lmem_map */ extern struct page *mem_map; +#endif extern void show_free_areas(void); diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 8ebf441bdb47..580c39c4dcc1 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -10,11 +10,14 @@ #include <linux/wait.h> #include <linux/cache.h> #include <asm/atomic.h> +#ifdef CONFIG_DISCONTIGMEM +#include <asm/numnodes.h> +#endif +#ifndef MAX_NUMNODES +#define MAX_NUMNODES 1 +#endif -/* - * Free memory management - zoned buddy allocator. - */ - +/* Free memory management - zoned buddy allocator. */ #ifndef CONFIG_FORCE_MAX_ZONEORDER #define MAX_ORDER 11 #else @@ -112,7 +115,6 @@ struct zone { struct page *zone_mem_map; /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ unsigned long zone_start_pfn; - unsigned long zone_start_mapnr; /* * rarely used fields: @@ -138,7 +140,7 @@ struct zone { * footprint of this construct is very small. */ struct zonelist { - struct zone *zones[MAX_NR_ZONES+1]; // NULL delimited + struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited }; #define GFP_ZONEMASK 0x0f @@ -163,7 +165,6 @@ typedef struct pglist_data { unsigned long *valid_addr_bitmap; struct bootmem_data *bdata; unsigned long node_start_pfn; - unsigned long node_start_mapnr; unsigned long node_size; int node_id; struct pglist_data *pgdat_next; @@ -187,10 +188,12 @@ memclass(struct zone *pgzone, struct zone *classzone) * prototypes for the discontig memory code. */ struct page; -void free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, - unsigned long *zones_size, unsigned long paddr, unsigned long *zholes_size, - struct page *pmap); +extern void calculate_totalpages (pg_data_t *pgdat, unsigned long *zones_size, + unsigned long *zholes_size); +extern void free_area_init_core(pg_data_t *pgdat, unsigned long *zones_size, + unsigned long *zholes_size); void get_zone_counts(unsigned long *active, unsigned long *inactive); +extern void build_all_zonelists(void); extern pg_data_t contig_page_data; diff --git a/include/linux/mpage.h b/include/linux/mpage.h index 52253d90f55d..86aa7b676274 100644 --- a/include/linux/mpage.h +++ b/include/linux/mpage.h @@ -10,14 +10,16 @@ * nested includes. Get it right in the .c file). */ +struct writeback_control; + int mpage_readpages(struct address_space *mapping, struct list_head *pages, unsigned nr_pages, get_block_t get_block); int mpage_readpage(struct page *page, get_block_t get_block); int mpage_writepages(struct address_space *mapping, - int *nr_to_write, get_block_t get_block); + struct writeback_control *wbc, get_block_t get_block); static inline int -generic_writepages(struct address_space *mapping, int *nr_to_write) +generic_writepages(struct address_space *mapping, struct writeback_control *wbc) { - return mpage_writepages(mapping, nr_to_write, NULL); + return mpage_writepages(mapping, wbc, NULL); } diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 3127165e7c13..9fd7d5c05605 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -128,7 +128,6 @@ enum KERN_TAINTED=53, /* int: various kernel tainted flags */ KERN_CADPID=54, /* int: PID of the process to notify on CAD */ KERN_PIDMAX=55, /* int: PID # limit */ - KERN_HUGETLB_PAGE_NUM=56, /* int: Number of available Huge Pages */ }; @@ -147,12 +146,12 @@ enum VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */ VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */ VM_DIRTY_ASYNC=12, /* dirty_async_ratio */ - VM_DIRTY_SYNC=13, /* dirty_sync_ratio */ - VM_DIRTY_WB_CS=14, /* dirty_writeback_centisecs */ - VM_DIRTY_EXPIRE_CS=15, /* dirty_expire_centisecs */ - VM_NR_PDFLUSH_THREADS=16, /* nr_pdflush_threads */ - VM_OVERCOMMIT_RATIO=17, /* percent of RAM to allow overcommit in */ - VM_PAGEBUF=18 /* struct: Control pagebuf parameters */ + VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */ + VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */ + VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */ + VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */ + VM_PAGEBUF=17, /* struct: Control pagebuf parameters */ + VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */ }; diff --git a/include/linux/uio.h b/include/linux/uio.h index ec098c8e6793..85b2f0ec9d3f 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -35,7 +35,11 @@ struct iovec #endif /* - * Total number of bytes covered by an iovec + * Total number of bytes covered by an iovec. + * + * NOTE that it is not safe to use this function until all the iovec's + * segment lengths have been validated. Because the individual lengths can + * overflow a size_t when added together. */ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs) { diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 5de884cd6a7c..c35b96eb6a90 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -27,22 +27,29 @@ static inline int current_is_pdflush(void) * fs/fs-writeback.c */ enum writeback_sync_modes { - WB_SYNC_NONE = 0, /* Don't wait on anything */ - WB_SYNC_LAST = 1, /* Wait on the last-written mapping */ - WB_SYNC_ALL = 2, /* Wait on every mapping */ - WB_SYNC_HOLD = 3, /* Hold the inode on sb_dirty for sys_sync() */ + WB_SYNC_NONE, /* Don't wait on anything */ + WB_SYNC_ALL, /* Wait on every mapping */ + WB_SYNC_HOLD, /* Hold the inode on sb_dirty for sys_sync() */ }; -void writeback_unlocked_inodes(int *nr_to_write, - enum writeback_sync_modes sync_mode, - unsigned long *older_than_this); +/* + * A control structure which tells the writeback code what to do + */ +struct writeback_control { + struct backing_dev_info *bdi; /* If !NULL, only write back this + queue */ + enum writeback_sync_modes sync_mode; + unsigned long *older_than_this; /* If !NULL, only write back inodes + older than this */ + long nr_to_write; /* Write this many pages, and decrement + this for each page written */ +}; + +void writeback_inodes(struct writeback_control *wbc); void wake_up_inode(struct inode *inode); void __wait_on_inode(struct inode * inode); void sync_inodes_sb(struct super_block *, int wait); void sync_inodes(int wait); -void writeback_backing_dev(struct backing_dev_info *bdi, int *nr_to_write, - enum writeback_sync_modes sync_mode, - unsigned long *older_than_this); /* writeback.h requires fs.h; it, too, is not included from here. */ static inline void wait_on_inode(struct inode *inode) @@ -57,7 +64,6 @@ static inline void wait_on_inode(struct inode *inode) /* These 5 are exported to sysctl. */ extern int dirty_background_ratio; extern int dirty_async_ratio; -extern int dirty_sync_ratio; extern int dirty_writeback_centisecs; extern int dirty_expire_centisecs; @@ -65,7 +71,7 @@ extern int dirty_expire_centisecs; void balance_dirty_pages(struct address_space *mapping); void balance_dirty_pages_ratelimited(struct address_space *mapping); int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0); -int do_writepages(struct address_space *mapping, int *nr_to_write); +int do_writepages(struct address_space *mapping, struct writeback_control *wbc); /* pdflush.c */ extern int nr_pdflush_threads; /* Global so it can be exported to sysctl |
