Blame view

include/linux/vmpressure.h 1.7 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
70ddf637e   Anton Vorontsov   memcg: add memory...
2
3
4
5
6
7
8
9
10
  #ifndef __LINUX_VMPRESSURE_H
  #define __LINUX_VMPRESSURE_H
  
  #include <linux/mutex.h>
  #include <linux/list.h>
  #include <linux/workqueue.h>
  #include <linux/gfp.h>
  #include <linux/types.h>
  #include <linux/cgroup.h>
fba948078   Tejun Heo   cgroup, memcg: mo...
11
  #include <linux/eventfd.h>
70ddf637e   Anton Vorontsov   memcg: add memory...
12
13
14
15
  
  struct vmpressure {
  	unsigned long scanned;
  	unsigned long reclaimed;
8e8ae6452   Johannes Weiner   mm: memcontrol: h...
16
17
18
  
  	unsigned long tree_scanned;
  	unsigned long tree_reclaimed;
70ddf637e   Anton Vorontsov   memcg: add memory...
19
  	/* The lock is used to keep the scanned/reclaimed above in sync. */
22f2020f8   Michal Hocko   vmpressure: chang...
20
  	struct spinlock sr_lock;
70ddf637e   Anton Vorontsov   memcg: add memory...
21
22
23
24
25
26
27
28
29
30
31
32
  
  	/* The list of vmpressure_event structs. */
  	struct list_head events;
  	/* Have to grab the lock on events traversal or modifications. */
  	struct mutex events_lock;
  
  	struct work_struct work;
  };
  
  struct mem_cgroup;
  
  #ifdef CONFIG_MEMCG
8e8ae6452   Johannes Weiner   mm: memcontrol: h...
33
  extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
70ddf637e   Anton Vorontsov   memcg: add memory...
34
35
36
37
  		       unsigned long scanned, unsigned long reclaimed);
  extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
  
  extern void vmpressure_init(struct vmpressure *vmpr);
33cb876e9   Michal Hocko   vmpressure: make ...
38
  extern void vmpressure_cleanup(struct vmpressure *vmpr);
70ddf637e   Anton Vorontsov   memcg: add memory...
39
40
  extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
  extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
59b6f8734   Tejun Heo   memcg: make cgrou...
41
  extern int vmpressure_register_event(struct mem_cgroup *memcg,
70ddf637e   Anton Vorontsov   memcg: add memory...
42
43
  				     struct eventfd_ctx *eventfd,
  				     const char *args);
59b6f8734   Tejun Heo   memcg: make cgrou...
44
  extern void vmpressure_unregister_event(struct mem_cgroup *memcg,
70ddf637e   Anton Vorontsov   memcg: add memory...
45
46
  					struct eventfd_ctx *eventfd);
  #else
8e8ae6452   Johannes Weiner   mm: memcontrol: h...
47
  static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
70ddf637e   Anton Vorontsov   memcg: add memory...
48
49
50
51
52
  			      unsigned long scanned, unsigned long reclaimed) {}
  static inline void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg,
  				   int prio) {}
  #endif /* CONFIG_MEMCG */
  #endif /* __LINUX_VMPRESSURE_H */