diff options
author | Lee Schermerhorn <lee.schermerhorn@hp.com> | 2010-05-24 17:32:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 11:06:57 -0400 |
commit | 15d77835ac48dbc2d4884376ea6a08b65b1c40ba (patch) | |
tree | 4bb094f030cedf8376a70a65f9271b571ba37562 /mm | |
parent | 345ace9c797030e77da8ff211b9502370b9d81ab (diff) |
mempolicy: factor mpol_shared_policy_init() return paths
Factor out duplicate put/frees in mpol_shared_policy_init() to a common
return path.
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Ravikiran Thirumalai <kiran@scalex86.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempolicy.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index ade57322fa2a..0c73c8b814cd 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1995,26 +1995,22 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol) | |||
1995 | return; | 1995 | return; |
1996 | /* contextualize the tmpfs mount point mempolicy */ | 1996 | /* contextualize the tmpfs mount point mempolicy */ |
1997 | new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); | 1997 | new = mpol_new(mpol->mode, mpol->flags, &mpol->w.user_nodemask); |
1998 | if (IS_ERR(new)) { | 1998 | if (IS_ERR(new)) |
1999 | mpol_put(mpol); /* drop our ref on sb mpol */ | 1999 | goto put_free; /* no valid nodemask intersection */ |
2000 | NODEMASK_SCRATCH_FREE(scratch); | ||
2001 | return; /* no valid nodemask intersection */ | ||
2002 | } | ||
2003 | 2000 | ||
2004 | task_lock(current); | 2001 | task_lock(current); |
2005 | ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch); | 2002 | ret = mpol_set_nodemask(new, &mpol->w.user_nodemask, scratch); |
2006 | task_unlock(current); | 2003 | task_unlock(current); |
2007 | mpol_put(mpol); /* drop our ref on sb mpol */ | 2004 | mpol_put(mpol); /* drop our ref on sb mpol */ |
2008 | if (ret) { | 2005 | if (ret) |
2009 | NODEMASK_SCRATCH_FREE(scratch); | 2006 | goto put_free; |
2010 | mpol_put(new); | ||
2011 | return; | ||
2012 | } | ||
2013 | 2007 | ||
2014 | /* Create pseudo-vma that contains just the policy */ | 2008 | /* Create pseudo-vma that contains just the policy */ |
2015 | memset(&pvma, 0, sizeof(struct vm_area_struct)); | 2009 | memset(&pvma, 0, sizeof(struct vm_area_struct)); |
2016 | pvma.vm_end = TASK_SIZE; /* policy covers entire file */ | 2010 | pvma.vm_end = TASK_SIZE; /* policy covers entire file */ |
2017 | mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ | 2011 | mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ |
2012 | |||
2013 | put_free: | ||
2018 | mpol_put(new); /* drop initial ref */ | 2014 | mpol_put(new); /* drop initial ref */ |
2019 | NODEMASK_SCRATCH_FREE(scratch); | 2015 | NODEMASK_SCRATCH_FREE(scratch); |
2020 | } | 2016 | } |