Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332353
b: refs/heads/master
c: 63f74ca
h: refs/heads/master
i:
  332351: a62a70c
v: v3
  • Loading branch information
KOSAKI Motohiro authored and Linus Torvalds committed Oct 9, 2012
1 parent f6473e6 commit 891b138
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 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: b22d127a39ddd10d93deee3d96e643657ad53a49
refs/heads/master: 63f74ca21f1fad36d075e063f06dcc6d39fe86b2
15 changes: 9 additions & 6 deletions trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2157,12 +2157,17 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
return pol;
}

static void sp_free(struct sp_node *n)
{
mpol_put(n->policy);
kmem_cache_free(sn_cache, n);
}

static void sp_delete(struct shared_policy *sp, struct sp_node *n)
{
pr_debug("deleting %lx-l%lx\n", n->start, n->end);
rb_erase(&n->nd, &sp->root);
mpol_put(n->policy);
kmem_cache_free(sn_cache, n);
sp_free(n);
}

static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
Expand Down Expand Up @@ -2301,7 +2306,7 @@ int mpol_set_shared_policy(struct shared_policy *info,
}
err = shared_policy_replace(info, vma->vm_pgoff, vma->vm_pgoff+sz, new);
if (err && new)
kmem_cache_free(sn_cache, new);
sp_free(new);
return err;
}

Expand All @@ -2318,9 +2323,7 @@ void mpol_free_shared_policy(struct shared_policy *p)
while (next) {
n = rb_entry(next, struct sp_node, nd);
next = rb_next(&n->nd);
rb_erase(&n->nd, &p->root);
mpol_put(n->policy);
kmem_cache_free(sn_cache, n);
sp_delete(p, n);
}
mutex_unlock(&p->mutex);
}
Expand Down

0 comments on commit 891b138

Please sign in to comment.