diff options
| author | Greg Kroah-Hartman <greg@kroah.com> | 2002-08-28 02:38:19 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2002-08-28 02:38:19 -0700 |
| commit | bae5f7f01126f7c9ddc5c4422056e15a57f07273 (patch) | |
| tree | b019b133dd282289f59e18458af7fccb9135976b /include/linux | |
| parent | d2190517ccc852380a2972adfb0ba25c0a44d766 (diff) | |
| parent | 93a3177fa3e97d3cf5901fe1d61c98cf7217f036 (diff) | |
Merge kroah.com:/home/greg/linux/BK/bleeding_edge-2.5
into kroah.com:/home/greg/linux/BK/gregkh-2.5
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cache.h | 9 | ||||
| -rw-r--r-- | include/linux/dcache.h | 2 | ||||
| -rw-r--r-- | include/linux/gfp.h | 2 | ||||
| -rw-r--r-- | include/linux/ide.h | 35 | ||||
| -rw-r--r-- | include/linux/interrupt.h | 4 | ||||
| -rw-r--r-- | include/linux/kernel.h | 6 | ||||
| -rw-r--r-- | include/linux/list.h | 13 | ||||
| -rw-r--r-- | include/linux/mm.h | 9 | ||||
| -rw-r--r-- | include/linux/mm_inline.h | 40 | ||||
| -rw-r--r-- | include/linux/mmzone.h | 58 | ||||
| -rw-r--r-- | include/linux/page-flags.h | 5 | ||||
| -rw-r--r-- | include/linux/swap.h | 51 |
12 files changed, 130 insertions, 104 deletions
diff --git a/include/linux/cache.h b/include/linux/cache.h index 37d7a6fe4b6e..95faa6ec3aa7 100644 --- a/include/linux/cache.h +++ b/include/linux/cache.h @@ -44,4 +44,13 @@ #endif /* CONFIG_SMP */ #endif +#if !defined(____cacheline_maxaligned_in_smp) +#if defined(CONFIG_SMP) +#define ____cacheline_maxaligned_in_smp \ + __attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX)))) +#else +#define ____cacheline_maxaligned_in_smp +#endif +#endif + #endif /* __LINUX_CACHE_H */ diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 897d414ac466..f99a03f17e60 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -181,8 +181,6 @@ extern void shrink_dcache_parent(struct dentry *); extern void shrink_dcache_anon(struct list_head *); extern int d_invalidate(struct dentry *); -#define shrink_dcache() prune_dcache(0) -struct zone_struct; /* dcache memory management */ extern int shrink_dcache_memory(int, unsigned int); extern void prune_dcache(int); diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 317d45415250..10021357c093 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -40,7 +40,7 @@ * 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, zonelist_t *zonelist)); +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); static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order) diff --git a/include/linux/ide.h b/include/linux/ide.h index 62fd4b0fae50..aacdaad8f594 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -470,7 +470,6 @@ typedef struct ide_drive_s { unsigned no_unmask : 1; /* disallow setting unmask bit */ unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ unsigned nobios : 1; /* flag: do not probe bios for drive */ - unsigned revalidate : 1; /* request revalidation */ unsigned atapi_overlap : 1; /* flag: ATAPI overlap (not supported) */ unsigned nice0 : 1; /* flag: give obvious excess bandwidth */ unsigned nice2 : 1; /* flag: give a share in our own bandwidth */ @@ -530,6 +529,7 @@ typedef struct ide_drive_s { byte acoustic; /* acoustic management */ unsigned int failures; /* current failure count */ unsigned int max_failures; /* maximum allowed failure count */ + struct list_head list; } ide_drive_t; /* @@ -889,6 +889,7 @@ read_proc_t proc_ide_read_geometry; #define IDE_SUBDRIVER_VERSION 1 typedef struct ide_driver_s { + struct module *owner; const char *name; const char *version; byte media; @@ -913,10 +914,11 @@ typedef struct ide_driver_s { unsigned long (*capacity)(ide_drive_t *); ide_startstop_t (*special)(ide_drive_t *); ide_proc_entry_t *proc; - int (*init)(void); int (*reinit)(ide_drive_t *); void (*ata_prebuilder)(ide_drive_t *); void (*atapi_prebuilder)(ide_drive_t *); + struct list_head drives; + struct list_head drivers; } ide_driver_t; #define DRIVER(drive) ((drive)->driver) @@ -926,7 +928,6 @@ typedef struct ide_driver_s { */ #define IDE_CHIPSET_MODULE 0 /* not supported yet */ #define IDE_PROBE_MODULE 1 -#define IDE_DRIVER_MODULE 2 typedef int (ide_module_init_proc)(void); @@ -947,7 +948,6 @@ typedef struct ide_module_s { */ #ifndef _IDE_C extern ide_hwif_t ide_hwifs[]; /* master data repository */ -extern ide_module_t *ide_modules; extern ide_module_t *ide_probe; #endif extern int noautodma; @@ -1210,37 +1210,16 @@ extern struct block_device_operations ide_fops[]; extern ide_proc_entry_t generic_subdriver_entries[]; #endif -int ide_reinit_drive (ide_drive_t *drive); +int ata_attach(ide_drive_t *drive); #ifdef _IDE_C #ifdef CONFIG_BLK_DEV_IDE int ideprobe_init (void); #endif /* CONFIG_BLK_DEV_IDE */ -#ifdef CONFIG_BLK_DEV_IDEDISK -int idedisk_reinit (ide_drive_t *drive); -int idedisk_init (void); -#endif /* CONFIG_BLK_DEV_IDEDISK */ -#ifdef CONFIG_BLK_DEV_IDECD -int ide_cdrom_reinit (ide_drive_t *drive); -int ide_cdrom_init (void); -#endif /* CONFIG_BLK_DEV_IDECD */ -#ifdef CONFIG_BLK_DEV_IDETAPE -int idetape_reinit (ide_drive_t *drive); -int idetape_init (void); -#endif /* CONFIG_BLK_DEV_IDETAPE */ -#ifdef CONFIG_BLK_DEV_IDEFLOPPY -int idefloppy_reinit (ide_drive_t *drive); -int idefloppy_init (void); -#endif /* CONFIG_BLK_DEV_IDEFLOPPY */ -#ifdef CONFIG_BLK_DEV_IDESCSI -int idescsi_reinit (ide_drive_t *drive); -int idescsi_init (void); -#endif /* CONFIG_BLK_DEV_IDESCSI */ #endif /* _IDE_C */ -int ide_register_module (ide_module_t *module); -void ide_unregister_module (ide_module_t *module); -ide_drive_t *ide_scan_devices (byte media, const char *name, ide_driver_t *driver, int n); +int ide_register_driver(ide_driver_t *driver); +void ide_unregister_driver(ide_driver_t *driver); int ide_register_subdriver (ide_drive_t *drive, ide_driver_t *driver, int version); int ide_unregister_subdriver (ide_drive_t *drive); int ide_replace_subdriver(ide_drive_t *drive, const char *driver); diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 09e6b86ee763..26588de0b514 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -50,9 +50,9 @@ enum { #if !CONFIG_SMP # define cli() local_irq_disable() # define sti() local_irq_enable() -# define save_flags(x) local_irq_save(x) +# define save_flags(x) local_save_flags(x) # define restore_flags(x) local_irq_restore(x) -# define save_and_cli(x) local_irq_save_off(x) +# define save_and_cli(x) local_irq_save(x) #endif diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 022587afdc46..95965970e49b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -191,4 +191,10 @@ struct sysinfo { }; #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) + +/* Trap pasters of __FUNCTION__ at compile-time */ +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 +#define __FUNCTION__ (__func__) +#endif + #endif diff --git a/include/linux/list.h b/include/linux/list.h index 3bc81f885ce1..913c93c44286 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -211,6 +211,19 @@ static inline void list_splice_init(list_t *list, list_t *head) for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + #endif /* __KERNEL__ || _LVM_H_INCLUDE */ #endif diff --git a/include/linux/mm.h b/include/linux/mm.h index d731c02741b9..045a861e4024 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -157,7 +157,7 @@ struct page { struct address_space *mapping; /* The inode (or ...) we belong to. */ unsigned long index; /* Our offset within mapping. */ struct list_head lru; /* Pageout list, eg. active_list; - protected by pagemap_lru_lock !! */ + protected by zone->lru_lock !! */ union { struct pte_chain * chain; /* Reverse pte mapping pointer. * protected by PG_chainlock */ @@ -268,10 +268,10 @@ void FASTCALL(__free_pages_ok(struct page *page, unsigned int order)); #define NODE_SHIFT 4 #define ZONE_SHIFT (BITS_PER_LONG - 8) -struct zone_struct; -extern struct zone_struct *zone_table[]; +struct zone; +extern struct zone *zone_table[]; -static inline zone_t *page_zone(struct page *page) +static inline struct zone *page_zone(struct page *page) { return zone_table[page->flags >> ZONE_SHIFT]; } @@ -449,7 +449,6 @@ static inline int can_vma_merge(struct vm_area_struct * vma, unsigned long vm_fl return 0; } -struct zone_t; /* filemap.c */ extern unsigned long page_unuse(struct page *); extern void truncate_inode_pages(struct address_space *, loff_t); diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h new file mode 100644 index 000000000000..47762ca695a5 --- /dev/null +++ b/include/linux/mm_inline.h @@ -0,0 +1,40 @@ + +static inline void +add_page_to_active_list(struct zone *zone, struct page *page) +{ + list_add(&page->lru, &zone->active_list); + zone->nr_active++; +} + +static inline void +add_page_to_inactive_list(struct zone *zone, struct page *page) +{ + list_add(&page->lru, &zone->inactive_list); + zone->nr_inactive++; +} + +static inline void +del_page_from_active_list(struct zone *zone, struct page *page) +{ + list_del(&page->lru); + zone->nr_active--; +} + +static inline void +del_page_from_inactive_list(struct zone *zone, struct page *page) +{ + list_del(&page->lru); + zone->nr_inactive--; +} + +static inline void +del_page_from_lru(struct zone *zone, struct page *page) +{ + list_del(&page->lru); + if (PageActive(page)) { + ClearPageActive(page); + zone->nr_active--; + } else { + zone->nr_inactive--; + } +} diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index df4523bc5341..f30bd4f44863 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -8,6 +8,8 @@ #include <linux/spinlock.h> #include <linux/list.h> #include <linux/wait.h> +#include <linux/cache.h> +#include <asm/atomic.h> /* * Free memory management - zoned buddy allocator. @@ -27,6 +29,21 @@ typedef struct free_area_struct { struct pglist_data; /* + * zone->lock and zone->lru_lock are two of the hottest locks in the kernel. + * So add a wild amount of padding here to ensure that they fall into separate + * cachelines. There are very few zone structures in the machine, so space + * consumption is not a concern here. + */ +#if defined(CONFIG_SMP) +struct zone_padding { + int x; +} ____cacheline_maxaligned_in_smp; +#define ZONE_PADDING(name) struct zone_padding name; +#else +#define ZONE_PADDING(name) +#endif + +/* * On machines where it is needed (eg PCs) we divide physical memory * into multiple physical zones. On a PC we have 3 zones: * @@ -34,7 +51,8 @@ struct pglist_data; * ZONE_NORMAL 16-896 MB direct mapped by the kernel * ZONE_HIGHMEM > 896 MB only page cache and user processes */ -typedef struct zone_struct { + +struct zone { /* * Commonly accessed fields: */ @@ -43,6 +61,17 @@ typedef struct zone_struct { unsigned long pages_min, pages_low, pages_high; int need_balance; + ZONE_PADDING(_pad1_) + + spinlock_t lru_lock; + struct list_head active_list; + struct list_head inactive_list; + atomic_t refill_counter; + unsigned long nr_active; + unsigned long nr_inactive; + + ZONE_PADDING(_pad2_) + /* * free areas of different sizes */ @@ -89,7 +118,7 @@ typedef struct zone_struct { */ char *name; unsigned long size; -} zone_t; +} ____cacheline_maxaligned_in_smp; #define ZONE_DMA 0 #define ZONE_NORMAL 1 @@ -107,16 +136,16 @@ typedef struct zone_struct { * so despite the zonelist table being relatively big, the cache * footprint of this construct is very small. */ -typedef struct zonelist_struct { - zone_t * zones [MAX_NR_ZONES+1]; // NULL delimited -} zonelist_t; +struct zonelist { + struct zone *zones[MAX_NR_ZONES+1]; // NULL delimited +}; #define GFP_ZONEMASK 0x0f /* * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM * (mostly NUMA machines?) to denote a higher-level memory zone than the - * zone_struct denotes. + * zone denotes. * * On NUMA machines, each NUMA node would have a pg_data_t to describe * it's memory layout. @@ -126,8 +155,8 @@ typedef struct zonelist_struct { */ struct bootmem_data; typedef struct pglist_data { - zone_t node_zones[MAX_NR_ZONES]; - zonelist_t node_zonelists[GFP_ZONEMASK+1]; + struct zone node_zones[MAX_NR_ZONES]; + struct zonelist node_zonelists[GFP_ZONEMASK+1]; int nr_zones; struct page *node_mem_map; unsigned long *valid_addr_bitmap; @@ -142,7 +171,8 @@ typedef struct pglist_data { extern int numnodes; extern pg_data_t *pgdat_list; -static inline int memclass(zone_t *pgzone, zone_t *classzone) +static inline int +memclass(struct zone *pgzone, struct zone *classzone) { if (pgzone->zone_pgdat != classzone->zone_pgdat) return 0; @@ -156,10 +186,10 @@ static inline int memclass(zone_t *pgzone, zone_t *classzone) * prototypes for the discontig memory code. */ struct page; -extern void show_free_areas_core(pg_data_t *pgdat); -extern void free_area_init_core(int nid, pg_data_t *pgdat, struct page **gmap, +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); +void get_zone_counts(unsigned long *active, unsigned long *inactive); extern pg_data_t contig_page_data; @@ -181,7 +211,7 @@ extern pg_data_t contig_page_data; * next_zone - helper magic for for_each_zone() * Thanks to William Lee Irwin III for this piece of ingenuity. */ -static inline zone_t * next_zone(zone_t * zone) +static inline struct zone *next_zone(struct zone *zone) { pg_data_t *pgdat = zone->zone_pgdat; @@ -198,7 +228,7 @@ static inline zone_t * next_zone(zone_t * zone) /** * for_each_zone - helper macro to iterate over all memory zones - * @zone - pointer to zone_t variable + * @zone - pointer to struct zone variable * * The user only needs to declare the zone variable, for_each_zone * fills it in. This basically means for_each_zone() is an @@ -206,7 +236,7 @@ static inline zone_t * next_zone(zone_t * zone) * * for (pgdat = pgdat_list; pgdat; pgdat = pgdat->node_next) * for (i = 0; i < MAX_NR_ZONES; ++i) { - * zone_t * z = pgdat->node_zones + i; + * struct zone * z = pgdat->node_zones + i; * ... * } * } diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 9801b15876d9..5a49020e728b 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -28,7 +28,7 @@ * * Note that the referenced bit, the page->lru list_head and the active, * inactive_dirty and inactive_clean lists are protected by the - * pagemap_lru_lock, and *NOT* by the usual PG_locked bit! + * zone->lru_lock, and *NOT* by the usual PG_locked bit! * * PG_error is set to indicate that an I/O error occurred on this page. * @@ -76,8 +76,6 @@ extern struct page_state { unsigned long nr_dirty; unsigned long nr_writeback; unsigned long nr_pagecache; - unsigned long nr_active; /* on active_list LRU */ - unsigned long nr_inactive; /* on inactive_list LRU */ unsigned long nr_page_table_pages; unsigned long nr_reverse_maps; } ____cacheline_aligned_in_smp page_states[NR_CPUS]; @@ -163,6 +161,7 @@ extern void get_page_state(struct page_state *ret); #define SetPageActive(page) set_bit(PG_active, &(page)->flags) #define ClearPageActive(page) clear_bit(PG_active, &(page)->flags) #define TestClearPageActive(page) test_and_clear_bit(PG_active, &(page)->flags) +#define TestSetPageActive(page) test_and_set_bit(PG_active, &(page)->flags) #define PageSlab(page) test_bit(PG_slab, &(page)->flags) #define SetPageSlab(page) set_bit(PG_slab, &(page)->flags) diff --git a/include/linux/swap.h b/include/linux/swap.h index a7f1f96ff9f1..affa89d77eb1 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -139,7 +139,7 @@ struct task_struct; struct vm_area_struct; struct sysinfo; struct address_space; -struct zone_t; +struct zone; /* linux/mm/rmap.c */ extern int FASTCALL(page_referenced(struct page *)); @@ -163,7 +163,7 @@ extern void swap_setup(void); /* linux/mm/vmscan.c */ extern wait_queue_head_t kswapd_wait; -extern int FASTCALL(try_to_free_pages(zone_t *, unsigned int, unsigned int)); +extern int try_to_free_pages(struct zone *, unsigned int, unsigned int); /* linux/mm/page_io.c */ int swap_readpage(struct file *file, struct page *page); @@ -209,55 +209,8 @@ extern struct swap_list_t swap_list; asmlinkage long sys_swapoff(const char *); asmlinkage long sys_swapon(const char *, int); -extern spinlock_t _pagemap_lru_lock; - extern void FASTCALL(mark_page_accessed(struct page *)); -/* - * List add/del helper macros. These must be called - * with the pagemap_lru_lock held! - */ -#define DEBUG_LRU_PAGE(page) \ -do { \ - if (!PageLRU(page)) \ - BUG(); \ - if (PageActive(page)) \ - BUG(); \ -} while (0) - -#define __add_page_to_active_list(page) \ -do { \ - list_add(&(page)->lru, &active_list); \ - inc_page_state(nr_active); \ -} while (0) - -#define add_page_to_active_list(page) \ -do { \ - DEBUG_LRU_PAGE(page); \ - SetPageActive(page); \ - __add_page_to_active_list(page); \ -} while (0) - -#define add_page_to_inactive_list(page) \ -do { \ - DEBUG_LRU_PAGE(page); \ - list_add(&(page)->lru, &inactive_list); \ - inc_page_state(nr_inactive); \ -} while (0) - -#define del_page_from_active_list(page) \ -do { \ - list_del(&(page)->lru); \ - ClearPageActive(page); \ - dec_page_state(nr_active); \ -} while (0) - -#define del_page_from_inactive_list(page) \ -do { \ - list_del(&(page)->lru); \ - dec_page_state(nr_inactive); \ -} while (0) - extern spinlock_t swaplock; #define swap_list_lock() spin_lock(&swaplock) |
