linuxcompressed-checkins Mailing List for Linux Compressed Cache
Status: Beta
Brought to you by:
nitin_sf
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(31) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(28) |
Feb
(50) |
Mar
(29) |
Apr
(6) |
May
(33) |
Jun
(36) |
Jul
(60) |
Aug
(7) |
Sep
(12) |
Oct
|
Nov
(13) |
Dec
(3) |
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
(13) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(22) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Nitin G. <nit...@us...> - 2006-06-21 17:12:56
|
Update of /cvsroot/linuxcompressed/linux26/include/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5254/include/linux Modified Files: ccache.h page-flags.h sysctl.h Log Message: kernel 2.6.17.1: vswap stable. Started work on add_to_ccache() and friends Index: ccache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/include/linux/ccache.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** ccache.h 15 Jun 2006 10:24:06 -0000 1.6 --- ccache.h 21 Jun 2006 17:12:47 -0000 1.7 *************** *** 16,19 **** --- 16,23 ---- #define MAX_SWAP_OFFSET (1 << MAX_SWAP_OFFSET_SHIFT) + /* Error codes */ + #define CC_ENOMEM 1 + #define CC_EUSED 2 + extern unsigned long max_anon_cc_size, max_fs_backed_cc_size; *************** *** 31,35 **** struct chunk_head { unsigned long flags; /* compression algo used, no. of chunks etc. */ ! atomic_t count; /* usage count; free this struct * when count is 0 */ struct chunk *chunk_list; /* point to first chunk */ --- 35,39 ---- struct chunk_head { unsigned long flags; /* compression algo used, no. of chunks etc. */ ! atomic_t _count; /* usage count; free this struct * when count is 0 */ struct chunk *chunk_list; /* point to first chunk */ *************** *** 49,52 **** --- 53,57 ---- extern int set_anon_cc_size(unsigned long size); extern int should_add_to_ccache(struct page *page); + extern int add_to_ccache(struct page *page); extern int sysctl_max_anon_cc_size(ctl_table *table, int write, struct file *file, void __user *buffer, size_t *length, loff_t *ppos); Index: page-flags.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/include/linux/page-flags.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** page-flags.h 21 Jun 2006 11:13:08 -0000 1.7 --- page-flags.h 21 Jun 2006 17:12:47 -0000 1.8 *************** *** 91,96 **** #define PG_uncached 20 /* Page has been mapped as uncached */ ! #define PG_will_compress 21 ! #define PG_compressed 22 /* --- 91,96 ---- #define PG_uncached 20 /* Page has been mapped as uncached */ ! #define PG_will_compress 21 /* going, going.... */ ! #define PG_compressed 22 /* gone! */ /* *************** *** 225,240 **** * Manipulation of page state flags */ ! #define PageWillCompress(page) \ test_bit(PG_will_compress, &(page)->flags) ! #define SetPageWillCompress(page) \ set_bit(PG_will_compress, &(page)->flags) ! #define ClearPageWillCompress(page) \ clear_bit(PG_will_compress, &(page)->flags) ! #define PageCompressed(page) \ test_bit(PG_compressed, &(page)->flags) ! #define SetPageCompressed(page) \ set_bit(PG_compressed, &(page)->flags) ! #define ClearPageCompressed(page) \ clear_bit(PG_compressed, &(page)->flags) --- 225,240 ---- * Manipulation of page state flags */ ! #define PageWillCompress(page) \ test_bit(PG_will_compress, &(page)->flags) ! #define SetPageWillCompress(page) \ set_bit(PG_will_compress, &(page)->flags) ! #define ClearPageWillCompress(page) \ clear_bit(PG_will_compress, &(page)->flags) ! #define PageCompressed(page) \ test_bit(PG_compressed, &(page)->flags) ! #define SetPageCompressed(page) \ set_bit(PG_compressed, &(page)->flags) ! #define ClearPageCompressed(page) \ clear_bit(PG_compressed, &(page)->flags) Index: sysctl.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/include/linux/sysctl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** sysctl.h 15 Jun 2006 10:24:07 -0000 1.1 --- sysctl.h 21 Jun 2006 17:12:47 -0000 1.2 *************** *** 187,191 **** VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */ ! VM_MAX_ANON_CC_SIZE=33, /* max size for compressed cache for anonymous pages */ }; --- 187,191 ---- VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */ ! VM_MAX_ANON_CC_SIZE=33, /* max size for compressed cache for anonymous pages */ }; |
From: Nitin G. <nit...@us...> - 2006-06-21 17:12:56
|
Update of /cvsroot/linuxcompressed/linux26/kernel In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5254/kernel Modified Files: sysctl.c Log Message: kernel 2.6.17.1: vswap stable. Started work on add_to_ccache() and friends Index: sysctl.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/kernel/sysctl.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** sysctl.c 15 Jun 2006 10:24:07 -0000 1.1 --- sysctl.c 21 Jun 2006 17:12:47 -0000 1.2 *************** *** 798,802 **** }, #ifdef CONFIG_HUGETLB_PAGE ! { .ctl_name = VM_HUGETLB_PAGES, .procname = "nr_hugepages", --- 798,802 ---- }, #ifdef CONFIG_HUGETLB_PAGE ! { .ctl_name = VM_HUGETLB_PAGES, .procname = "nr_hugepages", *************** *** 807,812 **** .extra1 = (void *)&hugetlb_zero, .extra2 = (void *)&hugetlb_infinity, ! }, ! { .ctl_name = VM_HUGETLB_GROUP, .procname = "hugetlb_shm_group", --- 807,812 ---- .extra1 = (void *)&hugetlb_zero, .extra2 = (void *)&hugetlb_infinity, ! }, ! { .ctl_name = VM_HUGETLB_GROUP, .procname = "hugetlb_shm_group", *************** *** 815,819 **** .mode = 0644, .proc_handler = &proc_dointvec, ! }, #endif { --- 815,819 ---- .mode = 0644, .proc_handler = &proc_dointvec, ! }, #endif { |
From: Nitin G. <nit...@us...> - 2006-06-21 17:12:53
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv5254/mm Modified Files: swapfile.c vmscan.c Log Message: kernel 2.6.17.1: vswap stable. Started work on add_to_ccache() and friends Index: swapfile.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/swapfile.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** swapfile.c 15 Jun 2006 10:24:07 -0000 1.5 --- swapfile.c 21 Jun 2006 17:12:47 -0000 1.6 *************** *** 91,95 **** int latency_ration = LATENCY_LIMIT; - pr_info("** start scan_swap_map **\n"); /* * We try to cluster swap pages by allocating them sequentially --- 91,94 ---- *************** *** 152,156 **** si->cluster_next = offset + 1; si->flags -= SWP_SCANNING; ! pr_info("** scan_map: return in mid **\n"); return offset; } --- 151,157 ---- si->cluster_next = offset + 1; si->flags -= SWP_SCANNING; ! if (si->flags & SWP_COMPRESSED) { ! pr_info("scan_swap_map: vswap offset: %lu\n", offset); ! } return offset; } *************** *** 172,176 **** no_page: si->flags -= SWP_SCANNING; - pr_info("** end scan_swap_map **\n"); return 0; } --- 173,176 ---- *************** *** 196,202 **** wrapped++; } ! ! pr_info("get_swap_page loop\n"); ! if (!si->highest_bit) continue; --- 196,200 ---- wrapped++; } ! if (!si->highest_bit) continue; *************** *** 636,640 **** static unsigned int find_next_to_unuse(struct swap_info_struct *si, unsigned int prev) ! { unsigned int max = si->max; unsigned int i = prev; --- 634,638 ---- static unsigned int find_next_to_unuse(struct swap_info_struct *si, unsigned int prev) ! { unsigned int max = si->max; unsigned int i = prev; *************** *** 1166,1171 **** int i, type, prev; int err; - - printk(KERN_INFO "sys_swapoff called.\n"); if (!capable(CAP_SYS_ADMIN)) --- 1164,1167 ---- *************** *** 1338,1342 **** if (ptr->flags & SWP_COMPRESSED) { ! pr_info("virt swap to be printed\n"); return 0; } --- 1334,1338 ---- if (ptr->flags & SWP_COMPRESSED) { ! pr_info("vswap to be printed\n"); return 0; } *************** *** 1390,1394 **** unsigned int type=swp_type(entry); if (swap_info[type].flags & SWP_COMPRESSED) { ! pr_info("This is virt swap\n"); return 1; } --- 1386,1390 ---- unsigned int type=swp_type(entry); if (swap_info[type].flags & SWP_COMPRESSED) { ! // pr_info("This is virt swap\n"); return 1; } *************** *** 1488,1491 **** --- 1484,1488 ---- EXPORT_SYMBOL(set_anon_cc_size); + /* * Written 01/25/92 by Simmule Turner, heavily changed by Linus. *************** *** 1678,1685 **** */ maxpages = swp_offset(pte_to_swp_entry(swp_entry_to_pte(swp_entry(0,~0UL)))) - 1; ! if (maxpages > swap_header->info.last_page) { maxpages = swap_header->info.last_page; - pr_info("in sys_swapon swap_header->info.last_page: %lu\n", maxpages); - } p->highest_bit = maxpages - 1; --- 1675,1680 ---- */ maxpages = swp_offset(pte_to_swp_entry(swp_entry_to_pte(swp_entry(0,~0UL)))) - 1; ! if (maxpages > swap_header->info.last_page) maxpages = swap_header->info.last_page; p->highest_bit = maxpages - 1; *************** *** 1740,1744 **** spin_lock(&swap_lock); p->flags = SWP_ACTIVE; - pr_info("in sys_swapon: nr_good_pages: %u\n", nr_good_pages); nr_swap_pages += nr_good_pages; total_swap_pages += nr_good_pages; --- 1735,1738 ---- *************** *** 1835,1843 **** offset = swp_offset(entry); - pr_info("swp_dup: offset: %lu\n", offset); - pr_info("swp_dup: p->max: %u\n", p->max); - if (offset < p->max) pr_info("swp_dup: p->swap_map[offset]: %d\n", p->swap_map[offset]); - - spin_lock(&swap_lock); if (offset < p->max && p->swap_map[offset]) { --- 1829,1832 ---- Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/vmscan.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** vmscan.c 11 Jun 2006 20:03:48 -0000 1.13 --- vmscan.c 21 Jun 2006 17:12:47 -0000 1.14 *************** *** 314,324 **** * See swapfile.c:page_queue_congested(). */ - if (PageWillCompress(page)) { ! pr_info("Compressed page in pageout\n"); ClearPageWillCompress(page); return PAGE_KEEP; } ! if (!is_page_cache_freeable(page)) return PAGE_KEEP; --- 314,323 ---- * See swapfile.c:page_queue_congested(). */ if (PageWillCompress(page)) { ! pr_info("pageout: page to compress\n"); ClearPageWillCompress(page); return PAGE_KEEP; } ! if (!is_page_cache_freeable(page)) return PAGE_KEEP; *************** *** 1074,1078 **** total_scanned = 0; nr_reclaimed = 0; ! sc.may_writepage = !laptop_mode, sc.nr_mapped = read_page_state(nr_mapped); --- 1073,1077 ---- total_scanned = 0; nr_reclaimed = 0; ! sc.may_writepage = !laptop_mode; sc.nr_mapped = read_page_state(nr_mapped); |
From: Nitin G. <nit...@us...> - 2006-06-21 11:13:12
|
Update of /cvsroot/linuxcompressed/linux26/include/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8839/include/linux Added Files: page-flags.h Log Message: forgot to add some files |
From: Nitin G. <nit...@us...> - 2006-06-21 11:13:11
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8839/mm Added Files: Makefile Log Message: forgot to add some files --- NEW FILE --- # # Makefile for the linux memory manager. # mmu-y := nommu.o mmu-$(CONFIG_MMU) := fremap.o highmem.o madvise.o memory.o mincore.o \ mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \ vmalloc.o obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \ page_alloc.o page-writeback.o pdflush.o \ readahead.o swap.o truncate.o vmscan.o \ prio_tree.o util.o mmzone.o ccache.o $(mmu-y) obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o obj-$(CONFIG_HUGETLBFS) += hugetlb.o obj-$(CONFIG_NUMA) += mempolicy.o obj-$(CONFIG_SPARSEMEM) += sparse.o obj-$(CONFIG_SHMEM) += shmem.o obj-$(CONFIG_TINY_SHMEM) += tiny-shmem.o obj-$(CONFIG_SLOB) += slob.o obj-$(CONFIG_SLAB) += slab.o obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o obj-$(CONFIG_FS_XIP) += filemap_xip.o obj-$(CONFIG_MIGRATION) += migrate.o |
From: Nitin G. <nit...@us...> - 2006-06-15 10:24:11
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24075/mm Modified Files: swapfile.c Log Message: vswap now doesnt crash. No de/compression. Interfaces now via sysctl so cc_control module not reqd now. Index: swapfile.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/swapfile.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** swapfile.c 11 Jun 2006 20:03:48 -0000 1.4 --- swapfile.c 15 Jun 2006 10:24:07 -0000 1.5 *************** *** 1404,1409 **** struct swap_extent *new_se; - pr_info("set_anon_cc_size called\n"); - error=0; spin_lock(&swap_lock); --- 1404,1407 ---- *************** *** 1431,1435 **** p->inuse_pages = 0; p->max = maxpages; ! p->pages = maxpages - 1; // -------------- p->cluster_next = 1; p->prio = 100; --- 1429,1433 ---- p->inuse_pages = 0; p->max = maxpages; ! p->pages = maxpages - 1; p->cluster_next = 1; p->prio = 100; *************** *** 1437,1441 **** spin_unlock(&swap_lock); - /* initialize swap map */ if (!(p->swap_map = vmalloc(maxpages * sizeof(short)))) { --- 1435,1438 ---- *************** *** 1459,1468 **** p->curr_swap_extent = new_se; - mutex_lock(&swapon_mutex); spin_lock(&swap_lock); p->flags = SWP_ACTIVE | SWP_COMPRESSED; ! nr_swap_pages += maxpages - 1; // -------------- ! total_swap_pages += maxpages - 1; // ------------------ /* insert swap space into swap_list */ --- 1456,1464 ---- p->curr_swap_extent = new_se; mutex_lock(&swapon_mutex); spin_lock(&swap_lock); p->flags = SWP_ACTIVE | SWP_COMPRESSED; ! nr_swap_pages += maxpages - 1; ! total_swap_pages += maxpages - 1; /* insert swap space into swap_list */ *************** *** 1486,1490 **** out: ! pr_info("Error initializing anon compressed swap.\n"); return error; } --- 1482,1486 ---- out: ! printk(KERN_WARNING "Error initializing anon compressed swap.\n"); return error; } |
From: Nitin G. <nit...@us...> - 2006-06-15 10:24:11
|
Update of /cvsroot/linuxcompressed/linux26/include/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24075/include/linux Modified Files: ccache.h Added Files: sysctl.h Log Message: vswap now doesnt crash. No de/compression. Interfaces now via sysctl so cc_control module not reqd now. --- NEW FILE --- /* * sysctl.h: General linux system control interface * * Begun 24 March 1995, Stephen Tweedie * **************************************************************** **************************************************************** ** ** The values in this file are exported to user space via ** the sysctl() binary interface. However this interface ** is unstable and deprecated and will be removed in the future. ** For a stable interface use /proc/sys. ** **************************************************************** **************************************************************** */ #ifndef _LINUX_SYSCTL_H #define _LINUX_SYSCTL_H [...979 lines suppressed...] /* struct ctl_table_header is used to maintain dynamic lists of ctl_table trees. */ struct ctl_table_header { ctl_table *ctl_table; struct list_head ctl_entry; int used; struct completion *unregistering; }; struct ctl_table_header * register_sysctl_table(ctl_table * table, int insert_at_head); void unregister_sysctl_table(struct ctl_table_header * table); #else /* __KERNEL__ */ #endif /* __KERNEL__ */ #endif /* _LINUX_SYSCTL_H */ Index: ccache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/include/linux/ccache.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ccache.h 11 Jun 2006 20:03:48 -0000 1.5 --- ccache.h 15 Jun 2006 10:24:06 -0000 1.6 *************** *** 5,8 **** --- 5,31 ---- #include <linux/page-flags.h> #include <linux/swap.h> + #include <linux/sysctl.h> + + /* + * limiting size for anon pages: 512MB (arbitrary) + * (units of pages: 4k) + */ + #define LIMIT_ANON_CC_SIZE 512*256 + + #define MAX_SWAP_OFFSET_SHIFT 24 + #define MAX_SWAP_OFFSET (1 << MAX_SWAP_OFFSET_SHIFT) + + extern unsigned long max_anon_cc_size, max_fs_backed_cc_size; + + /* + * max _uncompressed_ size for ccache + * (units of pages: 4k) + * + * For anon pages, ccache size is limited by 'offset' field (24 bits) + * of swp_entry_t (swapped out page identifier). + * For page cache pages, this limit is artificial but should never + * hurt (1<<24 pages == 64GB!). + */ + extern const unsigned long ccache_size_limit; struct chunk_head { *************** *** 26,29 **** --- 49,54 ---- extern int set_anon_cc_size(unsigned long size); extern int should_add_to_ccache(struct page *page); + extern int sysctl_max_anon_cc_size(ctl_table *table, int write, + struct file *file, void __user *buffer, size_t *length, loff_t *ppos); #endif |
From: Nitin G. <nit...@us...> - 2006-06-15 10:24:11
|
Update of /cvsroot/linuxcompressed/linux26/kernel In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv24075/kernel Added Files: sysctl.c Log Message: vswap now doesnt crash. No de/compression. Interfaces now via sysctl so cc_control module not reqd now. --- NEW FILE --- /* * sysctl.c: General linux system control interface * * Begun 24 March 1995, Stephen Tweedie * Added /proc support, Dec 1995 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas. * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver. * Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver. * Dynamic registration fixes, Stephen Tweedie. * Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn. * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris * Horn. * Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer. * Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer. * Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill * Wendling. * The list_for_each() macro wasn't appropriate for the sysctl loop. * Removed it and replaced it with older style, 03/23/00, Bill Wendling */ [...2502 lines suppressed...] #endif /* CONFIG_SYSCTL */ /* * No sense putting this after each symbol definition, twice, * exception granted :-) */ EXPORT_SYMBOL(proc_dointvec); EXPORT_SYMBOL(proc_dointvec_jiffies); EXPORT_SYMBOL(proc_dointvec_minmax); EXPORT_SYMBOL(proc_dointvec_userhz_jiffies); EXPORT_SYMBOL(proc_dointvec_ms_jiffies); EXPORT_SYMBOL(proc_dostring); EXPORT_SYMBOL(proc_doulongvec_minmax); EXPORT_SYMBOL(proc_doulongvec_ms_jiffies_minmax); EXPORT_SYMBOL(register_sysctl_table); EXPORT_SYMBOL(sysctl_intvec); EXPORT_SYMBOL(sysctl_jiffies); EXPORT_SYMBOL(sysctl_ms_jiffies); EXPORT_SYMBOL(sysctl_string); EXPORT_SYMBOL(unregister_sysctl_table); |
From: Nitin G. <nit...@us...> - 2006-06-15 10:20:20
|
Update of /cvsroot/linuxcompressed/linux26/kernel In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22008/kernel Log Message: Directory /cvsroot/linuxcompressed/linux26/kernel added to the repository |
From: Nitin G. <nit...@us...> - 2006-06-14 16:23:31
|
Update of /cvsroot/linuxcompressed/linux26/lib/WK4x4 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7000/lib/WK4x4 Modified Files: WK4x4.h Log Message: corrected WK4x4 problem Index: WK4x4.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/lib/WK4x4/WK4x4.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** WK4x4.h 9 Jun 2006 16:16:20 -0000 1.1 --- WK4x4.h 14 Jun 2006 16:23:20 -0000 1.2 *************** *** 1,5 **** /* WK4x4-v0.2 -- Wilson-Kaplan-4x4 version 0.2 ! Compresses buffers using a dictionary based match and partial match scheme. --- 1,5 ---- /* WK4x4-v0.2 -- Wilson-Kaplan-4x4 version 0.2 ! Compresses buffers using a dictionary based match and partial match [...1039 lines suppressed...] ! ! /* Return the number of bytes used to store the compressed ! region. */ ! //return ((unsigned int)ceil((double)bitsUsedForEncoding / ! // (double)BITS_PER_WORD)) * ! // BYTES_PER_WORD; ! return (unsigned int)((bitsUsedForEncoding/BITS_PER_WORD + ! !!(bitsUsedForEncoding & BITS_PER_WORD_MASK))*BYTES_PER_WORD); } --- 83,91 ---- unsigned int words, unsigned int* exactMatchCountArray, ! unsigned int* partialMatchCountArray); ! #if defined (__cplusplus) } + #endif /* __cplusplus */ + + #endif /* _WK4x4_H */ |
From: Nitin G. <nit...@us...> - 2006-06-11 20:03:58
|
Update of /cvsroot/linuxcompressed/linux26/include/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27793/include/linux Added Files: ccache.h Removed Files: cc.h Log Message: anon page work moves fwd :) --- cc.h DELETED --- |
From: Nitin G. <nit...@us...> - 2006-06-11 20:03:53
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv27793/mm Modified Files: swapfile.c Added Files: vmscan.c Log Message: anon page work moves fwd :) Index: swapfile.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/swapfile.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** swapfile.c 3 Jun 2006 14:05:28 -0000 1.3 --- swapfile.c 11 Jun 2006 20:03:48 -0000 1.4 *************** *** 91,94 **** --- 91,95 ---- int latency_ration = LATENCY_LIMIT; + pr_info("** start scan_swap_map **\n"); /* * We try to cluster swap pages by allocating them sequentially *************** *** 151,154 **** --- 152,156 ---- si->cluster_next = offset + 1; si->flags -= SWP_SCANNING; + pr_info("** scan_map: return in mid **\n"); return offset; } *************** *** 170,173 **** --- 172,176 ---- no_page: si->flags -= SWP_SCANNING; + pr_info("** end scan_swap_map **\n"); return 0; } *************** *** 193,197 **** wrapped++; } ! if (!si->highest_bit) continue; --- 196,202 ---- wrapped++; } ! ! pr_info("get_swap_page loop\n"); ! if (!si->highest_bit) continue; *************** *** 1332,1335 **** --- 1337,1345 ---- seq_puts(swap, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n"); + if (ptr->flags & SWP_COMPRESSED) { + pr_info("virt swap to be printed\n"); + return 0; + } + file = ptr->swap_file; len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\"); *************** *** 1375,1378 **** --- 1385,1398 ---- #endif /* CONFIG_PROC_FS */ + int is_page_in_virt_swap(struct page *page) + { + swp_entry_t entry=(swp_entry_t) { page_private(page) }; + unsigned int type=swp_type(entry); + if (swap_info[type].flags & SWP_COMPRESSED) { + pr_info("This is virt swap\n"); + return 1; + } + return 0; + } int set_anon_cc_size(unsigned long num_pages) *************** *** 1384,1388 **** struct swap_extent *new_se; ! printk(KERN_INFO "set_anon_cc_size called\n"); error=0; --- 1404,1408 ---- struct swap_extent *new_se; ! pr_info("set_anon_cc_size called\n"); error=0; *************** *** 1392,1395 **** --- 1412,1422 ---- if (!(p->flags & SWP_USED)) break; + if (type > swp_type(pte_to_swp_entry(swp_entry_to_pte(swp_entry(~0UL,0))))) { + spin_unlock(&swap_lock); + goto out; + } + if (type >= nr_swapfiles) + nr_swapfiles = type+1; + maxpages = num_pages; *************** *** 1404,1408 **** p->inuse_pages = 0; p->max = maxpages; ! p->pages = maxpages; p->cluster_next = 1; p->prio = 100; --- 1431,1435 ---- p->inuse_pages = 0; p->max = maxpages; ! p->pages = maxpages - 1; // -------------- p->cluster_next = 1; p->prio = 100; *************** *** 1436,1441 **** spin_lock(&swap_lock); p->flags = SWP_ACTIVE | SWP_COMPRESSED; ! nr_swap_pages += maxpages; ! total_swap_pages += maxpages; /* insert swap space into swap_list */ --- 1463,1468 ---- spin_lock(&swap_lock); p->flags = SWP_ACTIVE | SWP_COMPRESSED; ! nr_swap_pages += maxpages - 1; // -------------- ! total_swap_pages += maxpages - 1; // ------------------ /* insert swap space into swap_list */ *************** *** 1459,1463 **** out: ! printk(KERN_INFO "Error initializing anon compressed swap.\n"); return error; } --- 1486,1490 ---- out: ! pr_info("Error initializing anon compressed swap.\n"); return error; } *************** *** 1655,1660 **** */ maxpages = swp_offset(pte_to_swp_entry(swp_entry_to_pte(swp_entry(0,~0UL)))) - 1; ! if (maxpages > swap_header->info.last_page) maxpages = swap_header->info.last_page; p->highest_bit = maxpages - 1; --- 1682,1689 ---- */ maxpages = swp_offset(pte_to_swp_entry(swp_entry_to_pte(swp_entry(0,~0UL)))) - 1; ! if (maxpages > swap_header->info.last_page) { maxpages = swap_header->info.last_page; + pr_info("in sys_swapon swap_header->info.last_page: %lu\n", maxpages); + } p->highest_bit = maxpages - 1; *************** *** 1715,1718 **** --- 1744,1748 ---- spin_lock(&swap_lock); p->flags = SWP_ACTIVE; + pr_info("in sys_swapon: nr_good_pages: %u\n", nr_good_pages); nr_swap_pages += nr_good_pages; total_swap_pages += nr_good_pages; *************** *** 1809,1812 **** --- 1839,1847 ---- offset = swp_offset(entry); + pr_info("swp_dup: offset: %lu\n", offset); + pr_info("swp_dup: p->max: %u\n", p->max); + if (offset < p->max) pr_info("swp_dup: p->swap_map[offset]: %d\n", p->swap_map[offset]); + + spin_lock(&swap_lock); if (offset < p->max && p->swap_map[offset]) { |
From: Nitin G. <nit...@us...> - 2006-06-09 16:15:28
|
Update of /cvsroot/linuxcompressed/linux26/lib/WK4x4 In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14192/WK4x4 Log Message: Directory /cvsroot/linuxcompressed/linux26/lib/WK4x4 added to the repository |
From: Nitin G. <nit...@us...> - 2006-06-09 16:14:57
|
Update of /cvsroot/linuxcompressed/linux26/lib/WKdm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv13755/lib/WKdm Modified Files: WKdm.c WKdm.h Log Message: all three algos: WKdm, WK4x4, LZO ready Index: WKdm.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/lib/WKdm/WKdm.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** WKdm.c 9 Jun 2006 01:44:10 -0000 1.1 --- WKdm.c 9 Jun 2006 16:14:55 -0000 1.2 *************** *** 110,114 **** /* A structure to store each element of the dictionary. */ ! typedef WK_word DictionaryElement; /* ============================================================ */ --- 110,114 ---- /* A structure to store each element of the dictionary. */ ! //typedef WK_word DictionaryElement; /* ============================================================ */ Index: WKdm.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/lib/WKdm/WKdm.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** WKdm.h 9 Jun 2006 01:44:10 -0000 1.1 --- WKdm.h 9 Jun 2006 16:14:55 -0000 1.2 *************** *** 17,20 **** --- 17,23 ---- /* Types and Constants */ + #if !defined(_WK_common_H) + #define _WK_common_H + /* A manipulable type that is the machine word size. */ typedef unsigned int WK_word; *************** *** 23,26 **** --- 26,33 ---- #define DICTIONARY_SIZE 16 + typedef WK_word DictionaryElement; + + #endif /* _WK_common_H */ + /* ============================================================ */ /* Interface */ |
From: Nitin G. <nit...@us...> - 2006-06-09 01:44:14
|
Update of /cvsroot/linuxcompressed/linux26/lib/WKdm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv814/lib/WKdm Added Files: WKdm.c WKdm.h Log Message: add LZO and WKdm --- NEW FILE --- /* direct-mapped partial matching compressor with simple 22/10 split * * Compresses buffers using a dictionary based match and partial match * (high bits only or full match) scheme. * * Paul Wilson -- wi...@cs... * Scott F. Kaplan -- sfk...@cs... * September 1997 * * Modified to make it work in kernel mode by Nitin Gupta * (as part of Red Hat LoC'05 program) * -- Reduce memory footprint from about 7K in original to just 4K now * -- Reduced kernel stack usage to just few works (original several KBs) * -- Eliminated dependencies on user-space libraries * -- Removed all floating point operation with their (functionally * equivalent) integer operations. */ /* compressed output format, in memory order * 1. a four-word HEADER containing four one-word values: * i. a one-word code saying what algorithm compressed the data * ii. an integer WORD offset into the page saying * where the queue position area starts * iii. an integer WORD offset into the page saying where * the low-bits area starts * iv. an integer WORD offset into the page saying where the * low-bits area ends * * 2. a 64-word TAGS AREA holding one two-bit tag for each word in * the original (1024-word) page, packed 16 per word * * 3. a variable-sized FULL WORDS AREA (always word aligned and an * integral number of words) holding full-word patterns that * were not in the dictionary when encoded (i.e., dictionary misses) * * 4. a variable-sized QUEUE POSITIONS AREA (always word aligned and * an integral number of words) holding four-bit queue positions, * packed eight per word. * * 5. a variable-sized LOW BITS AREA (always word aligned and an * integral number of words) holding ten-bit low-bit patterns * (from partial matches), packed three per word. */ /* ============================================================ */ /* Included files */ /* #include <stdio.h> #include <unistd.h> #include <math.h> #include <strings.h> */ // kern includes------------- #include <linux/module.h> #include <linux/kernel.h> #include <linux/proc_fs.h> #include <linux/string.h> #include <linux/mm.h> #include <asm/uaccess.h> // ------------------------------- #include "WKdm.h" /* at the moment we have dependencies on the page size. That should * be changed to work for any power-of-two size that's at least 16 * words, or something like that */ #define PAGE_SIZE_IN_WORDS 1024 #define PAGE_SIZE_IN_BYTES 4096 #define DICTIONARY_SIZE 16 /* * macros defining the basic layout of stuff in a page */ #define HEADER_SIZE_IN_WORDS 4 #define TAGS_AREA_OFFSET 4 #define TAGS_AREA_SIZE 64 /* the next few are used during compression to write the header */ #define SET_QPOS_AREA_START(compr_dest_buf,qpos_start_addr) \ (compr_dest_buf[1] = qpos_start_addr - compr_dest_buf) #define SET_LOW_BITS_AREA_START(compr_dest_buf,lb_start_addr) \ (compr_dest_buf[2] = lb_start_addr - compr_dest_buf) #define SET_LOW_BITS_AREA_END(compr_dest_buf,lb_end_addr) \ (compr_dest_buf[3] = lb_end_addr - compr_dest_buf) /* the next few are only use during decompression to read the header */ #define TAGS_AREA_START(decomp_src_buf) \ (decomp_src_buf + TAGS_AREA_OFFSET) #define TAGS_AREA_END(decomp_src_buf) \ (TAGS_AREA_START(decomp_src_buf) + TAGS_AREA_SIZE) #define FULL_WORD_AREA_START(the_buf) TAGS_AREA_END(the_buf) #define QPOS_AREA_START(decomp_src_buf) \ (decomp_src_buf + decomp_src_buf[1]) #define LOW_BITS_AREA_START(decomp_src_buf) \ (decomp_src_buf + (decomp_src_buf[2])) #define QPOS_AREA_END(the_buf) LOW_BITS_AREA_START(the_buf) #define LOW_BITS_AREA_END(decomp_src_buf) \ (decomp_src_buf + (decomp_src_buf[3])) /* ============================================================ */ /* Types and structures */ /* A structure to store each element of the dictionary. */ typedef WK_word DictionaryElement; /* ============================================================ */ /* Misc constants */ #define BITS_PER_WORD 32 #define BYTES_PER_WORD 4 #define NUM_LOW_BITS 10 #define LOW_BITS_MASK 0x3FF #define ALL_ONES_MASK 0xFFFFFFFF #define TWO_BITS_PACKING_MASK 0x03030303 #define FOUR_BITS_PACKING_MASK 0x0F0F0F0F #define TEN_LOW_BITS_MASK 0x000003FF #define TWENTY_TWO_HIGH_BITS_MASK 0xFFFFFC00 /* Tag values. NOTE THAT CODE MAY DEPEND ON THE NUMBERS USED. * Check for conditionals doing arithmetic on these things * before changing them */ #define ZERO_TAG 0x0 #define PARTIAL_TAG 0x1 #define MISS_TAG 0x2 #define EXACT_TAG 0x3 #define BITS_PER_BYTE 8 /* ============================================================ */ /* Global macros */ /* Shift out the low bits of a pattern to give the high bits pattern. The stripped patterns are used for initial tests of partial matches. */ #define HIGH_BITS(word_pattern) (word_pattern >> NUM_LOW_BITS) /* String the high bits of a pattern so the low order bits can be included in an encoding of a partial match. */ #define LOW_BITS(word_pattern) (word_pattern & LOW_BITS_MASK) #if defined DEBUG_WK #define DEBUG_PRINT_1(string) printk (string) #define DEBUG_PRINT_2(string,value) printk(string, value) #else #define DEBUG_PRINT_1(string) #define DEBUG_PRINT_2(string, value) #endif /* Set up the dictionary before performing compression or decompression. Each element is loaded with some value, the high-bits version of that value, and a next pointer. */ #define PRELOAD_DICTIONARY { \ dictionary[0] = 1; \ dictionary[1] = 1; \ dictionary[2] = 1; \ dictionary[3] = 1; \ dictionary[4] = 1; \ dictionary[5] = 1; \ dictionary[6] = 1; \ dictionary[7] = 1; \ dictionary[8] = 1; \ dictionary[9] = 1; \ dictionary[10] = 1; \ dictionary[11] = 1; \ dictionary[12] = 1; \ dictionary[13] = 1; \ dictionary[14] = 1; \ dictionary[15] = 1; \ } /* these are the constants for the hash function lookup table. * Only zero maps to zero. The rest of the tabale is the result * of appending 17 randomizations of the multiples of 4 from * 4 to 56. Generated by a Scheme script in hash.scm. */ #define HASH_LOOKUP_TABLE_CONTENTS { \ 0, 52, 8, 56, 16, 12, 28, 20, 4, 36, 48, 24, 44, 40, 32, 60, \ 8, 12, 28, 20, 4, 60, 16, 36, 24, 48, 44, 32, 52, 56, 40, 12, \ 8, 48, 16, 52, 60, 28, 56, 32, 20, 24, 36, 40, 44, 4, 8, 40, \ 60, 32, 20, 44, 4, 36, 52, 24, 16, 56, 48, 12, 28, 16, 8, 40, \ 36, 28, 32, 12, 4, 44, 52, 20, 24, 48, 60, 56, 40, 48, 8, 32, \ 28, 36, 4, 44, 20, 56, 60, 24, 52, 16, 12, 12, 4, 48, 20, 8, \ 52, 16, 60, 24, 36, 44, 28, 56, 40, 32, 36, 20, 24, 60, 40, 44, \ 52, 16, 32, 4, 48, 8, 28, 56, 12, 28, 32, 40, 52, 36, 16, 20, \ 48, 8, 4, 60, 24, 56, 44, 12, 8, 36, 24, 28, 16, 60, 20, 56, \ 32, 40, 48, 12, 4, 44, 52, 44, 40, 12, 56, 8, 36, 24, 60, 28, \ 48, 4, 32, 20, 16, 52, 60, 12, 24, 36, 8, 4, 16, 56, 48, 44, \ 40, 52, 32, 20, 28, 32, 12, 36, 28, 24, 56, 40, 16, 52, 44, 4, \ 20, 60, 8, 48, 48, 52, 12, 20, 32, 44, 36, 28, 4, 40, 24, 8, \ 56, 60, 16, 36, 32, 8, 40, 4, 52, 24, 44, 20, 12, 28, 48, 56, \ 16, 60, 4, 52, 60, 48, 20, 16, 56, 44, 24, 8, 40, 12, 32, 28, \ 36, 24, 32, 12, 4, 20, 16, 60, 36, 28, 8, 52, 40, 48, 44, 56 \ } #define HASH_TO_DICT_BYTE_OFFSET(pattern) \ (hashLookupTable[((pattern) >> 10) & 0xFF]) /* EMIT... macros emit bytes or words into the intermediate arrays */ #define EMIT_BYTE(fill_ptr, byte_value) {*fill_ptr = byte_value; fill_ptr++;} #define EMIT_WORD(fill_ptr,word_value) {*fill_ptr = word_value; fill_ptr++;} /* RECORD... macros record the results of modeling in the intermediate * arrays */ #define RECORD_ZERO { EMIT_BYTE(next_tag,ZERO_TAG); } #define RECORD_EXACT(queue_posn) EMIT_BYTE(next_tag,EXACT_TAG); \ EMIT_BYTE(next_qp,(queue_posn)); #define RECORD_PARTIAL(queue_posn,low_bits_pattern) { \ EMIT_BYTE(next_tag,PARTIAL_TAG); \ EMIT_BYTE(next_qp,(queue_posn)); \ EMIT_WORD(next_low_bits,(low_bits_pattern)) } #define RECORD_MISS(word_pattern) EMIT_BYTE(next_tag,MISS_TAG); \ EMIT_WORD(next_full_patt,(word_pattern)); unsigned int hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS; /*********************************************************************** * THE PACKING ROUTINES */ /* WK_pack_2bits() * Pack some multiple of four words holding two-bit tags (in the low * two bits of each byte) into an integral number of words, i.e., * one fourth as many. * NOTE: Pad the input out with zeroes to a multiple of four words! */ WK_word* WK_pack_2bits(WK_word* source_buf, WK_word* source_end, WK_word* dest_buf) { register WK_word* src_next = source_buf; WK_word* dest_next = dest_buf; while (src_next < source_end) { register WK_word temp = src_next[0]; temp |= (src_next[1] << 2); temp |= (src_next[2] << 4); temp |= (src_next[3] << 6); dest_next[0] = temp; dest_next++; src_next += 4; } return dest_next; } /* WK_pack_4bits() * Pack an even number of words holding 4-bit patterns in the low bits * of each byte into half as many words. * note: pad out the input with zeroes to an even number of words! */ WK_word* WK_pack_4bits(WK_word* source_buf, WK_word* source_end, WK_word* dest_buf) { register WK_word* src_next = source_buf; WK_word* dest_next = dest_buf; /* this loop should probably be unrolled */ while (src_next < source_end) { register WK_word temp = src_next[0]; temp |= (src_next[1] << 4); dest_next[0] = temp; dest_next++; src_next += 2; } return dest_next; } /* pack_3_tenbits() * Pack a sequence of three ten bit items into one word. * note: pad out the input with zeroes to an even number of words! */ // WK_word* // WK_pack_3_tenbits(WK_word* source_buf, // WK_word* source_end, // WK_word* dest_buf) { WK_word* WK_pack_3_tenbits(unsigned short* source_buf, unsigned short* source_end, WK_word* dest_buf) { //register WK_word* src_next = source_buf; register unsigned short* src_next = source_buf; WK_word* dest_next = dest_buf; /* this loop should probably be unrolled */ /* while (src_next < source_end) { register WK_word temp = src_next[0]; temp |= (src_next[1] << 10); temp |= (src_next[2] << 20); */ while (src_next < source_end) { register WK_word temp = src_next[2]; temp = (temp << 10) | src_next[1]; temp = (temp << 10) | src_next[0]; dest_next[0] = temp; dest_next++; src_next += 3; } return dest_next; } /*************************************************************************** * THE UNPACKING ROUTINES should GO HERE */ #define GET_NEXT_TAG tags[tagsIndex++] #define GET_NEXT_FULL_PATTERN fullPatterns[fullPatternsIndex++] #define GET_NEXT_LOW_BITS lowBits[lowBitsIndex++] #define GET_NEXT_DICTIONARY_INDEX dictionaryIndices[dictionaryIndicesIndex++] /* WK_unpack_2bits takes any number of words containing 16 two-bit values * and unpacks them into four times as many words containg those * two bit values as bytes (with the low two bits of each byte holding * the actual value. */ WK_word* WK_unpack_2bits(WK_word *input_buf, WK_word *input_end, WK_word *output_buf) { register WK_word *input_next = input_buf; register WK_word *output_next = output_buf; register WK_word packing_mask = TWO_BITS_PACKING_MASK; /* loop to repeatedly grab one input word and unpack it into * 4 output words. This loop could be unrolled a little---it's * designed to be easy to do that. */ while (input_next < input_end) { register WK_word temp = input_next[0]; DEBUG_PRINT_2("Unpacked tags word: %.8x\n", temp); output_next[0] = temp & packing_mask; output_next[1] = (temp >> 2) & packing_mask; output_next[2] = (temp >> 4) & packing_mask; output_next[3] = (temp >> 6) & packing_mask; output_next += 4; input_next++; } return output_next; } /* unpack four bits consumes any number of words (between input_buf * and input_end) holding 8 4-bit values per word, and unpacks them * into twice as many words, with each value in a separate byte. * (The four-bit values occupy the low halves of the bytes in the * result). */ WK_word* WK_unpack_4bits(WK_word *input_buf, WK_word *input_end, WK_word *output_buf) { register WK_word *input_next = input_buf; register WK_word *output_next = output_buf; register WK_word packing_mask = FOUR_BITS_PACKING_MASK; /* loop to repeatedly grab one input word and unpack it into * 4 output words. This loop should probably be unrolled * a little---it's designed to be easy to do that. */ while (input_next < input_end) { register WK_word temp = input_next[0]; DEBUG_PRINT_2("Unpacked dictionary indices word: %.8x\n", temp); output_next[0] = temp & packing_mask; output_next[1] = (temp >> 4) & packing_mask; output_next += 2; input_next++; } return output_next; } /* unpack_3_tenbits unpacks three 10-bit items from (the low 30 bits of) * a 32-bit word */ // WK_word* // WK_unpack_3_tenbits(WK_word *input_buf, // WK_word *input_end, // WK_word *output_buf) { unsigned short* WK_unpack_3_tenbits(WK_word *input_buf, WK_word *input_end, unsigned short *output_buf) { register WK_word *input_next = input_buf; register unsigned short *output_next = output_buf; register WK_word packing_mask = LOW_BITS_MASK; /* loop to fetch words of input, splitting each into three * words of output with 10 meaningful low bits. This loop * probably ought to be unrolled and maybe coiled */ while (input_next < input_end) { register WK_word temp = input_next[0]; output_next[0] = temp & packing_mask; output_next[1] = (temp >> 10) & packing_mask; output_next[2] = temp >> 20; input_next++; output_next += 3; } return output_next; } /*************************************************************************** * WKdm_compress()---THE COMPRESSOR */ unsigned int WKdm_compress (WK_word* src_buf, WK_word* dest_buf, unsigned int num_input_words) { static DictionaryElement dictionary[DICTIONARY_SIZE]; //DictionaryElement dictionary[DICTIONARY_SIZE]; //char hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS; /* arrays that hold output data in intermediate form during modeling */ /* and whose contents are packed into the actual output after modeling */ /* sizes of these arrays should be increased if you want to compress * pages larger than 4KB */ //WK_word tempTagsArray[300]; /* tags for everything */ //WK_word tempQPosArray[300]; /* queue positions for matches */ //WK_word tempLowBitsArray[1200]; /* low bits for partial matches */ /* is kmalloc+kfree call thrice per compress() call too much overhead? */ // WK_word *tempTagsArray = kmalloc(sizeof(WK_word)*300, GFP_KERNEL); // WK_word *tempQPosArray = kmalloc(sizeof(WK_word)*300, GFP_KERNEL); // /* WK_word *tempLowBitsArray = kmalloc(sizeof(WK_word)*1200, GFP_KERNEL); */ // unsigned short *tempLowBitsArray = kmalloc(sizeof(unsigned short)*1200, GFP_KERNEL); static WK_word tempTagsArray[300]; static WK_word tempQPosArray[300]; /* WK_word *tempLowBitsArray = kmalloc(sizeof(WK_word)*1200, GFP_KERNEL); */ static unsigned short tempLowBitsArray[1200]; /* boundary_tmp will be used for keeping track of what's where in * the compressed page during packing */ WK_word* boundary_tmp; /* Fill pointers for filling intermediate arrays (of queue positions * and low bits) during encoding. * Full words go straight to the destination buffer area reserved * for them. (Right after where the tags go.) */ WK_word* next_full_patt; char* next_tag = (char *) tempTagsArray; char* next_qp = (char *) tempQPosArray; //WK_word* next_low_bits = tempLowBitsArray; unsigned short* next_low_bits = tempLowBitsArray; WK_word* next_input_word = src_buf; WK_word* end_of_input = src_buf + num_input_words; PRELOAD_DICTIONARY; next_full_patt = dest_buf + TAGS_AREA_OFFSET + (num_input_words / 16); while (next_input_word < end_of_input) { WK_word *dict_location; WK_word dict_word; WK_word input_word = *next_input_word; /* compute hash value, which is a byte offset into the dictionary, * and add it to the base address of the dictionary. Cast back and * forth to/from char * so no shifts are needed */ dict_location = (WK_word *) (((char*) dictionary) + HASH_TO_DICT_BYTE_OFFSET(input_word)); dict_word = *dict_location; if (input_word == dict_word) { RECORD_EXACT(dict_location - dictionary); //printk("EXACT\n"); } else if (input_word == 0) { //printk("ZERO\n"); RECORD_ZERO; } else { WK_word input_high_bits = HIGH_BITS(input_word); if (input_high_bits == HIGH_BITS(dict_word)) { RECORD_PARTIAL(dict_location - dictionary, LOW_BITS(input_word)); //printk("PARTIAL\n"); *dict_location = input_word; } else { RECORD_MISS(input_word); //printk("MISS\n"); *dict_location = input_word; } } next_input_word++; } /* Record (into the header) where we stopped writing full words, * which is where we will pack the queue positions. (Recall * that we wrote the full words directly into the dest buffer * during modeling. */ SET_QPOS_AREA_START(dest_buf,next_full_patt); /* Pack the tags into the tags area, between the page header * and the full words area. We don't pad for the packer * because we assume that the page size is a multiple of 16. */ boundary_tmp = WK_pack_2bits(tempTagsArray, (WK_word *) next_tag, dest_buf + HEADER_SIZE_IN_WORDS); /* Pack the queue positions into the area just after * the full words. We have to round up the source * region to a multiple of two words. */ { unsigned int num_bytes_to_pack = next_qp - (char *) tempQPosArray; //unsigned int num_packed_words = ceil((double) num_bytes_to_pack / 8); unsigned int num_packed_words = (num_bytes_to_pack>>3) + !!(num_bytes_to_pack & 7); unsigned int num_source_words = num_packed_words * 2; WK_word* endQPosArray = tempQPosArray + num_source_words; /* Pad out the array with zeros to avoid corrupting real packed values. */ for (; /* next_qp is already set as desired */ next_qp < (char*)endQPosArray; next_qp++) { *next_qp = 0; } boundary_tmp = WK_pack_4bits(tempQPosArray, endQPosArray, next_full_patt); /* Record (into the header) where we stopped packing queue positions, * which is where we will start packing low bits. */ SET_LOW_BITS_AREA_START(dest_buf,boundary_tmp); } /* Pack the low bit patterns into the area just after * the queue positions. We have to round up the source * region to a multiple of three words. */ { //WK_word* endLowBitsArray; unsigned short* endLowBitsArray; unsigned int num_tenbits_to_pack = next_low_bits - tempLowBitsArray; //unsigned int num_packed_words = ceil((double) num_tenbits_to_pack / 3); unsigned int num_packed_words = num_tenbits_to_pack / 3; //unsigned int num_source_words = num_packed_words * 3; unsigned int num_source_shorts = num_packed_words * 3; if (num_tenbits_to_pack!=num_source_shorts) { num_packed_words++; num_source_shorts=num_packed_words*3; } endLowBitsArray = tempLowBitsArray + num_source_shorts; /* Pad out the array with zeros to avoid corrupting real packed values. */ for (; /* next_low_bits is already set as desired */ next_low_bits < endLowBitsArray; next_low_bits++) { *next_low_bits = 0; } boundary_tmp = WK_pack_3_tenbits (tempLowBitsArray, endLowBitsArray, boundary_tmp); SET_LOW_BITS_AREA_END(dest_buf,boundary_tmp); } // check dict now /*{ int i; printk("==============================\n"); for (i=0; i<=15; i++) { printk("%d: %u\n", i, dictionary[i]); } printk("==============================\n"); }*/ //kfree(tempTagsArray); //kfree(tempQPosArray); //kfree(tempLowBitsArray); return ((char *) boundary_tmp - (char *) dest_buf); } /********************************************************************* * WKdm_decompress --- THE DECOMPRESSOR * Expects WORD pointers to the source and destination buffers * and a page size in words. The page size had better be 1024 unless * somebody finds the places that are dependent on the page size and * fixes them */ unsigned int WKdm_decompress (WK_word* src_buf, WK_word* dest_buf, unsigned int words) { static DictionaryElement dictionary[DICTIONARY_SIZE]; //DictionaryElement dictionary[DICTIONARY_SIZE]; //unsigned int hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS; /* arrays that hold output data in intermediate form during modeling */ /* and whose contents are packed into the actual output after modeling */ /* sizes of these arrays should be increased if you want to compress * pages larger than 4KB */ // WK_word tempTagsArray[300]; /* tags for everything */ // WK_word tempQPosArray[300]; /* queue positions for matches */ // WK_word tempLowBitsArray[1200]; /* low bits for partial matches */ // WK_word *tempTagsArray = kmalloc(sizeof(WK_word)*300, GFP_KERNEL); // WK_word *tempQPosArray = kmalloc(sizeof(WK_word)*300, GFP_KERNEL); // /*WK_word *tempLowBitsArray = kmalloc(sizeof(WK_word)*1200, GFP_KERNEL); */ // unsigned short *tempLowBitsArray = kmalloc(sizeof(unsigned short)*1200, GFP_KERNEL); static WK_word tempTagsArray[300]; static WK_word tempQPosArray[300]; /* WK_word *tempLowBitsArray = kmalloc(sizeof(WK_word)*1200, GFP_KERNEL); */ static unsigned short tempLowBitsArray[1200]; PRELOAD_DICTIONARY; WK_unpack_2bits(TAGS_AREA_START(src_buf), TAGS_AREA_END(src_buf), tempTagsArray); WK_unpack_4bits(QPOS_AREA_START(src_buf), QPOS_AREA_END(src_buf), tempQPosArray); WK_unpack_3_tenbits(LOW_BITS_AREA_START(src_buf), LOW_BITS_AREA_END(src_buf), tempLowBitsArray); { register char *next_tag = (char *) tempTagsArray; char *tags_area_end = ((char *) tempTagsArray) + PAGE_SIZE_IN_WORDS; char *next_q_pos = (char *) tempQPosArray; //WK_word *next_low_bits = tempLowBitsArray; unsigned short *next_low_bits = tempLowBitsArray; WK_word *next_full_word = FULL_WORD_AREA_START(src_buf); WK_word *next_output = dest_buf; /*{ int i; printk("D:==============================\n"); for (i=0; i<=15; i++) { printk("D:%d: %u\n", i, dictionary[i]); } printk("D:==============================\n"); }*/ /* this loop should probably be unrolled. Maybe we should unpack * as 4 bit values, giving two consecutive tags, and switch on * that 16 ways to decompress 2 words at a whack */ while (next_tag < tags_area_end) { char tag = next_tag[0]; switch(tag) { case ZERO_TAG: { //printk("D:ZERO\n"); *next_output = 0; break; } case EXACT_TAG: { WK_word *dict_location = dictionary + *(next_q_pos++); //printk("D:EXACT\n"); /* no need to replace dict. entry if matched exactly */ *next_output = *dict_location; break; } case PARTIAL_TAG: { WK_word *dict_location = dictionary + *(next_q_pos++); //printk("D:EXACT\n"); { WK_word temp = *dict_location; /* strip out low bits */ temp = ((temp >> NUM_LOW_BITS) << NUM_LOW_BITS); /* add in stored low bits from temp array */ temp = temp | *(next_low_bits++); *dict_location = temp; /* replace old value in dict. */ *next_output = temp; /* and echo it to output */ } break; } case MISS_TAG: { WK_word missed_word = *(next_full_word++); WK_word *dict_location = (WK_word *) (((char *) dictionary) + HASH_TO_DICT_BYTE_OFFSET(missed_word)); //printk("D:MISS\n"); *dict_location = missed_word; *next_output = missed_word; break; } } next_tag++; next_output++; } } //kfree(tempTagsArray); //kfree(tempQPosArray); //kfree(tempLowBitsArray); return 0; } --- NEW FILE --- /* WKdm-v0.1 -- Wilson-Kaplan-dm (direct-mapped) version 0.1 Compresses buffers using a dictionary based match and partial match scheme. Paul Wilson -- wi...@cs... Scott F. Kaplan -- sfk...@cs... September 1997 */ /* ============================================================ */ /* Preprocessor directives to avoid multiple inclusion */ #if !defined (_WKdm_H) #define _WKdm_H /* ============================================================ */ /* Types and Constants */ /* A manipulable type that is the machine word size. */ typedef unsigned int WK_word; #define PAGE_COMPRESS_WORDS_PER_PAGE 1024 #define DICTIONARY_SIZE 16 /* ============================================================ */ /* Interface */ /* If this header is being included into a C++ module, we need to be sure that the function names for this module don't suffer C++ name mangling. */ #if defined (__cplusplus) extern "C" { #endif /* __cplusplus */ /* Given pointers to source buffer (sourceBuffer) of uncompressed data and a destination buffer (destinationBuffer) into which compressed data can be placed, as well as the number of words in the source buffer (words), compress the contents of the source and place the results in the destination. Return the number of bytes placed into the destination. */ unsigned int WKdm_compress (WK_word* sourceBuffer, WK_word* destinationBuffer, unsigned int words); /* Given a pointer to a source buffer (sourceBuffer) of compressed data and a pointer to a destination buffer (destinationBuffer) into which uncompressed data can be placed, as well as the number of uncompressed words that will be written to the destination buffer (words), decompress the data into the destination buffer. */ unsigned int WKdm_decompress (WK_word* sourceBuffer, WK_word* destinationPage, unsigned int words); /* Given a pointer to a source buffer (sourceBuffer) of uncompressed data, the number of words stored in that buffer (words), and two arrays for counting the number of exact (exactMatchCountArray) and partial (partialMatchCountArray) matches at each LRU position, compress the source and record what types of hits (partial or exact) occurred at each queue position. Return the number of words that would be placed into a destination buffer (if there were one). */ unsigned int WKdm_measureCompress (WK_word* sourceBuffer, unsigned int words, unsigned int* exactMatchCountArray, unsigned int* partialMatchCountArray); #if defined (__cplusplus) } #endif /* __cplusplus */ #endif /* _WKdm_H */ |
From: Nitin G. <nit...@us...> - 2006-06-09 01:42:18
|
Update of /cvsroot/linuxcompressed/linux26/lib/WKdm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32335/WKdm Log Message: Directory /cvsroot/linuxcompressed/linux26/lib/WKdm added to the repository |
From: Nitin G. <nit...@us...> - 2006-06-09 01:42:05
|
Update of /cvsroot/linuxcompressed/linux26/lib/LZO In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31967/LZO Log Message: Directory /cvsroot/linuxcompressed/linux26/lib/LZO added to the repository |
From: Nitin G. <nit...@us...> - 2006-06-09 01:41:32
|
Update of /cvsroot/linuxcompressed/linux26/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31889/lib Log Message: Directory /cvsroot/linuxcompressed/linux26/lib added to the repository |
From: Nitin G. <nit...@us...> - 2006-06-03 14:05:45
|
Update of /cvsroot/linuxcompressed/linux26/include/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22401/include/linux Added Files: cc.h swap.h Log Message: getting started with anon page handling --- NEW FILE --- #ifndef _CCACHE_H #define _CCACHE_H int set_anon_cc_size(unsigned long size); #endif --- NEW FILE --- #ifndef _LINUX_SWAP_H #define _LINUX_SWAP_H #include <linux/config.h> #include <linux/spinlock.h> #include <linux/linkage.h> #include <linux/mmzone.h> #include <linux/list.h> #include <linux/sched.h> #include <asm/atomic.h> #include <asm/page.h> #define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */ #define SWAP_FLAG_PRIO_MASK 0x7fff #define SWAP_FLAG_PRIO_SHIFT 0 static inline int current_is_kswapd(void) { return current->flags & PF_KSWAPD; } /* * MAX_SWAPFILES defines the maximum number of swaptypes: things which can * be swapped to. The swap type and the offset into that swap type are * encoded into pte's and into pgoff_t's in the swapcache. Using five bits * for the type means that the maximum number of swapcache pages is 27 bits * on 32-bit-pgoff_t architectures. And that assumes that the architecture packs * the type/offset into the pte as 5/27 as well. */ #define MAX_SWAPFILES_SHIFT 5 #define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) /* * Magic header for a swap area. The first part of the union is * what the swap magic looks like for the old (limited to 128MB) * swap area format, the second part of the union adds - in the * old reserved area - some extra information. Note that the first * kilobyte is reserved for boot loader or disk label stuff... * * Having the magic at the end of the PAGE_SIZE makes detecting swap * areas somewhat tricky on machines that support multiple page sizes. * For 2.5 we'll probably want to move the magic to just beyond the * bootbits... */ union swap_header { struct { char reserved[PAGE_SIZE - 10]; char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */ } magic; struct { char bootbits[1024]; /* Space for disklabel etc. */ unsigned int version; unsigned int last_page; unsigned int nr_badpages; unsigned int padding[125]; unsigned int badpages[1]; } info; }; /* A swap entry has to fit into a "unsigned long", as * the entry is hidden in the "index" field of the * swapper address space. */ typedef struct { unsigned long val; } swp_entry_t; /* * current->reclaim_state points to one of these when a task is running * memory reclaim */ struct reclaim_state { unsigned long reclaimed_slab; }; #ifdef __KERNEL__ struct address_space; struct sysinfo; struct writeback_control; struct zone; /* * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of * disk blocks. A list of swap extents maps the entire swapfile. (Where the * term `swapfile' refers to either a blockdevice or an IS_REG file. Apart * from setup, they're handled identically. * * We always assume that blocks are of size PAGE_SIZE. */ struct swap_extent { struct list_head list; pgoff_t start_page; pgoff_t nr_pages; sector_t start_block; }; /* * Max bad pages in the new format.. */ #define __swapoffset(x) ((unsigned long)&((union swap_header *)0)->x) #define MAX_SWAP_BADPAGES \ ((__swapoffset(magic.magic) - __swapoffset(info.badpages)) / sizeof(int)) enum { SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), /* add others here before... */ SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ SWP_COMPRESSED = (1 << 10), /* it's compressed cache for anon pages */ }; #define SWAP_CLUSTER_MAX 32 #define SWAP_MAP_MAX 0x7fff #define SWAP_MAP_BAD 0x8000 /* * The in-memory structure used to track swap areas. */ struct swap_info_struct { unsigned int flags; int prio; /* swap priority */ struct file *swap_file; struct block_device *bdev; struct list_head extent_list; struct swap_extent *curr_swap_extent; unsigned old_block_size; unsigned short * swap_map; unsigned int lowest_bit; unsigned int highest_bit; unsigned int cluster_next; unsigned int cluster_nr; unsigned int pages; unsigned int max; unsigned int inuse_pages; int next; /* next entry on swap list */ }; struct swap_list_t { int head; /* head of priority-ordered swapfile list */ int next; /* swapfile to be used next */ }; /* Swap 50% full? Release swapcache more aggressively.. */ #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages) /* linux/mm/oom_kill.c */ extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); /* linux/mm/memory.c */ extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *); /* linux/mm/page_alloc.c */ extern unsigned long totalram_pages; extern unsigned long totalhigh_pages; extern unsigned long totalreserve_pages; extern long nr_swap_pages; extern unsigned int nr_free_pages(void); extern unsigned int nr_free_pages_pgdat(pg_data_t *pgdat); extern unsigned int nr_free_buffer_pages(void); extern unsigned int nr_free_pagecache_pages(void); /* linux/mm/swap.c */ extern void FASTCALL(lru_cache_add(struct page *)); extern void FASTCALL(lru_cache_add_active(struct page *)); extern void FASTCALL(activate_page(struct page *)); extern void FASTCALL(mark_page_accessed(struct page *)); extern void lru_add_drain(void); extern int lru_add_drain_all(void); extern int rotate_reclaimable_page(struct page *page); extern void swap_setup(void); /* linux/mm/vmscan.c */ extern unsigned long try_to_free_pages(struct zone **, gfp_t); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern int vm_swappiness; extern int remove_mapping(struct address_space *mapping, struct page *page); /* possible outcome of pageout() */ typedef enum { /* failed to write page out, page is locked */ PAGE_KEEP, /* move page to the active list, page is locked */ PAGE_ACTIVATE, /* page has been sent to the disk successfully, page is unlocked */ PAGE_SUCCESS, /* page is clean and locked */ PAGE_CLEAN, } pageout_t; extern pageout_t pageout(struct page *page, struct address_space *mapping); #ifdef CONFIG_NUMA extern int zone_reclaim_mode; extern int zone_reclaim_interval; extern int zone_reclaim(struct zone *, gfp_t, unsigned int); #else #define zone_reclaim_mode 0 static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order) { return 0; } #endif #ifdef CONFIG_MMU /* linux/mm/shmem.c */ extern int shmem_unuse(swp_entry_t entry, struct page *page); #endif /* CONFIG_MMU */ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); #ifdef CONFIG_SWAP /* linux/mm/page_io.c */ extern int swap_readpage(struct file *, struct page *); extern int swap_writepage(struct page *page, struct writeback_control *wbc); extern int rw_swap_page_sync(int, swp_entry_t, struct page *); /* linux/mm/swap_state.c */ extern struct address_space swapper_space; #define total_swapcache_pages swapper_space.nrpages extern void show_swap_cache_info(void); extern int add_to_swap(struct page *, gfp_t); extern void __delete_from_swap_cache(struct page *); extern void delete_from_swap_cache(struct page *); extern int move_to_swap_cache(struct page *, swp_entry_t); extern int move_from_swap_cache(struct page *, unsigned long, struct address_space *); extern void free_page_and_swap_cache(struct page *); extern void free_pages_and_swap_cache(struct page **, int); extern struct page * lookup_swap_cache(swp_entry_t); extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *vma, unsigned long addr); /* linux/mm/swapfile.c */ extern long total_swap_pages; extern unsigned int nr_swapfiles; extern void si_swapinfo(struct sysinfo *); extern swp_entry_t get_swap_page(void); extern swp_entry_t get_swap_page_of_type(int); extern int swap_duplicate(swp_entry_t); extern int valid_swaphandles(swp_entry_t, unsigned long *); extern void swap_free(swp_entry_t); extern void free_swap_and_cache(swp_entry_t); extern int swap_type_of(dev_t); extern unsigned int count_swap_pages(int, int); extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); extern struct swap_info_struct *get_swap_info_struct(unsigned); extern int can_share_swap_page(struct page *); extern int remove_exclusive_swap_page(struct page *); struct backing_dev_info; extern spinlock_t swap_lock; extern int remove_vma_swap(struct vm_area_struct *vma, struct page *page); /* linux/mm/thrash.c */ extern struct mm_struct * swap_token_mm; extern unsigned long swap_token_default_timeout; extern void grab_swap_token(void); extern void __put_swap_token(struct mm_struct *); static inline int has_swap_token(struct mm_struct *mm) { return (mm == swap_token_mm); } static inline void put_swap_token(struct mm_struct *mm) { if (has_swap_token(mm)) __put_swap_token(mm); } static inline void disable_swap_token(void) { put_swap_token(swap_token_mm); } #else /* CONFIG_SWAP */ #define total_swap_pages 0 #define total_swapcache_pages 0UL #define si_swapinfo(val) \ do { (val)->freeswap = (val)->totalswap = 0; } while (0) /* only sparc can not include linux/pagemap.h in this file * so leave page_cache_release and release_pages undeclared... */ #define free_page_and_swap_cache(page) \ page_cache_release(page) #define free_pages_and_swap_cache(pages, nr) \ release_pages((pages), (nr), 0); #define show_swap_cache_info() /*NOTHING*/ #define free_swap_and_cache(swp) /*NOTHING*/ #define swap_duplicate(swp) /*NOTHING*/ #define swap_free(swp) /*NOTHING*/ #define read_swap_cache_async(swp,vma,addr) NULL #define lookup_swap_cache(swp) NULL #define valid_swaphandles(swp, off) 0 #define can_share_swap_page(p) (page_mapcount(p) == 1) #define move_to_swap_cache(p, swp) 1 #define move_from_swap_cache(p, i, m) 1 #define __delete_from_swap_cache(p) /*NOTHING*/ #define delete_from_swap_cache(p) /*NOTHING*/ #define swap_token_default_timeout 0 static inline int remove_exclusive_swap_page(struct page *p) { return 0; } static inline swp_entry_t get_swap_page(void) { swp_entry_t entry; entry.val = 0; return entry; } /* linux/mm/thrash.c */ #define put_swap_token(x) do { } while(0) #define grab_swap_token() do { } while(0) #define has_swap_token(x) 0 #define disable_swap_token() do { } while(0) #endif /* CONFIG_SWAP */ #endif /* __KERNEL__*/ #endif /* _LINUX_SWAP_H */ |
From: Nitin G. <nit...@us...> - 2006-06-03 14:05:31
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22401/mm Added Files: swapfile.c Log Message: getting started with anon page handling |
From: Nitin G. <nit...@us...> - 2006-06-03 14:03:24
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21601/mm Removed Files: filemap.c vmscan.c Log Message: getting started with anon page handling --- filemap.c DELETED --- --- vmscan.c DELETED --- |
From: Nitin G. <nit...@us...> - 2006-06-03 14:03:24
|
Update of /cvsroot/linuxcompressed/linux26/include/linux In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21601/include/linux Removed Files: page-flags.h Log Message: getting started with anon page handling --- page-flags.h DELETED --- |
From: Nitin G. <nit...@us...> - 2006-04-05 09:36:52
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8760/mm Modified Files: filemap.c vmscan.c Log Message: 2.6.16: better locking, stable Index: filemap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/filemap.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** filemap.c 25 Mar 2006 18:58:47 -0000 1.10 --- filemap.c 5 Apr 2006 09:36:39 -0000 1.11 *************** *** 30,33 **** --- 30,36 ---- #include <linux/security.h> #include <linux/syscalls.h> + + #include <linux/bit_spinlock.h> + #include "filemap.h" /* *************** *** 514,517 **** --- 517,534 ---- EXPORT_SYMBOL(__lock_page); + int chunk_head_wait(void *word) + { + schedule(); + return 0; + } + EXPORT_SYMBOL(chunk_head_wait); + + static inline void wait_on_chunk_head(struct page *ch) + { + might_sleep(); + wait_on_bit(&ch->flags, PG_locked, chunk_head_wait, TASK_UNINTERRUPTIBLE); + } + EXPORT_SYMBOL(wait_on_chunk_head); + /* * a rather lightweight function, finding and getting a reference to a *************** *** 523,541 **** struct page *ch; // chunk head ! //read_lock_irq(&mapping->tree_lock); ! write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { if (PageCompressed(page)) { printk("<1> ** Compressed page: %u in find_get_page **\n", offset); ch=page; ! page=(struct page *)page_private(ch); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); } - page_cache_get(page); } ! //read_unlock_irq(&mapping->tree_lock); ! write_unlock_irq(&mapping->tree_lock); return page; } --- 540,596 ---- struct page *ch; // chunk head ! read_lock_irq(&mapping->tree_lock); ! //write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { + page_cache_get(page); + read_unlock_irq(&mapping->tree_lock); if (PageCompressed(page)) { printk("<1> ** Compressed page: %u in find_get_page **\n", offset); ch=page; ! //if (!bit_spin_trylock(PG_locked, &ch->flags)) { ! if (TestSetPageLocked(ch)) { ! printk("<1> ** WAIT DEC page: %u mapping %p **\n", offset, mapping); ! wait_on_chunk_head(ch); ! //wait_on_bit(&ch->flags, PG_locked, chunk_head_wait, TASK_UNINTERRUPTIBLE); ! //bit_spin_lock(PG_locked, &ch->flags); ! printk("<1> ** WAIT OVER got page: %p\n", ch->mapping); ! page=(struct page*)(ch->mapping); ! //bit_spin_unlock(PG_locked, &ch->flags); ! page_cache_get(page); ! } else { ! if (ch->mapping!=NULL) { ! page=(struct page *)(ch->mapping); ! printk("<1> GOT Page: %u; mapping %p\n", offset, mapping); ! page_cache_get(page); ! wake_up_bit(&ch->flags, PG_locked); ! //bit_spin_unlock(PG_locked, &ch->flags); ! //unlock_page(ch); ! goto out; ! } ! printk("<1> DEC Page: %u; mapping %p\n", offset, mapping); ! // decompress() routine below ! ch->mapping=(struct address_space *)page_private(ch); ! //printk("<1> GIVEN mapping %p\n", ch->mapping); ! page=(struct page *)(ch->mapping); ! wake_up_bit(&ch->flags, PG_locked); ! ! //bit_spin_unlock(PG_locked, &ch->flags); ! //ClearPageLocked(ch); ! //unlock_page(ch); ! ! ! //page=(struct page *)page_private(ch); ! write_lock_irq(&mapping->tree_lock); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); ! page_cache_get(page); ! write_unlock_irq(&mapping->tree_lock); ! } } } ! out: ! if (!page) read_unlock_irq(&mapping->tree_lock); ! //write_unlock_irq(&mapping->tree_lock); return page; } Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/vmscan.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** vmscan.c 25 Mar 2006 18:58:47 -0000 1.10 --- vmscan.c 5 Apr 2006 09:36:39 -0000 1.11 *************** *** 325,329 **** if (PageDirty(page)) return 0; // PG_uptodate && PG_dirty possible? if (PageUptodate(page) && PageMappedToDisk(page)) return 1; ! printk("FLAGS %u\n", page->flags); return 0; } --- 325,329 ---- if (PageDirty(page)) return 0; // PG_uptodate && PG_dirty possible? if (PageUptodate(page) && PageMappedToDisk(page)) return 1; ! //printk("FLAGS %u\n", page->flags); return 0; } *************** *** 337,341 **** //struct chunk_head *ch; mapping=page_mapping(page); ! //printk ("<1> Add to CCache called: mapping=%p\n", mapping); if (!mapping) { printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); --- 337,341 ---- //struct chunk_head *ch; mapping=page_mapping(page); ! printk ("<1> ATC: M:%p\n", mapping); if (!mapping) { printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); *************** *** 366,369 **** --- 366,371 ---- ch = kmalloc(sizeof(struct page), GFP_KERNEL); if (!ch) goto out; + //printk("<1> CH Flags init: %u\n", ch->flags); + ch->flags=0; write_lock_irq(&mapping->tree_lock); *************** *** 375,380 **** SetPageCompressed(ch); ! ch->mapping=mapping; ! //ch->mapping=NULL; ch->index=page->index; --- 377,382 ---- SetPageCompressed(ch); ! //ch->mapping=mapping; ! ch->mapping=NULL; ch->index=page->index; |
From: Nitin G. <nit...@us...> - 2006-03-25 18:59:04
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9266/mm Modified Files: filemap.c vmscan.c Log Message: Ported to 2.6.16, bug fixes, stable Index: filemap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/filemap.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** filemap.c 23 Mar 2006 18:27:53 -0000 1.9 --- filemap.c 25 Mar 2006 18:58:47 -0000 1.10 *************** *** 132,141 **** } - static int chunk_head_wait(void *word) - { - schedule(); - return 0; - } - static int sync_page(void *word) { --- 132,135 ---- *************** *** 520,532 **** EXPORT_SYMBOL(__lock_page); - void fastcall __wait_unlock_chunk_head(struct page *page) - { - DEFINE_WAIT_BIT(wait, &page->flags, PG_locked); - - __wait_on_bit_lock(page_waitqueue(page), &wait, chunk_head_wait, - TASK_UNINTERRUPTIBLE); - } - EXPORT_SYMBOL(__wait_unlock_chunk_head); - /* * a rather lightweight function, finding and getting a reference to a --- 514,517 ---- *************** *** 536,599 **** { struct page *page; ! struct page *ch; //chunk head ! read_lock_irq(&mapping->tree_lock); ! //write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { - page_cache_get(page); - read_unlock_irq(&mapping->tree_lock); if (PageCompressed(page)) { - //if (offset==0) printk("<1> ## IDX: %u; mapping %p ##\n", page->index, mapping); printk("<1> ** Compressed page: %u in find_get_page **\n", offset); - // page is actually chunk head ch=page; ! if (TestSetPageLocked(ch)) { ! printk("<1> ** WAIT DEC page: %u in find_get_page; mapping %p **\n", offset, mapping); ! ! // it's currently being decompressed ! // wait until dec completes ! //__lock_page(ch); ! //__wait_unlock_chunk_head(ch); ! //while(PageLocked(ch)) { ! // schedule(); ! //} ! ! //page=(struct page *)ch->mapping; ! page=(struct page *)page_private(ch); ! page_cache_get(page); ! //unlock_page(ch); ! } else { ! /*if (ch->mapping!=NULL) { ! page=(struct page *)(ch->mapping); ! printk("<1> GOT Page: %u; mapping %p\n", offset, mapping); ! page_cache_get(page); ! ClearPageLocked(ch); ! //unlock_page(ch); ! goto out; ! }*/ ! ! printk("<1> DEC Page: %u; mapping %p\n", offset, mapping); ! // decompress() routine below ! //ch->mapping=(struct address_space *)page_private(ch); ! //printk("<1> GIVEN mapping %p\n", ch->mapping); ! ! //page=(struct page *)(ch->mapping); ! page=(struct page *)page_private(ch); ! write_lock_irq(&mapping->tree_lock); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); ! page_cache_get(page); ! write_unlock_irq(&mapping->tree_lock); ! ClearPageLocked(ch); ! //unlock_page(ch); ! } ! //kfree(ch); } } ! out: ! //BUG_ON(PageCompressed(page)); ! if (!page) read_unlock_irq(&mapping->tree_lock); ! //write_unlock_irq(&mapping->tree_lock); return page; } --- 521,541 ---- { struct page *page; ! struct page *ch; // chunk head ! //read_lock_irq(&mapping->tree_lock); ! write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { if (PageCompressed(page)) { printk("<1> ** Compressed page: %u in find_get_page **\n", offset); ch=page; ! page=(struct page *)page_private(ch); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); } + page_cache_get(page); } ! //read_unlock_irq(&mapping->tree_lock); ! write_unlock_irq(&mapping->tree_lock); return page; } *************** *** 633,641 **** { struct page *page; ! struct page *ch; // chunk head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); - repeat: page = radix_tree_lookup(&mapping->page_tree, offset); --- 575,582 ---- { struct page *page; ! struct page *ch; // chunk head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); repeat: page = radix_tree_lookup(&mapping->page_tree, offset); *************** *** 650,663 **** //kfree(ch); } - page_cache_get(page); if (TestSetPageLocked(page)) { //read_unlock_irq(&mapping->tree_lock); write_unlock_irq(&mapping->tree_lock); - __lock_page(page); //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); - /* Has the page been truncated while we slept? */ --- 591,601 ---- *************** *** 744,751 **** unsigned int i; unsigned int ret; ! struct page *ch; // chunk head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); ret = radix_tree_gang_lookup(&mapping->page_tree, (void **)pages, start, nr_pages); --- 682,690 ---- unsigned int i; unsigned int ret; ! struct page *ch; // chunk_head //read_lock_irq(&mapping->tree_lock); write_lock_irq(&mapping->tree_lock); + ret = radix_tree_gang_lookup(&mapping->page_tree, (void **)pages, start, nr_pages); *************** *** 759,763 **** radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); //kfree(ch); ! } page_cache_get(pages[i]); } --- 698,702 ---- radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); //kfree(ch); ! } page_cache_get(pages[i]); } Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/vmscan.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** vmscan.c 23 Mar 2006 18:27:53 -0000 1.9 --- vmscan.c 25 Mar 2006 18:58:47 -0000 1.10 *************** *** 308,320 **** static int should_add_to_ccache(struct page *page) { - /* - if (PagePrivate(page)) return 0; - if (PageSwapCache(page)) return 0; - if (PageDirty(page)) return 0; - */ //printk("<1>Some page to be added to ccache.\n"); ! // Only pass through clean page cache pages if (PageUptodate(page) && PageMappedToDisk(page)) return 1; return 0; } --- 308,329 ---- static int should_add_to_ccache(struct page *page) { //printk("<1>Some page to be added to ccache.\n"); ! /* ! * Only pass through clean page-cache pages ! * does the flags (Uptodate and Mappedtodisk) correctly ! * determine clean page cache pages? ! */ ! /* ! * Had certain pages having PG_uptodate && PG_mappedtodisk and ! * still have page->mapping==NULL ! */ ! /* some of these checks are probably redundant */ ! if (!page_mapping(page)) return 0; // i.e. either Anon or mapping=0 ! if (PageSwapCache(page)) return 0; ! if (PagePrivate(page)) return 0; // these are buffer heads ! if (PageDirty(page)) return 0; // PG_uptodate && PG_dirty possible? if (PageUptodate(page) && PageMappedToDisk(page)) return 1; + printk("FLAGS %u\n", page->flags); return 0; } *************** *** 323,339 **** { unsigned long flags; ! struct page *newpage; struct address_space *mapping; ! struct page *ch; // dummy struct page as 'chunk head' //struct chunk_head *ch; mapping=page_mapping(page); ! ! /* ! printk ("<1> Add to CCache called.\n"); ! printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); ! printk ("<1> orig page->mapcount=%d\n", atomic_read(&page->_mapcount)); ! printk ("<1> orig page->flags=%u\n", page->flags); ! printk ("<1> orig page->private=%u\n", page->private); ! */ newpage=alloc_pages(GFP_KERNEL, 0); --- 332,349 ---- { unsigned long flags; ! struct page *newpage=NULL; struct address_space *mapping; ! struct page *ch=NULL; // dummy struct page as 'chunk head' //struct chunk_head *ch; mapping=page_mapping(page); ! //printk ("<1> Add to CCache called: mapping=%p\n", mapping); ! if (!mapping) { ! printk ("<1> orig page->count=%d\n", atomic_read(&page->_count)); ! printk ("<1> orig page->mapcount=%d\n", atomic_read(&page->_mapcount)); ! printk ("<1> orig page->flags=%u\n", page->flags); ! printk ("<1> orig page->mapping=%p\n", page->mapping); ! printk ("<1> orig page->private=%u\n", page->private); ! goto out; ! } newpage=alloc_pages(GFP_KERNEL, 0); *************** *** 366,370 **** ch->mapping=mapping; ! //ch->mapping=NULL; // this make it as if it's in swap ccache -- getting bad_page() ? ch->index=page->index; --- 376,380 ---- ch->mapping=mapping; ! //ch->mapping=NULL; ch->index=page->index; *************** *** 408,413 **** --- 418,425 ---- out: if (newpage) __free_page(newpage); + if (ch) kfree(ch); return -1; } + EXPORT_SYMBOL(add_to_ccache); /* *************** *** 441,445 **** if (ret==0) { ! //ClearPageWillCompress(page); return PAGE_SUCCESS; } else { --- 453,457 ---- if (ret==0) { ! //ClearPageWillCompress(page); return PAGE_SUCCESS; } else { *************** *** 659,669 **** if (TestSetPageLocked(page)) goto keep; - - if (PageWillCompress(page)) { - //page->mapping=NULL; - ClearPageWillCompress(page); - goto free_it; - } - if (PageDirty(page) || PageWriteback(page)) goto keep_locked; --- 671,674 ---- *************** *** 716,720 **** pgactivate++; keep_locked: - //ClearPageWillCompress(page); unlock_page(page); keep: --- 721,724 ---- *************** *** 848,852 **** */ if (!mapping || page_mapcount(page) + nr_refs != page_count(page)) ! return 1; /* --- 852,856 ---- */ if (!mapping || page_mapcount(page) + nr_refs != page_count(page)) ! return -EAGAIN; /* *************** *** 869,873 **** * is still set and the operation may continue. */ ! try_to_unmap(page, 1); /* --- 873,879 ---- * is still set and the operation may continue. */ ! if (try_to_unmap(page, 1) == SWAP_FAIL) ! /* A vma has VM_LOCKED set -> Permanent failure */ ! return -EPERM; /* *************** *** 875,879 **** */ if (page_mapcount(page)) ! return 1; write_lock_irq(&mapping->tree_lock); --- 881,885 ---- */ if (page_mapcount(page)) ! return -EAGAIN; write_lock_irq(&mapping->tree_lock); *************** *** 886,890 **** *radix_pointer != page) { write_unlock_irq(&mapping->tree_lock); ! return 1; } --- 892,896 ---- *radix_pointer != page) { write_unlock_irq(&mapping->tree_lock); ! return -EAGAIN; } *************** *** 961,968 **** int migrate_page(struct page *newpage, struct page *page) { BUG_ON(PageWriteback(page)); /* Writeback must be complete */ ! if (migrate_page_remove_references(newpage, page, 2)) ! return -EAGAIN; migrate_page_copy(newpage, page); --- 967,978 ---- int migrate_page(struct page *newpage, struct page *page) { + int rc; + BUG_ON(PageWriteback(page)); /* Writeback must be complete */ ! rc = migrate_page_remove_references(newpage, page, 2); ! ! if (rc) ! return rc; migrate_page_copy(newpage, page); *************** *** 2031,2035 **** if (!(gfp_mask & __GFP_WAIT) || zone->all_unreclaimable || ! atomic_read(&zone->reclaim_in_progress) > 0) return 0; --- 2041,2046 ---- if (!(gfp_mask & __GFP_WAIT) || zone->all_unreclaimable || ! atomic_read(&zone->reclaim_in_progress) > 0 || ! (p->flags & PF_MEMALLOC)) return 0; |
From: Nitin G. <nit...@us...> - 2006-03-23 18:27:59
|
Update of /cvsroot/linuxcompressed/linux26/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30432/mm Modified Files: filemap.c vmscan.c Log Message: 2.6.16-rc5: stable but has mem leaks. No real comp/decomp. Index: filemap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/filemap.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** filemap.c 10 Mar 2006 13:46:21 -0000 1.8 --- filemap.c 23 Mar 2006 18:27:53 -0000 1.9 *************** *** 132,135 **** --- 132,141 ---- } + static int chunk_head_wait(void *word) + { + schedule(); + return 0; + } + static int sync_page(void *word) { *************** *** 514,517 **** --- 520,532 ---- EXPORT_SYMBOL(__lock_page); + void fastcall __wait_unlock_chunk_head(struct page *page) + { + DEFINE_WAIT_BIT(wait, &page->flags, PG_locked); + + __wait_on_bit_lock(page_waitqueue(page), &wait, chunk_head_wait, + TASK_UNINTERRUPTIBLE); + } + EXPORT_SYMBOL(__wait_unlock_chunk_head); + /* * a rather lightweight function, finding and getting a reference to a *************** *** 523,543 **** struct page *ch; //chunk head ! //read_lock_irq(&mapping->tree_lock); ! write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { if (PageCompressed(page)) { ! printk("<1> ** Compressed page in find_get_page **\n"); // page is actually chunk head ch=page; ! page=(struct page *)page_private(ch); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); ! kfree(ch); } - page_cache_get(page); } ! //read_unlock_irq(&mapping->tree_lock); ! write_unlock_irq(&mapping->tree_lock); return page; } --- 538,599 ---- struct page *ch; //chunk head ! read_lock_irq(&mapping->tree_lock); ! //write_lock_irq(&mapping->tree_lock); page = radix_tree_lookup(&mapping->page_tree, offset); if (page) { + page_cache_get(page); + read_unlock_irq(&mapping->tree_lock); if (PageCompressed(page)) { ! //if (offset==0) printk("<1> ## IDX: %u; mapping %p ##\n", page->index, mapping); ! printk("<1> ** Compressed page: %u in find_get_page **\n", offset); // page is actually chunk head ch=page; ! if (TestSetPageLocked(ch)) { ! printk("<1> ** WAIT DEC page: %u in find_get_page; mapping %p **\n", offset, mapping); ! ! // it's currently being decompressed ! // wait until dec completes ! //__lock_page(ch); ! //__wait_unlock_chunk_head(ch); ! //while(PageLocked(ch)) { ! // schedule(); ! //} ! ! //page=(struct page *)ch->mapping; ! page=(struct page *)page_private(ch); ! page_cache_get(page); ! //unlock_page(ch); ! } else { ! /*if (ch->mapping!=NULL) { ! page=(struct page *)(ch->mapping); ! printk("<1> GOT Page: %u; mapping %p\n", offset, mapping); ! page_cache_get(page); ! ClearPageLocked(ch); ! //unlock_page(ch); ! goto out; ! }*/ ! ! printk("<1> DEC Page: %u; mapping %p\n", offset, mapping); ! // decompress() routine below ! //ch->mapping=(struct address_space *)page_private(ch); ! //printk("<1> GIVEN mapping %p\n", ch->mapping); ! ! //page=(struct page *)(ch->mapping); ! page=(struct page *)page_private(ch); ! write_lock_irq(&mapping->tree_lock); ! radix_tree_delete(&mapping->page_tree, offset); ! radix_tree_insert(&mapping->page_tree, offset, page); ! page_cache_get(page); ! write_unlock_irq(&mapping->tree_lock); ! ClearPageLocked(ch); ! //unlock_page(ch); ! } ! //kfree(ch); } } ! out: ! //BUG_ON(PageCompressed(page)); ! if (!page) read_unlock_irq(&mapping->tree_lock); ! //write_unlock_irq(&mapping->tree_lock); return page; } *************** *** 592,596 **** radix_tree_delete(&mapping->page_tree, offset); radix_tree_insert(&mapping->page_tree, offset, page); ! kfree(ch); } --- 648,652 ---- radix_tree_delete(&mapping->page_tree, offset); radix_tree_insert(&mapping->page_tree, offset, page); ! //kfree(ch); } *************** *** 702,706 **** radix_tree_delete(&mapping->page_tree, ch->index); radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); ! kfree(ch); } page_cache_get(pages[i]); --- 758,762 ---- radix_tree_delete(&mapping->page_tree, ch->index); radix_tree_insert(&mapping->page_tree, ch->index, pages[i]); ! //kfree(ch); } page_cache_get(pages[i]); Index: vmscan.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux26/mm/vmscan.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** vmscan.c 10 Mar 2006 13:46:21 -0000 1.8 --- vmscan.c 23 Mar 2006 18:27:53 -0000 1.9 *************** *** 308,317 **** static int should_add_to_ccache(struct page *page) { if (PagePrivate(page)) return 0; if (PageSwapCache(page)) return 0; if (PageDirty(page)) return 0; ! //printk("<1>Some page to be added to ccache.\n"); ! return 1; } --- 308,321 ---- static int should_add_to_ccache(struct page *page) { + /* if (PagePrivate(page)) return 0; if (PageSwapCache(page)) return 0; if (PageDirty(page)) return 0; ! */ //printk("<1>Some page to be added to ccache.\n"); ! ! // Only pass through clean page cache pages ! if (PageUptodate(page) && PageMappedToDisk(page)) return 1; ! return 0; } *************** *** 335,338 **** --- 339,346 ---- newpage=alloc_pages(GFP_KERNEL, 0); if (!newpage) goto out; + + if (PageWillCompress(newpage)) { + printk("\n#### Strange PWC for newpage!! ###\n"); + } /* printk ("<1> NEW page->count=%d\n", atomic_read(&newpage->_count)); *************** *** 358,361 **** --- 366,370 ---- ch->mapping=mapping; + //ch->mapping=NULL; // this make it as if it's in swap ccache -- getting bad_page() ? ch->index=page->index; *************** *** 390,401 **** unlock_page(page); ! printk("<1> Page added to ccache\n"); return 0; //__free_page(newpage); out_locked: write_unlock_irq(&mapping->tree_lock); out: - printk("<1>***** PAGE COUNT NOT 2 -- IT IS %d ******\n", page_count(page)); if (newpage) __free_page(newpage); return -1; --- 399,410 ---- unlock_page(page); ! //printk("<1> Page: %u added to ccache\n", newpage->index); return 0; //__free_page(newpage); out_locked: + printk("<1>***** PAGE COUNT NOT 2 -- IT IS %d ******\n", page_count(page)); write_unlock_irq(&mapping->tree_lock); out: if (newpage) __free_page(newpage); return -1; *************** *** 550,553 **** --- 559,576 ---- list_del(&page->lru); + if (PageCompressed(page)) { + printk("<1> COMPRESSED Page here at shrink_list!\n"); + continue; + } + if (PageWillCompress(page)) { + printk("<1> WILLCOMP Page here at shrink_list!\n"); + printk ("<1> WC page->count=%d\n", page_count(page)); + printk ("<1> WC page->mapcount=%d\n", atomic_read(&page->_mapcount)); + printk ("<1> WC page->flags=%u\n", page->flags); + printk ("<1> WC page->private=%u\n", page_private(page)); + printk ("<1> WC page->mapping=%p\n", page->mapping); + continue; + } + if (TestSetPageLocked(page)) goto keep; *************** *** 693,698 **** --- 716,723 ---- pgactivate++; keep_locked: + //ClearPageWillCompress(page); unlock_page(page); keep: + ClearPageWillCompress(page); list_add(&page->lru, &ret_pages); BUG_ON(PageLRU(page)); |