Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83049
b: refs/heads/master
c: 02098fe
h: refs/heads/master
i:
  83047: be435b4
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Feb 5, 2008
1 parent d5b9c77 commit 7c02ee2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 29 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: 46017e954826ac59e91df76341a3f76b45467847
refs/heads/master: 02098feaa42b2e0087fbbe6c6ab9a23e4653b16a
6 changes: 3 additions & 3 deletions trunk/include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ extern int move_from_swap_cache(struct page *, unsigned long,
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,
extern struct page *read_swap_cache_async(swp_entry_t, gfp_t,
struct vm_area_struct *vma, unsigned long addr);
extern struct page *swapin_readahead(swp_entry_t,
extern struct page *swapin_readahead(swp_entry_t, gfp_t,
struct vm_area_struct *vma, unsigned long addr);

/* linux/mm/swapfile.c */
Expand Down Expand Up @@ -306,7 +306,7 @@ static inline void swap_free(swp_entry_t swp)
{
}

static inline struct page *swapin_readahead(swp_entry_t swp,
static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
struct vm_area_struct *vma, unsigned long addr)
{
return NULL;
Expand Down
3 changes: 2 additions & 1 deletion trunk/mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2007,7 +2007,8 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
page = lookup_swap_cache(entry);
if (!page) {
grab_swap_token(); /* Contend for token _before_ read-in */
page = swapin_readahead(entry, vma, address);
page = swapin_readahead(entry,
GFP_HIGHUSER_MOVABLE, vma, address);
if (!page) {
/*
* Back out if somebody else faulted in this pte
Expand Down
28 changes: 14 additions & 14 deletions trunk/mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,8 @@ static inline int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_
return err;
}

static struct page *shmem_swapin(struct shmem_inode_info *info,
swp_entry_t entry, unsigned long idx)
static struct page *shmem_swapin(swp_entry_t entry, gfp_t gfp,
struct shmem_inode_info *info, unsigned long idx)
{
struct vm_area_struct pvma;
struct page *page;
Expand All @@ -1036,13 +1036,13 @@ static struct page *shmem_swapin(struct shmem_inode_info *info,
pvma.vm_pgoff = idx;
pvma.vm_ops = NULL;
pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);
page = swapin_readahead(entry, &pvma, 0);
page = swapin_readahead(entry, gfp, &pvma, 0);
mpol_free(pvma.vm_policy);
return page;
}

static struct page *shmem_alloc_page(gfp_t gfp, struct shmem_inode_info *info,
unsigned long idx)
static struct page *shmem_alloc_page(gfp_t gfp,
struct shmem_inode_info *info, unsigned long idx)
{
struct vm_area_struct pvma;
struct page *page;
Expand All @@ -1063,14 +1063,14 @@ static inline int shmem_parse_mpol(char *value, int *policy,
return 1;
}

static inline struct page *
shmem_swapin(struct shmem_inode_info *info,swp_entry_t entry,unsigned long idx)
static inline struct page *shmem_swapin(swp_entry_t entry, gfp_t gfp,
struct shmem_inode_info *info, unsigned long idx)
{
return swapin_readahead(entry, NULL, 0);
return swapin_readahead(entry, gfp, NULL, 0);
}

static inline struct page *
shmem_alloc_page(gfp_t gfp,struct shmem_inode_info *info, unsigned long idx)
static inline struct page *shmem_alloc_page(gfp_t gfp,
struct shmem_inode_info *info, unsigned long idx)
{
return alloc_page(gfp);
}
Expand All @@ -1093,6 +1093,7 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
struct page *swappage;
swp_entry_t *entry;
swp_entry_t swap;
gfp_t gfp;
int error;

if (idx >= SHMEM_MAX_INDEX)
Expand All @@ -1117,6 +1118,7 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
error = 0;
if (sgp == SGP_QUICK)
goto failed;
gfp = mapping_gfp_mask(mapping);

spin_lock(&info->lock);
shmem_recalc_inode(inode);
Expand All @@ -1139,7 +1141,7 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
*type |= VM_FAULT_MAJOR;
}
spin_unlock(&info->lock);
swappage = shmem_swapin(info, swap, idx);
swappage = shmem_swapin(swap, gfp, info, idx);
if (!swappage) {
spin_lock(&info->lock);
entry = shmem_swp_alloc(info, idx, sgp);
Expand Down Expand Up @@ -1251,9 +1253,7 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,

if (!filepage) {
spin_unlock(&info->lock);
filepage = shmem_alloc_page(mapping_gfp_mask(mapping),
info,
idx);
filepage = shmem_alloc_page(gfp, info, idx);
if (!filepage) {
shmem_unacct_blocks(info->flags, 1);
shmem_free_blocks(inode, 1);
Expand Down
18 changes: 9 additions & 9 deletions trunk/mm/swap_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ static int __add_to_swap_cache(struct page *page, swp_entry_t entry,
return error;
}

static int add_to_swap_cache(struct page *page, swp_entry_t entry)
static int add_to_swap_cache(struct page *page, swp_entry_t entry,
gfp_t gfp_mask)
{
int error;

Expand All @@ -106,7 +107,7 @@ static int add_to_swap_cache(struct page *page, swp_entry_t entry)
return -ENOENT;
}
SetPageLocked(page);
error = __add_to_swap_cache(page, entry, GFP_KERNEL);
error = __add_to_swap_cache(page, entry, gfp_mask & GFP_KERNEL);
/*
* Anon pages are already on the LRU, we don't run lru_cache_add here.
*/
Expand Down Expand Up @@ -318,7 +319,7 @@ struct page * lookup_swap_cache(swp_entry_t entry)
* A failure return means that either the page allocation failed or that
* the swap entry is no longer in use.
*/
struct page *read_swap_cache_async(swp_entry_t entry,
struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
struct vm_area_struct *vma, unsigned long addr)
{
struct page *found_page, *new_page = NULL;
Expand All @@ -338,8 +339,7 @@ struct page *read_swap_cache_async(swp_entry_t entry,
* Get a new page to read into from swap.
*/
if (!new_page) {
new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE,
vma, addr);
new_page = alloc_page_vma(gfp_mask, vma, addr);
if (!new_page)
break; /* Out of memory */
}
Expand All @@ -354,7 +354,7 @@ struct page *read_swap_cache_async(swp_entry_t entry,
* the just freed swap entry for an existing page.
* May fail (-ENOMEM) if radix-tree node allocation failed.
*/
err = add_to_swap_cache(new_page, entry);
err = add_to_swap_cache(new_page, entry, gfp_mask);
if (!err) {
/*
* Initiate read into locked page and return.
Expand Down Expand Up @@ -388,7 +388,7 @@ struct page *read_swap_cache_async(swp_entry_t entry,
*
* Caller must hold down_read on the vma->vm_mm if vma is not NULL.
*/
struct page *swapin_readahead(swp_entry_t entry,
struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask,
struct vm_area_struct *vma, unsigned long addr)
{
int nr_pages;
Expand All @@ -407,11 +407,11 @@ struct page *swapin_readahead(swp_entry_t entry,
for (end_offset = offset + nr_pages; offset < end_offset; offset++) {
/* Ok, do the async read-ahead now */
page = read_swap_cache_async(swp_entry(swp_type(entry), offset),
vma, addr);
gfp_mask, vma, addr);
if (!page)
break;
page_cache_release(page);
}
lru_add_drain(); /* Push any new pages onto the LRU now */
return read_swap_cache_async(entry, vma, addr);
return read_swap_cache_async(entry, gfp_mask, vma, addr);
}
3 changes: 2 additions & 1 deletion trunk/mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,8 @@ static int try_to_unuse(unsigned int type)
*/
swap_map = &si->swap_map[i];
entry = swp_entry(type, i);
page = read_swap_cache_async(entry, NULL, 0);
page = read_swap_cache_async(entry,
GFP_HIGHUSER_MOVABLE, NULL, 0);
if (!page) {
/*
* Either swap_duplicate() failed because entry
Expand Down

0 comments on commit 7c02ee2

Please sign in to comment.