Loading include/linux/plist.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -266,6 +266,9 @@ static inline int plist_node_empty(const struct plist_node *node) #define plist_next(pos) \ #define plist_next(pos) \ list_next_entry(pos, node_list) list_next_entry(pos, node_list) #define plist_next_entry(pos, type, member) \ container_of(plist_next(pos), type, member) /** /** * plist_prev - get the prev entry in list * plist_prev - get the prev entry in list * @pos: the type * to cursor * @pos: the type * to cursor Loading include/linux/swap.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -178,6 +178,7 @@ enum { #define SWAP_CLUSTER_MAX 32UL #define SWAP_CLUSTER_MAX 32UL #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX #define SWAPFILE_CLUSTER 256 #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ Loading Loading @@ -273,6 +274,8 @@ struct swap_info_struct { */ */ struct work_struct discard_work; /* discard worker */ struct work_struct discard_work; /* discard worker */ struct swap_cluster_list discard_clusters; /* discard clusters list */ struct swap_cluster_list discard_clusters; /* discard clusters list */ unsigned int write_pending; unsigned int max_writes; }; }; #ifdef CONFIG_64BIT #ifdef CONFIG_64BIT Loading Loading @@ -348,6 +351,8 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem, unsigned long *nr_scanned); unsigned long *nr_scanned); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern int vm_swappiness; extern int vm_swappiness; extern int sysctl_swap_ratio; extern int sysctl_swap_ratio_enable; extern int remove_mapping(struct address_space *mapping, struct page *page); extern int remove_mapping(struct address_space *mapping, struct page *page); extern unsigned long vm_total_pages; extern unsigned long vm_total_pages; Loading include/linux/swapfile.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -8,7 +8,12 @@ */ */ extern spinlock_t swap_lock; extern spinlock_t swap_lock; extern struct plist_head swap_active_head; extern struct plist_head swap_active_head; extern spinlock_t swap_avail_lock; extern struct plist_head *swap_avail_heads; extern struct swap_info_struct *swap_info[]; extern struct swap_info_struct *swap_info[]; extern int try_to_unuse(unsigned int, bool, unsigned long); extern int try_to_unuse(unsigned int, bool, unsigned long); extern int swap_ratio(struct swap_info_struct **si, int node); extern void setup_swap_ratio(struct swap_info_struct *p, int prio); extern bool is_swap_ratio_group(int prio); #endif /* _LINUX_SWAPFILE_H */ #endif /* _LINUX_SWAPFILE_H */ kernel/sysctl.c +16 −0 Original line number Original line Diff line number Diff line Loading @@ -1774,6 +1774,22 @@ static struct ctl_table vm_table[] = { .extra1 = (void *)&mmap_rnd_compat_bits_min, .extra1 = (void *)&mmap_rnd_compat_bits_min, .extra2 = (void *)&mmap_rnd_compat_bits_max, .extra2 = (void *)&mmap_rnd_compat_bits_max, }, }, #endif #ifdef CONFIG_SWAP { .procname = "swap_ratio", .data = &sysctl_swap_ratio, .maxlen = sizeof(sysctl_swap_ratio), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, { .procname = "swap_ratio_enable", .data = &sysctl_swap_ratio_enable, .maxlen = sizeof(sysctl_swap_ratio_enable), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, #endif #endif { } { } }; }; Loading mm/Makefile +1 −1 Original line number Original line Diff line number Diff line Loading @@ -55,7 +55,7 @@ ifdef CONFIG_MMU endif endif obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_ratio.o obj-$(CONFIG_FRONTSWAP) += frontswap.o obj-$(CONFIG_FRONTSWAP) += frontswap.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_HAS_DMA) += dmapool.o obj-$(CONFIG_HAS_DMA) += dmapool.o Loading Loading
include/linux/plist.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -266,6 +266,9 @@ static inline int plist_node_empty(const struct plist_node *node) #define plist_next(pos) \ #define plist_next(pos) \ list_next_entry(pos, node_list) list_next_entry(pos, node_list) #define plist_next_entry(pos, type, member) \ container_of(plist_next(pos), type, member) /** /** * plist_prev - get the prev entry in list * plist_prev - get the prev entry in list * @pos: the type * to cursor * @pos: the type * to cursor Loading
include/linux/swap.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -178,6 +178,7 @@ enum { #define SWAP_CLUSTER_MAX 32UL #define SWAP_CLUSTER_MAX 32UL #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX #define SWAPFILE_CLUSTER 256 #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ #define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ #define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ Loading Loading @@ -273,6 +274,8 @@ struct swap_info_struct { */ */ struct work_struct discard_work; /* discard worker */ struct work_struct discard_work; /* discard worker */ struct swap_cluster_list discard_clusters; /* discard clusters list */ struct swap_cluster_list discard_clusters; /* discard clusters list */ unsigned int write_pending; unsigned int max_writes; }; }; #ifdef CONFIG_64BIT #ifdef CONFIG_64BIT Loading Loading @@ -348,6 +351,8 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem, unsigned long *nr_scanned); unsigned long *nr_scanned); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern unsigned long shrink_all_memory(unsigned long nr_pages); extern int vm_swappiness; extern int vm_swappiness; extern int sysctl_swap_ratio; extern int sysctl_swap_ratio_enable; extern int remove_mapping(struct address_space *mapping, struct page *page); extern int remove_mapping(struct address_space *mapping, struct page *page); extern unsigned long vm_total_pages; extern unsigned long vm_total_pages; Loading
include/linux/swapfile.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -8,7 +8,12 @@ */ */ extern spinlock_t swap_lock; extern spinlock_t swap_lock; extern struct plist_head swap_active_head; extern struct plist_head swap_active_head; extern spinlock_t swap_avail_lock; extern struct plist_head *swap_avail_heads; extern struct swap_info_struct *swap_info[]; extern struct swap_info_struct *swap_info[]; extern int try_to_unuse(unsigned int, bool, unsigned long); extern int try_to_unuse(unsigned int, bool, unsigned long); extern int swap_ratio(struct swap_info_struct **si, int node); extern void setup_swap_ratio(struct swap_info_struct *p, int prio); extern bool is_swap_ratio_group(int prio); #endif /* _LINUX_SWAPFILE_H */ #endif /* _LINUX_SWAPFILE_H */
kernel/sysctl.c +16 −0 Original line number Original line Diff line number Diff line Loading @@ -1774,6 +1774,22 @@ static struct ctl_table vm_table[] = { .extra1 = (void *)&mmap_rnd_compat_bits_min, .extra1 = (void *)&mmap_rnd_compat_bits_min, .extra2 = (void *)&mmap_rnd_compat_bits_max, .extra2 = (void *)&mmap_rnd_compat_bits_max, }, }, #endif #ifdef CONFIG_SWAP { .procname = "swap_ratio", .data = &sysctl_swap_ratio, .maxlen = sizeof(sysctl_swap_ratio), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, { .procname = "swap_ratio_enable", .data = &sysctl_swap_ratio_enable, .maxlen = sizeof(sysctl_swap_ratio_enable), .mode = 0644, .proc_handler = proc_dointvec_minmax, }, #endif #endif { } { } }; }; Loading
mm/Makefile +1 −1 Original line number Original line Diff line number Diff line Loading @@ -55,7 +55,7 @@ ifdef CONFIG_MMU endif endif obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o swap_ratio.o obj-$(CONFIG_FRONTSWAP) += frontswap.o obj-$(CONFIG_FRONTSWAP) += frontswap.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_ZSWAP) += zswap.o obj-$(CONFIG_HAS_DMA) += dmapool.o obj-$(CONFIG_HAS_DMA) += dmapool.o Loading