]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/linux/swap.h
mm-add-extra-free-kbytes-tunable-update
[karo-tx-linux.git] / include / linux / swap.h
index 50a55e2d58ec107c3efe207b61e2e683ae8798ee..fbe8473c37207f037a0ab4c8d92a8052866729a0 100644 (file)
@@ -215,6 +215,8 @@ struct swap_list_t {
 extern unsigned long totalram_pages;
 extern unsigned long totalreserve_pages;
 extern unsigned long dirty_balance_reserve;
+extern int min_free_kbytes;
+extern int extra_free_kbytes;
 extern unsigned int nr_free_buffer_pages(void);
 extern unsigned int nr_free_pagecache_pages(void);
 
@@ -376,6 +378,26 @@ static inline void put_swap_token(struct mm_struct *mm)
                __put_swap_token(mm);
 }
 
+static inline bool has_active_swap_token(struct mm_struct *mm)
+{
+       return has_swap_token(mm) && atomic_read(&mm->active_swap_token);
+}
+
+static inline bool activate_swap_token(struct mm_struct *mm)
+{
+       if (has_swap_token(mm)) {
+               atomic_inc(&mm->active_swap_token);
+               return true;
+       }
+       return false;
+}
+
+static inline void deactivate_swap_token(struct mm_struct *mm, bool swap_token)
+{
+       if (swap_token)
+               atomic_dec(&mm->active_swap_token);
+}
+
 #ifdef CONFIG_CGROUP_MEM_RES_CTLR
 extern void
 mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
@@ -494,6 +516,20 @@ static inline int has_swap_token(struct mm_struct *mm)
        return 0;
 }
 
+static inline bool has_active_swap_token(struct mm_struct *mm)
+{
+       return false;
+}
+
+static inline bool activate_swap_token(struct mm_struct *mm)
+{
+       return false;
+}
+
+static inline void deactivate_swap_token(struct mm_struct *mm, bool swap_token)
+{
+}
+
 static inline void disable_swap_token(struct mem_cgroup *memcg)
 {
 }