aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mempolicy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mempolicy.h')
-rw-r--r--include/linux/mempolicy.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 017def89e568..172b9c6acb91 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -112,6 +112,31 @@ static inline void mpol_put(struct mempolicy *pol)
112 __mpol_put(pol); 112 __mpol_put(pol);
113} 113}
114 114
115/*
116 * Does mempolicy pol need explicit unref after use?
117 * Currently only needed for shared policies.
118 */
119static inline int mpol_needs_cond_ref(struct mempolicy *pol)
120{
121 return (pol && (pol->flags & MPOL_F_SHARED));
122}
123
124static inline void mpol_cond_put(struct mempolicy *pol)
125{
126 if (mpol_needs_cond_ref(pol))
127 __mpol_put(pol);
128}
129
130extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
131 struct mempolicy *frompol);
132static inline struct mempolicy *mpol_cond_copy(struct mempolicy *tompol,
133 struct mempolicy *frompol)
134{
135 if (!frompol)
136 return frompol;
137 return __mpol_cond_copy(tompol, frompol);
138}
139
115extern struct mempolicy *__mpol_dup(struct mempolicy *pol); 140extern struct mempolicy *__mpol_dup(struct mempolicy *pol);
116static inline struct mempolicy *mpol_dup(struct mempolicy *pol) 141static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
117{ 142{
@@ -201,6 +226,16 @@ static inline void mpol_put(struct mempolicy *p)
201{ 226{
202} 227}
203 228
229static inline void mpol_cond_put(struct mempolicy *pol)
230{
231}
232
233static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to,
234 struct mempolicy *from)
235{
236 return from;
237}
238
204static inline void mpol_get(struct mempolicy *pol) 239static inline void mpol_get(struct mempolicy *pol)
205{ 240{
206} 241}