Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83057
b: refs/heads/master
c: bb63be0
h: refs/heads/master
i:
  83055: 2eb46f3
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Feb 5, 2008
1 parent dcf7604 commit b8cdc27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 818db35992c249dc32c1d86daf7d533fb0952f5d
refs/heads/master: bb63be0a091c512fb566ee235eb8320d5831b6e2
22 changes: 6 additions & 16 deletions trunk/mm/swap_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,13 @@ static struct {
unsigned long del_total;
unsigned long find_success;
unsigned long find_total;
unsigned long noent_race;
unsigned long exist_race;
} swap_cache_info;

void show_swap_cache_info(void)
{
printk("Swap cache: add %lu, delete %lu, find %lu/%lu, race %lu+%lu\n",
printk("Swap cache: add %lu, delete %lu, find %lu/%lu\n",
swap_cache_info.add_total, swap_cache_info.del_total,
swap_cache_info.find_success, swap_cache_info.find_total,
swap_cache_info.noent_race, swap_cache_info.exist_race);
swap_cache_info.find_success, swap_cache_info.find_total);
printk("Free swap = %lukB\n", nr_swap_pages << (PAGE_SHIFT - 10));
printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10));
}
Expand Down Expand Up @@ -89,6 +86,7 @@ static int __add_to_swap_cache(struct page *page, swp_entry_t entry,
set_page_private(page, entry.val);
total_swapcache_pages++;
__inc_zone_page_state(page, NR_FILE_PAGES);
INC_CACHE_INFO(add_total);
}
write_unlock_irq(&swapper_space.tree_lock);
radix_tree_preload_end();
Expand All @@ -102,10 +100,9 @@ static int add_to_swap_cache(struct page *page, swp_entry_t entry,
int error;

BUG_ON(PageLocked(page));
if (!swap_duplicate(entry)) {
INC_CACHE_INFO(noent_race);
if (!swap_duplicate(entry))
return -ENOENT;
}

SetPageLocked(page);
error = __add_to_swap_cache(page, entry, gfp_mask & GFP_KERNEL);
/*
Expand All @@ -114,11 +111,8 @@ static int add_to_swap_cache(struct page *page, swp_entry_t entry,
if (error) {
ClearPageLocked(page);
swap_free(entry);
if (error == -EEXIST)
INC_CACHE_INFO(exist_race);
return error;
}
INC_CACHE_INFO(add_total);
return 0;
}

Expand Down Expand Up @@ -178,11 +172,9 @@ int add_to_swap(struct page * page, gfp_t gfp_mask)
case 0: /* Success */
SetPageUptodate(page);
SetPageDirty(page);
INC_CACHE_INFO(add_total);
return 1;
case -EEXIST:
/* Raced with "speculative" read_swap_cache_async */
INC_CACHE_INFO(exist_race);
swap_free(entry);
continue;
default:
Expand Down Expand Up @@ -225,9 +217,7 @@ int move_to_swap_cache(struct page *page, swp_entry_t entry)
if (!swap_duplicate(entry))
BUG();
SetPageDirty(page);
INC_CACHE_INFO(add_total);
} else if (err == -EEXIST)
INC_CACHE_INFO(exist_race);
}
return err;
}

Expand Down

0 comments on commit b8cdc27

Please sign in to comment.