diff for duplicates of <1462309326.21143.10.camel@linux.intel.com> diff --git a/a/1.txt b/N1/1.txt index dfd91f1..ac92be7 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -5,7 +5,7 @@ on every page being swapped. This patch adds new functions get_swap_pages and scan_swap_map_slots to request multiple swap slots at once. This will reduce the lock contention on the swap_info lock as we only need to acquire the lock once to get -multiple slots.A A Also scan_swap_map_slots can operate more efficiently +multiple slots. Also scan_swap_map_slots can operate more efficiently as swap slots often occurs in clusters close to each other on a swap device and it is quicker to allocate them together. @@ -15,62 +15,62 @@ lock. Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com> --- -A include/linux/swap.h |A A 27 +++++-- -A mm/swap_state.cA A A A A A |A A 23 +++--- -A mm/swapfile.cA A A A A A A A | 215 +++++++++++++++++++++++++++++++++++++++++++++------ -A mm/vmscan.cA A A A A A A A A A |A A A 2 +- -A 4 files changed, 228 insertions(+), 39 deletions(-) + include/linux/swap.h | 27 +++++-- + mm/swap_state.c | 23 +++--- + mm/swapfile.c | 215 +++++++++++++++++++++++++++++++++++++++++++++------ + mm/vmscan.c | 2 +- + 4 files changed, 228 insertions(+), 39 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 2b83359..da6d994 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -23,6 +23,7 @@ struct bio; -A #define SWAP_FLAG_DISCARD 0x10000 /* enable discard for swap */ -A #define SWAP_FLAG_DISCARD_ONCE 0x20000 /* discard swap area at swapon-time */ -A #define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */ + #define SWAP_FLAG_DISCARD 0x10000 /* enable discard for swap */ + #define SWAP_FLAG_DISCARD_ONCE 0x20000 /* discard swap area at swapon-time */ + #define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */ +#define SWAP_BATCH 64 -A -A #define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \ -A A SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | \ + + #define SWAP_FLAGS_VALID (SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \ + SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | \ @@ -370,7 +371,8 @@ extern struct address_space swapper_spaces[]; -A #define swap_address_space(entry) (&swapper_spaces[swp_type(entry)]) -A extern unsigned long total_swapcache_pages(void); -A extern void show_swap_cache_info(void); + #define swap_address_space(entry) (&swapper_spaces[swp_type(entry)]) + extern unsigned long total_swapcache_pages(void); + extern void show_swap_cache_info(void); -extern int add_to_swap(struct page *, struct list_head *list); +extern int add_to_swap(struct page *, struct list_head *list, + swp_entry_t *entry); -A extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); -A extern int __add_to_swap_cache(struct page *page, swp_entry_t entry); -A extern void __delete_from_swap_cache(struct page *); + extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); + extern int __add_to_swap_cache(struct page *page, swp_entry_t entry); + extern void __delete_from_swap_cache(struct page *); @@ -403,6 +405,7 @@ static inline long get_nr_swap_pages(void) -A -A extern void si_swapinfo(struct sysinfo *); -A extern swp_entry_t get_swap_page(void); + + extern void si_swapinfo(struct sysinfo *); + extern swp_entry_t get_swap_page(void); +extern int get_swap_pages(int n, swp_entry_t swp_entries[]); -A extern swp_entry_t get_swap_page_of_type(int); -A extern int add_swap_count_continuation(swp_entry_t, gfp_t); -A extern void swap_shmem_alloc(swp_entry_t); + extern swp_entry_t get_swap_page_of_type(int); + extern int add_swap_count_continuation(swp_entry_t, gfp_t); + extern void swap_shmem_alloc(swp_entry_t); @@ -410,6 +413,7 @@ extern int swap_duplicate(swp_entry_t); -A extern int swapcache_prepare(swp_entry_t); -A extern void swap_free(swp_entry_t); -A extern void swapcache_free(swp_entry_t); + extern int swapcache_prepare(swp_entry_t); + extern void swap_free(swp_entry_t); + extern void swapcache_free(swp_entry_t); +extern void swapcache_free_entries(swp_entry_t *entries, int n); -A extern int free_swap_and_cache(swp_entry_t); -A extern int swap_type_of(dev_t, sector_t, struct block_device **); -A extern unsigned int count_swap_pages(int, int); + extern int free_swap_and_cache(swp_entry_t); + extern int swap_type_of(dev_t, sector_t, struct block_device **); + extern unsigned int count_swap_pages(int, int); @@ -429,7 +433,6 @@ struct backing_dev_info; -A #define total_swap_pages 0L -A #define total_swapcache_pages() 0UL -A #define vm_swap_full() 0 + #define total_swap_pages 0L + #define total_swapcache_pages() 0UL + #define vm_swap_full() 0 - -A #define si_swapinfo(val) \ -A do { (val)->freeswap = (val)->totalswap = 0; } while (0) -A /* only sparc can not include linux/pagemap.h in this file + #define si_swapinfo(val) \ + do { (val)->freeswap = (val)->totalswap = 0; } while (0) + /* only sparc can not include linux/pagemap.h in this file @@ -451,6 +454,21 @@ static inline int add_swap_count_continuation(swp_entry_t swp, gfp_t gfp_mask) -A return 0; -A } -A + return 0; + } + +static inline int add_to_swap(struct page *page, struct list_head *list, + swp_entry_t *entry) +{ @@ -86,44 +86,44 @@ A +{ +} + -A static inline void swap_shmem_alloc(swp_entry_t swp) -A { -A } + static inline void swap_shmem_alloc(swp_entry_t swp) + { + } @@ -484,11 +502,6 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp) -A return NULL; -A } -A + return NULL; + } + -static inline int add_to_swap(struct page *page, struct list_head *list) -{ - return 0; -} - -A static inline int add_to_swap_cache(struct page *page, swp_entry_t entry, -A gfp_t gfp_mask) -A { + static inline int add_to_swap_cache(struct page *page, swp_entry_t entry, + gfp_t gfp_mask) + { diff --git a/mm/swap_state.c b/mm/swap_state.c index 366ce35..bad02c1 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -154,30 +154,35 @@ void __delete_from_swap_cache(struct page *page) -A /** -A * add_to_swap - allocate swap space for a page -A * @page: page we want to move to swap + /** + * add_to_swap - allocate swap space for a page + * @page: page we want to move to swap + * @entry: swap entry that we have pre-allocated -A * -A * Allocate swap space for the page and add the page to the -A * swap cache.A A Caller needs to hold the page lock.A -A */ + * + * Allocate swap space for the page and add the page to the + * swap cache. Caller needs to hold the page lock. + */ -int add_to_swap(struct page *page, struct list_head *list) +int add_to_swap(struct page *page, struct list_head *list, swp_entry_t *entry) -A { + { - swp_entry_t entry; -A int err; + int err; + swp_entry_t ent; -A -A VM_BUG_ON_PAGE(!PageLocked(page), page); -A VM_BUG_ON_PAGE(!PageUptodate(page), page); -A + + VM_BUG_ON_PAGE(!PageLocked(page), page); + VM_BUG_ON_PAGE(!PageUptodate(page), page); + - entry = get_swap_page(); - if (!entry.val) + if (!entry) { @@ -132,103 +132,103 @@ A + } + + if (entry && !entry->val) -A return 0; -A + return 0; + - if (mem_cgroup_try_charge_swap(page, entry)) { - swapcache_free(entry); + if (mem_cgroup_try_charge_swap(page, *entry)) { + swapcache_free(*entry); -A return 0; -A } -A -A if (unlikely(PageTransHuge(page))) -A if (unlikely(split_huge_page_to_list(page, list))) { + return 0; + } + + if (unlikely(PageTransHuge(page))) + if (unlikely(split_huge_page_to_list(page, list))) { - swapcache_free(entry); + swapcache_free(*entry); -A return 0; -A } -A + return 0; + } + @@ -192,7 +197,7 @@ int add_to_swap(struct page *page, struct list_head *list) -A /* -A A * Add it to the swap cache. -A A */ + /* + * Add it to the swap cache. + */ - err = add_to_swap_cache(page, entry, + err = add_to_swap_cache(page, *entry, -A __GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN); -A -A if (!err) { + __GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN); + + if (!err) { @@ -202,7 +207,7 @@ int add_to_swap(struct page *page, struct list_head *list) -A A * add_to_swap_cache() doesn't return -EEXIST, so we can safely -A A * clear SWAP_HAS_CACHE flag. -A A */ + * add_to_swap_cache() doesn't return -EEXIST, so we can safely + * clear SWAP_HAS_CACHE flag. + */ - swapcache_free(entry); + swapcache_free(*entry); -A return 0; -A } -A } + return 0; + } + } diff --git a/mm/swapfile.c b/mm/swapfile.c index 83874ec..2c294a6 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -437,7 +437,7 @@ scan_swap_map_ssd_cluster_conflict(struct swap_info_struct *si, -A * Try to get a swap entry from current cpu's swap entry pool (a cluster). This -A * might involve allocating a new cluster for current CPU too. -A */ + * Try to get a swap entry from current cpu's swap entry pool (a cluster). This + * might involve allocating a new cluster for current CPU too. + */ -static void scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, +static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si, -A unsigned long *offset, unsigned long *scan_base) -A { -A struct percpu_cluster *cluster; + unsigned long *offset, unsigned long *scan_base) + { + struct percpu_cluster *cluster; @@ -460,7 +460,7 @@ new_cluster: -A *scan_base = *offset = si->cluster_next; -A goto new_cluster; -A } else + *scan_base = *offset = si->cluster_next; + goto new_cluster; + } else - return; + return false; -A } -A -A found_free = false; + } + + found_free = false; @@ -485,15 +485,21 @@ new_cluster: -A cluster->next = tmp + 1; -A *offset = tmp; -A *scan_base = tmp; + cluster->next = tmp + 1; + *offset = tmp; + *scan_base = tmp; + return found_free; -A } -A + } + -static unsigned long scan_swap_map(struct swap_info_struct *si, -- A A A unsigned char usage) +- unsigned char usage) +static int scan_swap_map_slots(struct swap_info_struct *si, -+ A A A unsigned char usage, int nr, -+ A A A unsigned long slots[]) -A { -A unsigned long offset; -A unsigned long scan_base; -A unsigned long last_in_cluster = 0; -A int latency_ration = LATENCY_LIMIT; ++ unsigned char usage, int nr, ++ unsigned long slots[]) + { + unsigned long offset; + unsigned long scan_base; + unsigned long last_in_cluster = 0; + int latency_ration = LATENCY_LIMIT; + int n_ret = 0; + + if (nr > SWAP_BATCH) + nr = SWAP_BATCH; -A -A /* -A A * We try to cluster swap pages by allocating them sequentially + + /* + * We try to cluster swap pages by allocating them sequentially @@ -511,8 +517,10 @@ static unsigned long scan_swap_map(struct swap_info_struct *si, -A -A /* SSD algorithm */ -A if (si->cluster_info) { + + /* SSD algorithm */ + if (si->cluster_info) { - scan_swap_map_try_ssd_cluster(si, &offset, &scan_base); - goto checks; + if (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base)) + goto checks; + else + goto done; -A } -A -A if (unlikely(!si->cluster_nr--)) { + } + + if (unlikely(!si->cluster_nr--)) { @@ -556,8 +564,14 @@ static unsigned long scan_swap_map(struct swap_info_struct *si, -A -A checks: -A if (si->cluster_info) { + + checks: + if (si->cluster_info) { - while (scan_swap_map_ssd_cluster_conflict(si, offset)) - scan_swap_map_try_ssd_cluster(si, &offset, &scan_base); + while (scan_swap_map_ssd_cluster_conflict(si, offset)) { @@ -239,13 +239,13 @@ A if (si->cluster_info) { + &scan_base)) + goto done; + } -A } -A if (!(si->flags & SWP_WRITEOK)) -A goto no_page; + } + if (!(si->flags & SWP_WRITEOK)) + goto no_page; @@ -578,8 +592,12 @@ checks: -A goto scan; /* check next one */ -A } -A + goto scan; /* check next one */ + } + - if (si->swap_map[offset]) - goto scan; + if (si->swap_map[offset]) { @@ -254,17 +254,17 @@ A + else + goto done; + } -A -A if (offset == si->lowest_bit) -A si->lowest_bit++; + + if (offset == si->lowest_bit) + si->lowest_bit++; @@ -596,9 +614,42 @@ checks: -A si->swap_map[offset] = usage; -A inc_cluster_info_page(si, si->cluster_info, offset); -A si->cluster_next = offset + 1; + si->swap_map[offset] = usage; + inc_cluster_info_page(si, si->cluster_info, offset); + si->cluster_next = offset + 1; - si->flags -= SWP_SCANNING; + slots[n_ret] = offset; + ++n_ret; -A + - return offset; + /* got enough slots or reach max slots? */ + if ((n_ret == nr) || (offset >= si->highest_bit)) @@ -299,20 +299,20 @@ A +done: + si->flags -= SWP_SCANNING; + return n_ret; -A -A scan: -A spin_unlock(&si->lock); + + scan: + spin_unlock(&si->lock); @@ -636,17 +687,44 @@ scan: -A -A no_page: -A si->flags -= SWP_SCANNING; + + no_page: + si->flags -= SWP_SCANNING; - return 0; + return n_ret; -A } -A + } + -swp_entry_t get_swap_page(void) +static unsigned long scan_swap_map(struct swap_info_struct *si, -+ A A A unsigned char usage) ++ unsigned char usage) +{ + unsigned long slots[1]; + int n_ret; @@ -327,16 +327,16 @@ A +} + +int get_swap_pages(int n, swp_entry_t swp_entries[]) -A { -A struct swap_info_struct *si, *next; + { + struct swap_info_struct *si, *next; - pgoff_t offset; + long avail_pgs, n_ret, n_goal; -A + - if (atomic_long_read(&nr_swap_pages) <= 0) + n_ret = 0; + avail_pgs = atomic_long_read(&nr_swap_pages); + if (avail_pgs <= 0) -A goto noswap; + goto noswap; - atomic_long_dec(&nr_swap_pages); + + n_goal = n; @@ -349,13 +349,13 @@ A goto noswap; + n_goal = avail_pgs; + + atomic_long_sub(n_goal, &nr_swap_pages); -A -A spin_lock(&swap_avail_lock); -A + + spin_lock(&swap_avail_lock); + @@ -674,10 +752,26 @@ start_over: -A } -A -A /* This is called for allocating swap entry for cache */ + } + + /* This is called for allocating swap entry for cache */ - offset = scan_swap_map(si, SWAP_HAS_CACHE); + while (n_ret < n_goal) { + unsigned long slots[SWAP_BATCH]; @@ -373,23 +373,23 @@ A /* This is called for allocating swap entry for cache */ + n_ret += ret; + } + -A spin_unlock(&si->lock); + spin_unlock(&si->lock); - if (offset) - return swp_entry(si->type, offset); + if (n_ret == n_goal) + return n_ret; + -A pr_debug("scan_swap_map of si %d failed to find offset\n", -A A A A A A A A si->type); -A spin_lock(&swap_avail_lock); + pr_debug("scan_swap_map of si %d failed to find offset\n", + si->type); + spin_lock(&swap_avail_lock); @@ -698,9 +792,23 @@ nextsi: -A -A spin_unlock(&swap_avail_lock); -A + + spin_unlock(&swap_avail_lock); + - atomic_long_inc(&nr_swap_pages); + if (n_ret < n_goal) + atomic_long_add((long) (n_goal-n_ret), &nr_swap_pages); -A noswap: + noswap: - return (swp_entry_t) {0}; + return n_ret; +} @@ -405,13 +405,13 @@ A noswap: + return swp_entries[0]; + else + return (swp_entry_t) {0}; -A } -A -A /* The only caller of this function is now suspend routine */ + } + + /* The only caller of this function is now suspend routine */ @@ -761,6 +869,47 @@ out: -A return NULL; -A } -A + return NULL; + } + +static struct swap_info_struct *swap_info_get_cont(swp_entry_t entry, + struct swap_info_struct *q) +{ @@ -453,13 +453,13 @@ A + return NULL; +} + -A static unsigned char swap_entry_free(struct swap_info_struct *p, -A A A A A A swp_entry_t entry, unsigned char usage) -A { + static unsigned char swap_entry_free(struct swap_info_struct *p, + swp_entry_t entry, unsigned char usage) + { @@ -855,6 +1004,28 @@ void swapcache_free(swp_entry_t entry) -A } -A } -A + } + } + +void swapcache_free_entries(swp_entry_t *entries, int n) +{ + struct swap_info_struct *p, *prev; @@ -482,27 +482,21 @@ A + spin_unlock(&p->lock); +} + -A /* -A * How many references to page are currently swapped out? -A * This does not give an exact answer when swap count is continued, + /* + * How many references to page are currently swapped out? + * This does not give an exact answer when swap count is continued, diff --git a/mm/vmscan.c b/mm/vmscan.c index 132ba02..e36d8a7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1114,7 +1114,7 @@ static unsigned long shrink_anon_page_list(struct list_head *page_list, -A * Try to allocate it some swap space here. -A */ -A + * Try to allocate it some swap space here. + */ + - if (!add_to_swap(page, page_list)) { + if (!add_to_swap(page, page_list, NULL)) { -A pg_finish(page, PG_ACTIVATE_LOCKED, swap_ret, &nr_reclaimed, -A pgactivate, ret_pages, free_pages); -A continue; ---A + pg_finish(page, PG_ACTIVATE_LOCKED, swap_ret, &nr_reclaimed, + pgactivate, ret_pages, free_pages); + continue; +-- 2.5.5 - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> diff --git a/a/content_digest b/N1/content_digest index 9c9ea43..edb3b05 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -23,7 +23,7 @@ "This patch adds new functions get_swap_pages and scan_swap_map_slots to\n" "request multiple swap slots at once. This will reduce the lock contention\n" "on the swap_info lock as we only need to acquire the lock once to get\n" - "multiple slots.A A Also scan_swap_map_slots can operate more efficiently\n" + "multiple slots.\302\240\302\240Also scan_swap_map_slots can operate more efficiently\n" "as swap slots often occurs in clusters close to each other on a swap\n" "device and it is quicker to allocate them together.\n" "\n" @@ -33,62 +33,62 @@ "\n" "Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>\n" "---\n" - "A include/linux/swap.h |A A 27 +++++--\n" - "A mm/swap_state.cA A A A A A |A A 23 +++---\n" - "A mm/swapfile.cA A A A A A A A | 215 +++++++++++++++++++++++++++++++++++++++++++++------\n" - "A mm/vmscan.cA A A A A A A A A A |A A A 2 +-\n" - "A 4 files changed, 228 insertions(+), 39 deletions(-)\n" + "\302\240include/linux/swap.h |\302\240\302\24027 +++++--\n" + "\302\240mm/swap_state.c\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\24023 +++---\n" + "\302\240mm/swapfile.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240| 215 +++++++++++++++++++++++++++++++++++++++++++++------\n" + "\302\240mm/vmscan.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\240\302\2402 +-\n" + "\302\2404 files changed, 228 insertions(+), 39 deletions(-)\n" "\n" "diff --git a/include/linux/swap.h b/include/linux/swap.h\n" "index 2b83359..da6d994 100644\n" "--- a/include/linux/swap.h\n" "+++ b/include/linux/swap.h\n" "@@ -23,6 +23,7 @@ struct bio;\n" - "A #define SWAP_FLAG_DISCARD\t0x10000 /* enable discard for swap */\n" - "A #define SWAP_FLAG_DISCARD_ONCE\t0x20000 /* discard swap area at swapon-time */\n" - "A #define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */\n" + "\302\240#define SWAP_FLAG_DISCARD\t0x10000 /* enable discard for swap */\n" + "\302\240#define SWAP_FLAG_DISCARD_ONCE\t0x20000 /* discard swap area at swapon-time */\n" + "\302\240#define SWAP_FLAG_DISCARD_PAGES 0x40000 /* discard page-clusters after use */\n" "+#define SWAP_BATCH 64\n" - "A \n" - "A #define SWAP_FLAGS_VALID\t(SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \\\n" - "A \t\t\t\tA SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | \\\n" + "\302\240\n" + "\302\240#define SWAP_FLAGS_VALID\t(SWAP_FLAG_PRIO_MASK | SWAP_FLAG_PREFER | \\\n" + "\302\240\t\t\t\t\302\240SWAP_FLAG_DISCARD | SWAP_FLAG_DISCARD_ONCE | \\\n" "@@ -370,7 +371,8 @@ extern struct address_space swapper_spaces[];\n" - "A #define swap_address_space(entry) (&swapper_spaces[swp_type(entry)])\n" - "A extern unsigned long total_swapcache_pages(void);\n" - "A extern void show_swap_cache_info(void);\n" + "\302\240#define swap_address_space(entry) (&swapper_spaces[swp_type(entry)])\n" + "\302\240extern unsigned long total_swapcache_pages(void);\n" + "\302\240extern void show_swap_cache_info(void);\n" "-extern int add_to_swap(struct page *, struct list_head *list);\n" "+extern int add_to_swap(struct page *, struct list_head *list,\n" "+\t\t\tswp_entry_t *entry);\n" - "A extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);\n" - "A extern int __add_to_swap_cache(struct page *page, swp_entry_t entry);\n" - "A extern void __delete_from_swap_cache(struct page *);\n" + "\302\240extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);\n" + "\302\240extern int __add_to_swap_cache(struct page *page, swp_entry_t entry);\n" + "\302\240extern void __delete_from_swap_cache(struct page *);\n" "@@ -403,6 +405,7 @@ static inline long get_nr_swap_pages(void)\n" - "A \n" - "A extern void si_swapinfo(struct sysinfo *);\n" - "A extern swp_entry_t get_swap_page(void);\n" + "\302\240\n" + "\302\240extern void si_swapinfo(struct sysinfo *);\n" + "\302\240extern swp_entry_t get_swap_page(void);\n" "+extern int get_swap_pages(int n, swp_entry_t swp_entries[]);\n" - "A extern swp_entry_t get_swap_page_of_type(int);\n" - "A extern int add_swap_count_continuation(swp_entry_t, gfp_t);\n" - "A extern void swap_shmem_alloc(swp_entry_t);\n" + "\302\240extern swp_entry_t get_swap_page_of_type(int);\n" + "\302\240extern int add_swap_count_continuation(swp_entry_t, gfp_t);\n" + "\302\240extern void swap_shmem_alloc(swp_entry_t);\n" "@@ -410,6 +413,7 @@ extern int swap_duplicate(swp_entry_t);\n" - "A extern int swapcache_prepare(swp_entry_t);\n" - "A extern void swap_free(swp_entry_t);\n" - "A extern void swapcache_free(swp_entry_t);\n" + "\302\240extern int swapcache_prepare(swp_entry_t);\n" + "\302\240extern void swap_free(swp_entry_t);\n" + "\302\240extern void swapcache_free(swp_entry_t);\n" "+extern void swapcache_free_entries(swp_entry_t *entries, int n);\n" - "A extern int free_swap_and_cache(swp_entry_t);\n" - "A extern int swap_type_of(dev_t, sector_t, struct block_device **);\n" - "A extern unsigned int count_swap_pages(int, int);\n" + "\302\240extern int free_swap_and_cache(swp_entry_t);\n" + "\302\240extern int swap_type_of(dev_t, sector_t, struct block_device **);\n" + "\302\240extern unsigned int count_swap_pages(int, int);\n" "@@ -429,7 +433,6 @@ struct backing_dev_info;\n" - "A #define total_swap_pages\t\t\t0L\n" - "A #define total_swapcache_pages()\t\t\t0UL\n" - "A #define vm_swap_full()\t\t\t\t0\n" + "\302\240#define total_swap_pages\t\t\t0L\n" + "\302\240#define total_swapcache_pages()\t\t\t0UL\n" + "\302\240#define vm_swap_full()\t\t\t\t0\n" "-\n" - "A #define si_swapinfo(val) \\\n" - "A \tdo { (val)->freeswap = (val)->totalswap = 0; } while (0)\n" - "A /* only sparc can not include linux/pagemap.h in this file\n" + "\302\240#define si_swapinfo(val) \\\n" + "\302\240\tdo { (val)->freeswap = (val)->totalswap = 0; } while (0)\n" + "\302\240/* only sparc can not include linux/pagemap.h in this file\n" "@@ -451,6 +454,21 @@ static inline int add_swap_count_continuation(swp_entry_t swp, gfp_t gfp_mask)\n" - "A \treturn 0;\n" - "A }\n" - "A \n" + "\302\240\treturn 0;\n" + "\302\240}\n" + "\302\240\n" "+static inline int add_to_swap(struct page *page, struct list_head *list,\n" "+\t\t\t\tswp_entry_t *entry)\n" "+{\n" @@ -104,44 +104,44 @@ "+{\n" "+}\n" "+\n" - "A static inline void swap_shmem_alloc(swp_entry_t swp)\n" - "A {\n" - "A }\n" + "\302\240static inline void swap_shmem_alloc(swp_entry_t swp)\n" + "\302\240{\n" + "\302\240}\n" "@@ -484,11 +502,6 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)\n" - "A \treturn NULL;\n" - "A }\n" - "A \n" + "\302\240\treturn NULL;\n" + "\302\240}\n" + "\302\240\n" "-static inline int add_to_swap(struct page *page, struct list_head *list)\n" "-{\n" "-\treturn 0;\n" "-}\n" "-\n" - "A static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,\n" - "A \t\t\t\t\t\t\tgfp_t gfp_mask)\n" - "A {\n" + "\302\240static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,\n" + "\302\240\t\t\t\t\t\t\tgfp_t gfp_mask)\n" + "\302\240{\n" "diff --git a/mm/swap_state.c b/mm/swap_state.c\n" "index 366ce35..bad02c1 100644\n" "--- a/mm/swap_state.c\n" "+++ b/mm/swap_state.c\n" "@@ -154,30 +154,35 @@ void __delete_from_swap_cache(struct page *page)\n" - "A /**\n" - "A * add_to_swap - allocate swap space for a page\n" - "A * @page: page we want to move to swap\n" + "\302\240/**\n" + "\302\240 * add_to_swap - allocate swap space for a page\n" + "\302\240 * @page: page we want to move to swap\n" "+ * @entry: swap entry that we have pre-allocated\n" - "A *\n" - "A * Allocate swap space for the page and add the page to the\n" - "A * swap cache.A A Caller needs to hold the page lock.A \n" - "A */\n" + "\302\240 *\n" + "\302\240 * Allocate swap space for the page and add the page to the\n" + "\302\240 * swap cache.\302\240\302\240Caller needs to hold the page lock.\302\240\n" + "\302\240 */\n" "-int add_to_swap(struct page *page, struct list_head *list)\n" "+int add_to_swap(struct page *page, struct list_head *list, swp_entry_t *entry)\n" - "A {\n" + "\302\240{\n" "-\tswp_entry_t entry;\n" - "A \tint err;\n" + "\302\240\tint err;\n" "+\tswp_entry_t ent;\n" - "A \n" - "A \tVM_BUG_ON_PAGE(!PageLocked(page), page);\n" - "A \tVM_BUG_ON_PAGE(!PageUptodate(page), page);\n" - "A \n" + "\302\240\n" + "\302\240\tVM_BUG_ON_PAGE(!PageLocked(page), page);\n" + "\302\240\tVM_BUG_ON_PAGE(!PageUptodate(page), page);\n" + "\302\240\n" "-\tentry = get_swap_page();\n" "-\tif (!entry.val)\n" "+\tif (!entry) {\n" @@ -150,103 +150,103 @@ "+\t}\n" "+\n" "+\tif (entry && !entry->val)\n" - "A \t\treturn 0;\n" - "A \n" + "\302\240\t\treturn 0;\n" + "\302\240\n" "-\tif (mem_cgroup_try_charge_swap(page, entry)) {\n" "-\t\tswapcache_free(entry);\n" "+\tif (mem_cgroup_try_charge_swap(page, *entry)) {\n" "+\t\tswapcache_free(*entry);\n" - "A \t\treturn 0;\n" - "A \t}\n" - "A \n" - "A \tif (unlikely(PageTransHuge(page)))\n" - "A \t\tif (unlikely(split_huge_page_to_list(page, list))) {\n" + "\302\240\t\treturn 0;\n" + "\302\240\t}\n" + "\302\240\n" + "\302\240\tif (unlikely(PageTransHuge(page)))\n" + "\302\240\t\tif (unlikely(split_huge_page_to_list(page, list))) {\n" "-\t\t\tswapcache_free(entry);\n" "+\t\t\tswapcache_free(*entry);\n" - "A \t\t\treturn 0;\n" - "A \t\t}\n" - "A \n" + "\302\240\t\t\treturn 0;\n" + "\302\240\t\t}\n" + "\302\240\n" "@@ -192,7 +197,7 @@ int add_to_swap(struct page *page, struct list_head *list)\n" - "A \t/*\n" - "A \tA * Add it to the swap cache.\n" - "A \tA */\n" + "\302\240\t/*\n" + "\302\240\t\302\240* Add it to the swap cache.\n" + "\302\240\t\302\240*/\n" "-\terr = add_to_swap_cache(page, entry,\n" "+\terr = add_to_swap_cache(page, *entry,\n" - "A \t\t\t__GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN);\n" - "A \n" - "A \tif (!err) {\n" + "\302\240\t\t\t__GFP_HIGH|__GFP_NOMEMALLOC|__GFP_NOWARN);\n" + "\302\240\n" + "\302\240\tif (!err) {\n" "@@ -202,7 +207,7 @@ int add_to_swap(struct page *page, struct list_head *list)\n" - "A \t\tA * add_to_swap_cache() doesn't return -EEXIST, so we can safely\n" - "A \t\tA * clear SWAP_HAS_CACHE flag.\n" - "A \t\tA */\n" + "\302\240\t\t\302\240* add_to_swap_cache() doesn't return -EEXIST, so we can safely\n" + "\302\240\t\t\302\240* clear SWAP_HAS_CACHE flag.\n" + "\302\240\t\t\302\240*/\n" "-\t\tswapcache_free(entry);\n" "+\t\tswapcache_free(*entry);\n" - "A \t\treturn 0;\n" - "A \t}\n" - "A }\n" + "\302\240\t\treturn 0;\n" + "\302\240\t}\n" + "\302\240}\n" "diff --git a/mm/swapfile.c b/mm/swapfile.c\n" "index 83874ec..2c294a6 100644\n" "--- a/mm/swapfile.c\n" "+++ b/mm/swapfile.c\n" "@@ -437,7 +437,7 @@ scan_swap_map_ssd_cluster_conflict(struct swap_info_struct *si,\n" - "A * Try to get a swap entry from current cpu's swap entry pool (a cluster). This\n" - "A * might involve allocating a new cluster for current CPU too.\n" - "A */\n" + "\302\240 * Try to get a swap entry from current cpu's swap entry pool (a cluster). This\n" + "\302\240 * might involve allocating a new cluster for current CPU too.\n" + "\302\240 */\n" "-static void scan_swap_map_try_ssd_cluster(struct swap_info_struct *si,\n" "+static bool scan_swap_map_try_ssd_cluster(struct swap_info_struct *si,\n" - "A \tunsigned long *offset, unsigned long *scan_base)\n" - "A {\n" - "A \tstruct percpu_cluster *cluster;\n" + "\302\240\tunsigned long *offset, unsigned long *scan_base)\n" + "\302\240{\n" + "\302\240\tstruct percpu_cluster *cluster;\n" "@@ -460,7 +460,7 @@ new_cluster:\n" - "A \t\t\t*scan_base = *offset = si->cluster_next;\n" - "A \t\t\tgoto new_cluster;\n" - "A \t\t} else\n" + "\302\240\t\t\t*scan_base = *offset = si->cluster_next;\n" + "\302\240\t\t\tgoto new_cluster;\n" + "\302\240\t\t} else\n" "-\t\t\treturn;\n" "+\t\t\treturn false;\n" - "A \t}\n" - "A \n" - "A \tfound_free = false;\n" + "\302\240\t}\n" + "\302\240\n" + "\302\240\tfound_free = false;\n" "@@ -485,15 +485,21 @@ new_cluster:\n" - "A \tcluster->next = tmp + 1;\n" - "A \t*offset = tmp;\n" - "A \t*scan_base = tmp;\n" + "\302\240\tcluster->next = tmp + 1;\n" + "\302\240\t*offset = tmp;\n" + "\302\240\t*scan_base = tmp;\n" "+\treturn found_free;\n" - "A }\n" - "A \n" + "\302\240}\n" + "\302\240\n" "-static unsigned long scan_swap_map(struct swap_info_struct *si,\n" - "-\t\t\t\tA A A unsigned char usage)\n" + "-\t\t\t\t\302\240\302\240\302\240unsigned char usage)\n" "+static int scan_swap_map_slots(struct swap_info_struct *si,\n" - "+\t\t\t\tA A A unsigned char usage, int nr,\n" - "+\t\t\t\tA A A unsigned long slots[])\n" - "A {\n" - "A \tunsigned long offset;\n" - "A \tunsigned long scan_base;\n" - "A \tunsigned long last_in_cluster = 0;\n" - "A \tint latency_ration = LATENCY_LIMIT;\n" + "+\t\t\t\t\302\240\302\240\302\240unsigned char usage, int nr,\n" + "+\t\t\t\t\302\240\302\240\302\240unsigned long slots[])\n" + "\302\240{\n" + "\302\240\tunsigned long offset;\n" + "\302\240\tunsigned long scan_base;\n" + "\302\240\tunsigned long last_in_cluster = 0;\n" + "\302\240\tint latency_ration = LATENCY_LIMIT;\n" "+\tint n_ret = 0;\n" "+\n" "+\tif (nr > SWAP_BATCH)\n" "+\t\tnr = SWAP_BATCH;\n" - "A \n" - "A \t/*\n" - "A \tA * We try to cluster swap pages by allocating them sequentially\n" + "\302\240\n" + "\302\240\t/*\n" + "\302\240\t\302\240* We try to cluster swap pages by allocating them sequentially\n" "@@ -511,8 +517,10 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,\n" - "A \n" - "A \t/* SSD algorithm */\n" - "A \tif (si->cluster_info) {\n" + "\302\240\n" + "\302\240\t/* SSD algorithm */\n" + "\302\240\tif (si->cluster_info) {\n" "-\t\tscan_swap_map_try_ssd_cluster(si, &offset, &scan_base);\n" "-\t\tgoto checks;\n" "+\t\tif (scan_swap_map_try_ssd_cluster(si, &offset, &scan_base))\n" "+\t\t\tgoto checks;\n" "+\t\telse\n" "+\t\t\tgoto done;\n" - "A \t}\n" - "A \n" - "A \tif (unlikely(!si->cluster_nr--)) {\n" + "\302\240\t}\n" + "\302\240\n" + "\302\240\tif (unlikely(!si->cluster_nr--)) {\n" "@@ -556,8 +564,14 @@ static unsigned long scan_swap_map(struct swap_info_struct *si,\n" - "A \n" - "A checks:\n" - "A \tif (si->cluster_info) {\n" + "\302\240\n" + "\302\240checks:\n" + "\302\240\tif (si->cluster_info) {\n" "-\t\twhile (scan_swap_map_ssd_cluster_conflict(si, offset))\n" "-\t\t\tscan_swap_map_try_ssd_cluster(si, &offset, &scan_base);\n" "+\t\twhile (scan_swap_map_ssd_cluster_conflict(si, offset)) {\n" @@ -257,13 +257,13 @@ "+\t\t\t\t\t\t\t&scan_base))\n" "+\t\t\t\tgoto done;\n" "+\t\t}\n" - "A \t}\n" - "A \tif (!(si->flags & SWP_WRITEOK))\n" - "A \t\tgoto no_page;\n" + "\302\240\t}\n" + "\302\240\tif (!(si->flags & SWP_WRITEOK))\n" + "\302\240\t\tgoto no_page;\n" "@@ -578,8 +592,12 @@ checks:\n" - "A \t\tgoto scan; /* check next one */\n" - "A \t}\n" - "A \n" + "\302\240\t\tgoto scan; /* check next one */\n" + "\302\240\t}\n" + "\302\240\n" "-\tif (si->swap_map[offset])\n" "-\t\tgoto scan;\n" "+\tif (si->swap_map[offset]) {\n" @@ -272,17 +272,17 @@ "+\t\telse\n" "+\t\t\tgoto done;\n" "+\t}\n" - "A \n" - "A \tif (offset == si->lowest_bit)\n" - "A \t\tsi->lowest_bit++;\n" + "\302\240\n" + "\302\240\tif (offset == si->lowest_bit)\n" + "\302\240\t\tsi->lowest_bit++;\n" "@@ -596,9 +614,42 @@ checks:\n" - "A \tsi->swap_map[offset] = usage;\n" - "A \tinc_cluster_info_page(si, si->cluster_info, offset);\n" - "A \tsi->cluster_next = offset + 1;\n" + "\302\240\tsi->swap_map[offset] = usage;\n" + "\302\240\tinc_cluster_info_page(si, si->cluster_info, offset);\n" + "\302\240\tsi->cluster_next = offset + 1;\n" "-\tsi->flags -= SWP_SCANNING;\n" "+\tslots[n_ret] = offset;\n" "+\t++n_ret;\n" - "A \n" + "\302\240\n" "-\treturn offset;\n" "+\t/* got enough slots or reach max slots? */\n" "+\tif ((n_ret == nr) || (offset >= si->highest_bit))\n" @@ -317,20 +317,20 @@ "+done:\n" "+\tsi->flags -= SWP_SCANNING;\n" "+\treturn n_ret;\n" - "A \n" - "A scan:\n" - "A \tspin_unlock(&si->lock);\n" + "\302\240\n" + "\302\240scan:\n" + "\302\240\tspin_unlock(&si->lock);\n" "@@ -636,17 +687,44 @@ scan:\n" - "A \n" - "A no_page:\n" - "A \tsi->flags -= SWP_SCANNING;\n" + "\302\240\n" + "\302\240no_page:\n" + "\302\240\tsi->flags -= SWP_SCANNING;\n" "-\treturn 0;\n" "+\treturn n_ret;\n" - "A }\n" - "A \n" + "\302\240}\n" + "\302\240\n" "-swp_entry_t get_swap_page(void)\n" "+static unsigned long scan_swap_map(struct swap_info_struct *si,\n" - "+\t\t\t\tA A A unsigned char usage)\n" + "+\t\t\t\t\302\240\302\240\302\240unsigned char usage)\n" "+{\n" "+\tunsigned long slots[1];\n" "+\tint n_ret;\n" @@ -345,16 +345,16 @@ "+}\n" "+\n" "+int get_swap_pages(int n, swp_entry_t swp_entries[])\n" - "A {\n" - "A \tstruct swap_info_struct *si, *next;\n" + "\302\240{\n" + "\302\240\tstruct swap_info_struct *si, *next;\n" "-\tpgoff_t offset;\n" "+\tlong avail_pgs, n_ret, n_goal;\n" - "A \n" + "\302\240\n" "-\tif (atomic_long_read(&nr_swap_pages) <= 0)\n" "+\tn_ret = 0;\n" "+\tavail_pgs = atomic_long_read(&nr_swap_pages);\n" "+\tif (avail_pgs <= 0)\n" - "A \t\tgoto noswap;\n" + "\302\240\t\tgoto noswap;\n" "-\tatomic_long_dec(&nr_swap_pages);\n" "+\n" "+\tn_goal = n;\n" @@ -367,13 +367,13 @@ "+\t\tn_goal = avail_pgs;\n" "+\n" "+\tatomic_long_sub(n_goal, &nr_swap_pages);\n" - "A \n" - "A \tspin_lock(&swap_avail_lock);\n" - "A \n" + "\302\240\n" + "\302\240\tspin_lock(&swap_avail_lock);\n" + "\302\240\n" "@@ -674,10 +752,26 @@ start_over:\n" - "A \t\t}\n" - "A \n" - "A \t\t/* This is called for allocating swap entry for cache */\n" + "\302\240\t\t}\n" + "\302\240\n" + "\302\240\t\t/* This is called for allocating swap entry for cache */\n" "-\t\toffset = scan_swap_map(si, SWAP_HAS_CACHE);\n" "+\t\twhile (n_ret < n_goal) {\n" "+\t\t\tunsigned long slots[SWAP_BATCH];\n" @@ -391,23 +391,23 @@ "+\t\t\tn_ret += ret;\n" "+\t\t}\n" "+\n" - "A \t\tspin_unlock(&si->lock);\n" + "\302\240\t\tspin_unlock(&si->lock);\n" "-\t\tif (offset)\n" "-\t\t\treturn swp_entry(si->type, offset);\n" "+\t\tif (n_ret == n_goal)\n" "+\t\t\treturn n_ret;\n" "+\n" - "A \t\tpr_debug(\"scan_swap_map of si %d failed to find offset\\n\",\n" - "A \t\tA A A A A A A si->type);\n" - "A \t\tspin_lock(&swap_avail_lock);\n" + "\302\240\t\tpr_debug(\"scan_swap_map of si %d failed to find offset\\n\",\n" + "\302\240\t\t\302\240\302\240\302\240\302\240\302\240\302\240\302\240si->type);\n" + "\302\240\t\tspin_lock(&swap_avail_lock);\n" "@@ -698,9 +792,23 @@ nextsi:\n" - "A \n" - "A \tspin_unlock(&swap_avail_lock);\n" - "A \n" + "\302\240\n" + "\302\240\tspin_unlock(&swap_avail_lock);\n" + "\302\240\n" "-\tatomic_long_inc(&nr_swap_pages);\n" "+\tif (n_ret < n_goal)\n" "+\t\tatomic_long_add((long) (n_goal-n_ret), &nr_swap_pages);\n" - "A noswap:\n" + "\302\240noswap:\n" "-\treturn (swp_entry_t) {0};\n" "+\treturn n_ret;\n" "+}\n" @@ -423,13 +423,13 @@ "+\t\treturn swp_entries[0];\n" "+\telse\n" "+\t\treturn (swp_entry_t) {0};\n" - "A }\n" - "A \n" - "A /* The only caller of this function is now suspend routine */\n" + "\302\240}\n" + "\302\240\n" + "\302\240/* The only caller of this function is now suspend routine */\n" "@@ -761,6 +869,47 @@ out:\n" - "A \treturn NULL;\n" - "A }\n" - "A \n" + "\302\240\treturn NULL;\n" + "\302\240}\n" + "\302\240\n" "+static struct swap_info_struct *swap_info_get_cont(swp_entry_t entry,\n" "+\t\t\t\t\tstruct swap_info_struct *q)\n" "+{\n" @@ -471,13 +471,13 @@ "+\treturn NULL;\n" "+}\n" "+\n" - "A static unsigned char swap_entry_free(struct swap_info_struct *p,\n" - "A \t\t\t\tA A A A A swp_entry_t entry, unsigned char usage)\n" - "A {\n" + "\302\240static unsigned char swap_entry_free(struct swap_info_struct *p,\n" + "\302\240\t\t\t\t\302\240\302\240\302\240\302\240\302\240swp_entry_t entry, unsigned char usage)\n" + "\302\240{\n" "@@ -855,6 +1004,28 @@ void swapcache_free(swp_entry_t entry)\n" - "A \t}\n" - "A }\n" - "A \n" + "\302\240\t}\n" + "\302\240}\n" + "\302\240\n" "+void swapcache_free_entries(swp_entry_t *entries, int n)\n" "+{\n" "+\tstruct swap_info_struct *p, *prev;\n" @@ -500,29 +500,23 @@ "+\t\tspin_unlock(&p->lock);\n" "+}\n" "+\n" - "A /*\n" - "A * How many references to page are currently swapped out?\n" - "A * This does not give an exact answer when swap count is continued,\n" + "\302\240/*\n" + "\302\240 * How many references to page are currently swapped out?\n" + "\302\240 * This does not give an exact answer when swap count is continued,\n" "diff --git a/mm/vmscan.c b/mm/vmscan.c\n" "index 132ba02..e36d8a7 100644\n" "--- a/mm/vmscan.c\n" "+++ b/mm/vmscan.c\n" "@@ -1114,7 +1114,7 @@ static unsigned long shrink_anon_page_list(struct list_head *page_list,\n" - "A \t\t* Try to allocate it some swap space here.\n" - "A \t\t*/\n" - "A \n" + "\302\240\t\t* Try to allocate it some swap space here.\n" + "\302\240\t\t*/\n" + "\302\240\n" "-\t\tif (!add_to_swap(page, page_list)) {\n" "+\t\tif (!add_to_swap(page, page_list, NULL)) {\n" - "A \t\t\tpg_finish(page, PG_ACTIVATE_LOCKED, swap_ret, &nr_reclaimed,\n" - "A \t\t\t\t\tpgactivate, ret_pages, free_pages);\n" - "A \t\t\tcontinue;\n" - "--A \n" - "2.5.5\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" + "\302\240\t\t\tpg_finish(page, PG_ACTIVATE_LOCKED, swap_ret, &nr_reclaimed,\n" + "\302\240\t\t\t\t\tpgactivate, ret_pages, free_pages);\n" + "\302\240\t\t\tcontinue;\n" + "--\302\240\n" + 2.5.5 -734a297a1c4e5a5ee89664d93c3a492ef7ac672d1f28c48ba8a6a294219a89e0 +a4e1cddbc463874e4842f56d651bfd1e9c9b7ef59dcc93f117f2318c578cdc79
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.