From aa78091f0f2860df00a4ccc5d4609afd9d831dd0 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 29 Apr 2002 23:52:37 -0700 Subject: [PATCH] cleanup page flags page->flags cleanup. Moves the definitions of the page->flags bits and all the PageFoo macros into linux/page-flags.h. That file is currently included from mm.h, but the stage is set to remove that and include page-flags.h direct in all .c files which require that. (120 of them). The patch also makes all the page flag macros and functions consistent: For PG_foo, the following functions are defined: SetPageFoo ClearPageFoo TestSetPageFoo TestClearPageFoo PageFoo and that's it. - Page_Uptodate is renamed to PageUptodate - LockPage is removed. All users updated to use SetPageLocked - UnlockPage is removed. All callers updated to use unlock_page(). it's a real function - there's no need to hide that fact. - PageTestandClearReferenced renamed to TestClearPageReferenced - PageSetSlab renamed to SetPageSlab - __SetPageReserved is removed. It's an infinitesimally small microoptimisation, and is inconsistent. - TryLockPage is renamed to TestSetPageLocked - PageSwapCache() is renamed to page_swap_cache(), so it doesn't pretend to be a page->flags bit test. --- include/linux/mm.h | 70 ------------------------------------------------------ 1 file changed, 70 deletions(-) (limited to 'include/linux/mm.h') diff --git a/include/linux/mm.h b/include/linux/mm.h index b548d2cd8504..e8451aeaa93a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -191,11 +191,6 @@ typedef struct page { #define set_page_count(p,v) atomic_set(&(p)->count, v) /* - * Various page->flags bits: - * - * PG_reserved is set for special pages, which can never be swapped - * out. Some of them might not even exist (eg empty_bad_page)... - * * Multiple processes may "see" the same page. E.g. for untouched * mappings of /dev/null, all processes see the same page full of * zeroes, and text pages of executables and shared libraries have @@ -224,8 +219,6 @@ typedef struct page { * page's address_space. Usually, this is the address of a circular * list of the page's disk buffers. * - * The PG_private bitflag is set if page->private contains a valid - * value. * For pages belonging to inodes, the page->count is the number of * attaches, plus 1 if `private' contains something, plus one for * the page cache itself. @@ -244,63 +237,8 @@ typedef struct page { * to be written to disk, * - private pages which have been modified may need to be swapped out * to swap space and (later) to be read back into memory. - * During disk I/O, PG_locked_dontuse is used. This bit is set before I/O - * and reset when I/O completes. page_waitqueue(page) is a wait queue of all - * tasks waiting for the I/O on this page to complete. - * PG_uptodate tells whether the page's contents is valid. - * When a read completes, the page becomes uptodate, unless a disk I/O - * error happened. - * - * For choosing which pages to swap out, inode pages carry a - * PG_referenced bit, which is set any time the system accesses - * that page through the (mapping,index) hash table. This referenced - * bit, together with the referenced bit in the page tables, is used - * to manipulate page->age and move the page across the active, - * inactive_dirty and inactive_clean lists. - * - * 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_dontuse bit! - * - * PG_skip is used on sparc/sparc64 architectures to "skip" certain - * parts of the address space. - * - * PG_error is set to indicate that an I/O error occurred on this page. - * - * PG_arch_1 is an architecture specific page state bit. The generic - * code guarantees that this bit is cleared for a page when it first - * is entered into the page cache. - * - * PG_highmem pages are not permanently mapped into the kernel virtual - * address space, they need to be kmapped separately for doing IO on - * the pages. The struct page (these bits with information) are always - * mapped into kernel address space... */ -/* - * Don't use the *_dontuse flags. Use the macros. Otherwise - * you'll break locked- and dirty-page accounting. - */ -#define PG_locked_dontuse 0 /* Page is locked. Don't touch. */ -#define PG_error 1 -#define PG_referenced 2 -#define PG_uptodate 3 - -#define PG_dirty_dontuse 4 -#define PG_unused 5 /* err. This is unused. */ -#define PG_lru 6 -#define PG_active 7 - -#define PG_slab 8 /* slab debug (Suparna wants this) */ -#define PG_skip 10 /* kill me now: obsolete */ -#define PG_highmem 11 -#define PG_checked 12 /* kill me in 2.5.. */ - -#define PG_arch_1 13 -#define PG_reserved 14 -#define PG_launder 15 /* written out by VM pressure.. */ -#define PG_private 16 /* Has something at ->private */ - /* * FIXME: take this include out, include page-flags.h in * files which need it (119 of them) @@ -444,14 +382,6 @@ extern void show_mem(void); extern void si_meminfo(struct sysinfo * val); extern void swapin_readahead(swp_entry_t); -extern struct address_space swapper_space; -#define PageSwapCache(page) ((page)->mapping == &swapper_space) - -static inline int is_page_cache_freeable(struct page * page) -{ - return page_count(page) - !!PagePrivate(page) == 1; -} - extern int can_share_swap_page(struct page *); extern int remove_exclusive_swap_page(struct page *); -- cgit v1.2.3