Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336247
b: refs/heads/master
c: 18a2f37
h: refs/heads/master
i:
  336245: fac1dfc
  336243: da85f85
  336239: 19ea42d
v: v3
  • Loading branch information
Mel Gorman authored and Linus Torvalds committed Dec 6, 2012
1 parent 69cd321 commit 60f4af1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 49 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: c702418f8a2fa6cc92e84a39880d458faf7af9cc
refs/heads/master: 18a2f371f5edf41810f6469cb9be39931ef9deb9
16 changes: 0 additions & 16 deletions trunk/include/linux/mempolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ static inline void mpol_cond_put(struct mempolicy *pol)
__mpol_put(pol);
}

extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
struct mempolicy *frompol);
static inline struct mempolicy *mpol_cond_copy(struct mempolicy *tompol,
struct mempolicy *frompol)
{
if (!frompol)
return frompol;
return __mpol_cond_copy(tompol, frompol);
}

extern struct mempolicy *__mpol_dup(struct mempolicy *pol);
static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
{
Expand Down Expand Up @@ -215,12 +205,6 @@ static inline void mpol_cond_put(struct mempolicy *pol)
{
}

static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to,
struct mempolicy *from)
{
return from;
}

static inline void mpol_get(struct mempolicy *pol)
{
}
Expand Down
22 changes: 0 additions & 22 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2037,28 +2037,6 @@ struct mempolicy *__mpol_dup(struct mempolicy *old)
return new;
}

/*
* If *frompol needs [has] an extra ref, copy *frompol to *tompol ,
* eliminate the * MPOL_F_* flags that require conditional ref and
* [NOTE!!!] drop the extra ref. Not safe to reference *frompol directly
* after return. Use the returned value.
*
* Allows use of a mempolicy for, e.g., multiple allocations with a single
* policy lookup, even if the policy needs/has extra ref on lookup.
* shmem_readahead needs this.
*/
struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
struct mempolicy *frompol)
{
if (!mpol_needs_cond_ref(frompol))
return frompol;

*tompol = *frompol;
tompol->flags &= ~MPOL_F_SHARED; /* copy doesn't need unref */
__mpol_put(frompol);
return tompol;
}

/* Slow path of a mempolicy comparison */
bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
{
Expand Down
26 changes: 16 additions & 10 deletions trunk/mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,25 +910,29 @@ static struct mempolicy *shmem_get_sbmpol(struct shmem_sb_info *sbinfo)
static struct page *shmem_swapin(swp_entry_t swap, gfp_t gfp,
struct shmem_inode_info *info, pgoff_t index)
{
struct mempolicy mpol, *spol;
struct vm_area_struct pvma;

spol = mpol_cond_copy(&mpol,
mpol_shared_policy_lookup(&info->policy, index));
struct page *page;

/* Create a pseudo vma that just contains the policy */
pvma.vm_start = 0;
/* Bias interleave by inode number to distribute better across nodes */
pvma.vm_pgoff = index + info->vfs_inode.i_ino;
pvma.vm_ops = NULL;
pvma.vm_policy = spol;
return swapin_readahead(swap, gfp, &pvma, 0);
pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, index);

page = swapin_readahead(swap, gfp, &pvma, 0);

/* Drop reference taken by mpol_shared_policy_lookup() */
mpol_cond_put(pvma.vm_policy);

return page;
}

static struct page *shmem_alloc_page(gfp_t gfp,
struct shmem_inode_info *info, pgoff_t index)
{
struct vm_area_struct pvma;
struct page *page;

/* Create a pseudo vma that just contains the policy */
pvma.vm_start = 0;
Expand All @@ -937,10 +941,12 @@ static struct page *shmem_alloc_page(gfp_t gfp,
pvma.vm_ops = NULL;
pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, index);

/*
* alloc_page_vma() will drop the shared policy reference
*/
return alloc_page_vma(gfp, &pvma, 0);
page = alloc_page_vma(gfp, &pvma, 0);

/* Drop reference taken by mpol_shared_policy_lookup() */
mpol_cond_put(pvma.vm_policy);

return page;
}
#else /* !CONFIG_NUMA */
#ifdef CONFIG_TMPFS
Expand Down

0 comments on commit 60f4af1

Please sign in to comment.