aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched/mm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched/mm.h')
-rw-r--r--include/linux/sched/mm.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index 44d356f5e47c..aebb370a0006 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -248,6 +248,43 @@ static inline void memalloc_noreclaim_restore(unsigned int flags)
248 current->flags = (current->flags & ~PF_MEMALLOC) | flags; 248 current->flags = (current->flags & ~PF_MEMALLOC) | flags;
249} 249}
250 250
251#ifdef CONFIG_MEMCG
252/**
253 * memalloc_use_memcg - Starts the remote memcg charging scope.
254 * @memcg: memcg to charge.
255 *
256 * This function marks the beginning of the remote memcg charging scope. All the
257 * __GFP_ACCOUNT allocations till the end of the scope will be charged to the
258 * given memcg.
259 *
260 * NOTE: This function is not nesting safe.
261 */
262static inline void memalloc_use_memcg(struct mem_cgroup *memcg)
263{
264 WARN_ON_ONCE(current->active_memcg);
265 current->active_memcg = memcg;
266}
267
268/**
269 * memalloc_unuse_memcg - Ends the remote memcg charging scope.
270 *
271 * This function marks the end of the remote memcg charging scope started by
272 * memalloc_use_memcg().
273 */
274static inline void memalloc_unuse_memcg(void)
275{
276 current->active_memcg = NULL;
277}
278#else
279static inline void memalloc_use_memcg(struct mem_cgroup *memcg)
280{
281}
282
283static inline void memalloc_unuse_memcg(void)
284{
285}
286#endif
287
251#ifdef CONFIG_MEMBARRIER 288#ifdef CONFIG_MEMBARRIER
252enum { 289enum {
253 MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY = (1U << 0), 290 MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY = (1U << 0),