Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
(2014/11/02 12:15), Johannes Weiner wrote: > Now that the external page_cgroup data structure and its lookup is > gone, the only code remaining in there is swap slot accounting. > > Rename it and move the conditional compilation into mm/Makefile. > > Signed-off-by: Johannes Weiner Acked-by: KAMEZAWA Hiroyuki -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
(2014/11/02 12:15), Johannes Weiner wrote: Now that the external page_cgroup data structure and its lookup is gone, the only code remaining in there is swap slot accounting. Rename it and move the conditional compilation into mm/Makefile. Signed-off-by: Johannes Weiner han...@cmpxchg.org Acked-by: KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
On Sat, Nov 01, 2014 at 11:15:55PM -0400, Johannes Weiner wrote: > Now that the external page_cgroup data structure and its lookup is > gone, the only code remaining in there is swap slot accounting. > > Rename it and move the conditional compilation into mm/Makefile. > > Signed-off-by: Johannes Weiner Acked-by: Vladimir Davydov -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
On Sat 01-11-14 23:15:55, Johannes Weiner wrote: > Now that the external page_cgroup data structure and its lookup is > gone, the only code remaining in there is swap slot accounting. > > Rename it and move the conditional compilation into mm/Makefile. > > Signed-off-by: Johannes Weiner Acked-by: Michal Hocko > --- > MAINTAINERS | 2 +- > include/linux/page_cgroup.h | 40 - > include/linux/swap_cgroup.h | 42 + > mm/Makefile | 3 +- > mm/memcontrol.c | 2 +- > mm/page_cgroup.c| 211 > > mm/swap_cgroup.c| 208 +++ > mm/swap_state.c | 1 - > mm/swapfile.c | 2 +- > 9 files changed, 255 insertions(+), 256 deletions(-) > delete mode 100644 include/linux/page_cgroup.h > create mode 100644 include/linux/swap_cgroup.h > delete mode 100644 mm/page_cgroup.c > create mode 100644 mm/swap_cgroup.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 7e31be07197e..3a60389d3a13 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2583,7 +2583,7 @@ L: cgro...@vger.kernel.org > L: linux...@kvack.org > S: Maintained > F: mm/memcontrol.c > -F: mm/page_cgroup.c > +F: mm/swap_cgroup.c > > CORETEMP HARDWARE MONITORING DRIVER > M: Fenghua Yu > diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h > deleted file mode 100644 > index 65be35785c86.. > --- a/include/linux/page_cgroup.h > +++ /dev/null > @@ -1,40 +0,0 @@ > -#ifndef __LINUX_PAGE_CGROUP_H > -#define __LINUX_PAGE_CGROUP_H > - > -#include > - > -#ifdef CONFIG_MEMCG_SWAP > -extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, > - unsigned short old, unsigned short new); > -extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); > -extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); > -extern int swap_cgroup_swapon(int type, unsigned long max_pages); > -extern void swap_cgroup_swapoff(int type); > -#else > - > -static inline > -unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) > -{ > - return 0; > -} > - > -static inline > -unsigned short lookup_swap_cgroup_id(swp_entry_t ent) > -{ > - return 0; > -} > - > -static inline int > -swap_cgroup_swapon(int type, unsigned long max_pages) > -{ > - return 0; > -} > - > -static inline void swap_cgroup_swapoff(int type) > -{ > - return; > -} > - > -#endif /* CONFIG_MEMCG_SWAP */ > - > -#endif /* __LINUX_PAGE_CGROUP_H */ > diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h > new file mode 100644 > index ..145306bdc92f > --- /dev/null > +++ b/include/linux/swap_cgroup.h > @@ -0,0 +1,42 @@ > +#ifndef __LINUX_SWAP_CGROUP_H > +#define __LINUX_SWAP_CGROUP_H > + > +#include > + > +#ifdef CONFIG_MEMCG_SWAP > + > +extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, > + unsigned short old, unsigned short new); > +extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); > +extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); > +extern int swap_cgroup_swapon(int type, unsigned long max_pages); > +extern void swap_cgroup_swapoff(int type); > + > +#else > + > +static inline > +unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) > +{ > + return 0; > +} > + > +static inline > +unsigned short lookup_swap_cgroup_id(swp_entry_t ent) > +{ > + return 0; > +} > + > +static inline int > +swap_cgroup_swapon(int type, unsigned long max_pages) > +{ > + return 0; > +} > + > +static inline void swap_cgroup_swapoff(int type) > +{ > + return; > +} > + > +#endif /* CONFIG_MEMCG_SWAP */ > + > +#endif /* __LINUX_SWAP_CGROUP_H */ > diff --git a/mm/Makefile b/mm/Makefile > index 27ddb80403a9..d9d579484f15 100644 > --- a/mm/Makefile > +++ b/mm/Makefile > @@ -56,7 +56,8 @@ obj-$(CONFIG_MIGRATION) += migrate.o > obj-$(CONFIG_QUICKLIST) += quicklist.o > obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o > obj-$(CONFIG_PAGE_COUNTER) += page_counter.o > -obj-$(CONFIG_MEMCG) += memcontrol.o page_cgroup.o vmpressure.o > +obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o > +obj-$(CONFIG_MEMCG_SWAP) += swap_cgroup.o > obj-$(CONFIG_CGROUP_HUGETLB) += hugetlb_cgroup.o > obj-$(CONFIG_MEMORY_FAILURE) += memory-failure.o > obj-$(CONFIG_HWPOISON_INJECT) += hwpoison-inject.o > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index dc5e0abb18cb..fbb41a170eae 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -51,7 +51,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c > deleted file mode 100644 > index f0f31c1d4d0c.. > --- a/mm/page_cgroup.c > +++ /dev/null > @@ -1,211 +0,0 @@ > -#include > -#include > -#include > -#include > - >
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
On Sat 01-11-14 23:15:55, Johannes Weiner wrote: Now that the external page_cgroup data structure and its lookup is gone, the only code remaining in there is swap slot accounting. Rename it and move the conditional compilation into mm/Makefile. Signed-off-by: Johannes Weiner han...@cmpxchg.org Acked-by: Michal Hocko mho...@suse.cz --- MAINTAINERS | 2 +- include/linux/page_cgroup.h | 40 - include/linux/swap_cgroup.h | 42 + mm/Makefile | 3 +- mm/memcontrol.c | 2 +- mm/page_cgroup.c| 211 mm/swap_cgroup.c| 208 +++ mm/swap_state.c | 1 - mm/swapfile.c | 2 +- 9 files changed, 255 insertions(+), 256 deletions(-) delete mode 100644 include/linux/page_cgroup.h create mode 100644 include/linux/swap_cgroup.h delete mode 100644 mm/page_cgroup.c create mode 100644 mm/swap_cgroup.c diff --git a/MAINTAINERS b/MAINTAINERS index 7e31be07197e..3a60389d3a13 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2583,7 +2583,7 @@ L: cgro...@vger.kernel.org L: linux...@kvack.org S: Maintained F: mm/memcontrol.c -F: mm/page_cgroup.c +F: mm/swap_cgroup.c CORETEMP HARDWARE MONITORING DRIVER M: Fenghua Yu fenghua...@intel.com diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h deleted file mode 100644 index 65be35785c86.. --- a/include/linux/page_cgroup.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __LINUX_PAGE_CGROUP_H -#define __LINUX_PAGE_CGROUP_H - -#include linux/swap.h - -#ifdef CONFIG_MEMCG_SWAP -extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, - unsigned short old, unsigned short new); -extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); -extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); -extern int swap_cgroup_swapon(int type, unsigned long max_pages); -extern void swap_cgroup_swapoff(int type); -#else - -static inline -unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) -{ - return 0; -} - -static inline -unsigned short lookup_swap_cgroup_id(swp_entry_t ent) -{ - return 0; -} - -static inline int -swap_cgroup_swapon(int type, unsigned long max_pages) -{ - return 0; -} - -static inline void swap_cgroup_swapoff(int type) -{ - return; -} - -#endif /* CONFIG_MEMCG_SWAP */ - -#endif /* __LINUX_PAGE_CGROUP_H */ diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h new file mode 100644 index ..145306bdc92f --- /dev/null +++ b/include/linux/swap_cgroup.h @@ -0,0 +1,42 @@ +#ifndef __LINUX_SWAP_CGROUP_H +#define __LINUX_SWAP_CGROUP_H + +#include linux/swap.h + +#ifdef CONFIG_MEMCG_SWAP + +extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, + unsigned short old, unsigned short new); +extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); +extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); +extern int swap_cgroup_swapon(int type, unsigned long max_pages); +extern void swap_cgroup_swapoff(int type); + +#else + +static inline +unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) +{ + return 0; +} + +static inline +unsigned short lookup_swap_cgroup_id(swp_entry_t ent) +{ + return 0; +} + +static inline int +swap_cgroup_swapon(int type, unsigned long max_pages) +{ + return 0; +} + +static inline void swap_cgroup_swapoff(int type) +{ + return; +} + +#endif /* CONFIG_MEMCG_SWAP */ + +#endif /* __LINUX_SWAP_CGROUP_H */ diff --git a/mm/Makefile b/mm/Makefile index 27ddb80403a9..d9d579484f15 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -56,7 +56,8 @@ obj-$(CONFIG_MIGRATION) += migrate.o obj-$(CONFIG_QUICKLIST) += quicklist.o obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o obj-$(CONFIG_PAGE_COUNTER) += page_counter.o -obj-$(CONFIG_MEMCG) += memcontrol.o page_cgroup.o vmpressure.o +obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o +obj-$(CONFIG_MEMCG_SWAP) += swap_cgroup.o obj-$(CONFIG_CGROUP_HUGETLB) += hugetlb_cgroup.o obj-$(CONFIG_MEMORY_FAILURE) += memory-failure.o obj-$(CONFIG_HWPOISON_INJECT) += hwpoison-inject.o diff --git a/mm/memcontrol.c b/mm/memcontrol.c index dc5e0abb18cb..fbb41a170eae 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -51,7 +51,7 @@ #include linux/seq_file.h #include linux/vmpressure.h #include linux/mm_inline.h -#include linux/page_cgroup.h +#include linux/swap_cgroup.h #include linux/cpu.h #include linux/oom.h #include linux/lockdep.h diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c deleted file mode 100644 index f0f31c1d4d0c.. --- a/mm/page_cgroup.c +++ /dev/null @@ -1,211 +0,0 @@ -#include linux/mm.h
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
On Sat, Nov 01, 2014 at 11:15:55PM -0400, Johannes Weiner wrote: Now that the external page_cgroup data structure and its lookup is gone, the only code remaining in there is swap slot accounting. Rename it and move the conditional compilation into mm/Makefile. Signed-off-by: Johannes Weiner han...@cmpxchg.org Acked-by: Vladimir Davydov vdavy...@parallels.com -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
From: Johannes Weiner Date: Sat, 1 Nov 2014 23:15:55 -0400 > Now that the external page_cgroup data structure and its lookup is > gone, the only code remaining in there is swap slot accounting. > > Rename it and move the conditional compilation into mm/Makefile. > > Signed-off-by: Johannes Weiner Acked-by: David S. Miller -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
From: Johannes Weiner han...@cmpxchg.org Date: Sat, 1 Nov 2014 23:15:55 -0400 Now that the external page_cgroup data structure and its lookup is gone, the only code remaining in there is swap slot accounting. Rename it and move the conditional compilation into mm/Makefile. Signed-off-by: Johannes Weiner han...@cmpxchg.org Acked-by: David S. Miller da...@davemloft.net -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
Now that the external page_cgroup data structure and its lookup is gone, the only code remaining in there is swap slot accounting. Rename it and move the conditional compilation into mm/Makefile. Signed-off-by: Johannes Weiner --- MAINTAINERS | 2 +- include/linux/page_cgroup.h | 40 - include/linux/swap_cgroup.h | 42 + mm/Makefile | 3 +- mm/memcontrol.c | 2 +- mm/page_cgroup.c| 211 mm/swap_cgroup.c| 208 +++ mm/swap_state.c | 1 - mm/swapfile.c | 2 +- 9 files changed, 255 insertions(+), 256 deletions(-) delete mode 100644 include/linux/page_cgroup.h create mode 100644 include/linux/swap_cgroup.h delete mode 100644 mm/page_cgroup.c create mode 100644 mm/swap_cgroup.c diff --git a/MAINTAINERS b/MAINTAINERS index 7e31be07197e..3a60389d3a13 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2583,7 +2583,7 @@ L:cgro...@vger.kernel.org L: linux...@kvack.org S: Maintained F: mm/memcontrol.c -F: mm/page_cgroup.c +F: mm/swap_cgroup.c CORETEMP HARDWARE MONITORING DRIVER M: Fenghua Yu diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h deleted file mode 100644 index 65be35785c86.. --- a/include/linux/page_cgroup.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __LINUX_PAGE_CGROUP_H -#define __LINUX_PAGE_CGROUP_H - -#include - -#ifdef CONFIG_MEMCG_SWAP -extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, - unsigned short old, unsigned short new); -extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); -extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); -extern int swap_cgroup_swapon(int type, unsigned long max_pages); -extern void swap_cgroup_swapoff(int type); -#else - -static inline -unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) -{ - return 0; -} - -static inline -unsigned short lookup_swap_cgroup_id(swp_entry_t ent) -{ - return 0; -} - -static inline int -swap_cgroup_swapon(int type, unsigned long max_pages) -{ - return 0; -} - -static inline void swap_cgroup_swapoff(int type) -{ - return; -} - -#endif /* CONFIG_MEMCG_SWAP */ - -#endif /* __LINUX_PAGE_CGROUP_H */ diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h new file mode 100644 index ..145306bdc92f --- /dev/null +++ b/include/linux/swap_cgroup.h @@ -0,0 +1,42 @@ +#ifndef __LINUX_SWAP_CGROUP_H +#define __LINUX_SWAP_CGROUP_H + +#include + +#ifdef CONFIG_MEMCG_SWAP + +extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, + unsigned short old, unsigned short new); +extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); +extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); +extern int swap_cgroup_swapon(int type, unsigned long max_pages); +extern void swap_cgroup_swapoff(int type); + +#else + +static inline +unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) +{ + return 0; +} + +static inline +unsigned short lookup_swap_cgroup_id(swp_entry_t ent) +{ + return 0; +} + +static inline int +swap_cgroup_swapon(int type, unsigned long max_pages) +{ + return 0; +} + +static inline void swap_cgroup_swapoff(int type) +{ + return; +} + +#endif /* CONFIG_MEMCG_SWAP */ + +#endif /* __LINUX_SWAP_CGROUP_H */ diff --git a/mm/Makefile b/mm/Makefile index 27ddb80403a9..d9d579484f15 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -56,7 +56,8 @@ obj-$(CONFIG_MIGRATION) += migrate.o obj-$(CONFIG_QUICKLIST) += quicklist.o obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o obj-$(CONFIG_PAGE_COUNTER) += page_counter.o -obj-$(CONFIG_MEMCG) += memcontrol.o page_cgroup.o vmpressure.o +obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o +obj-$(CONFIG_MEMCG_SWAP) += swap_cgroup.o obj-$(CONFIG_CGROUP_HUGETLB) += hugetlb_cgroup.o obj-$(CONFIG_MEMORY_FAILURE) += memory-failure.o obj-$(CONFIG_HWPOISON_INJECT) += hwpoison-inject.o diff --git a/mm/memcontrol.c b/mm/memcontrol.c index dc5e0abb18cb..fbb41a170eae 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c deleted file mode 100644 index f0f31c1d4d0c.. --- a/mm/page_cgroup.c +++ /dev/null @@ -1,211 +0,0 @@ -#include -#include -#include -#include - -#ifdef CONFIG_MEMCG_SWAP - -static DEFINE_MUTEX(swap_cgroup_mutex); -struct swap_cgroup_ctrl { - struct page **map; - unsigned long length; - spinlock_t lock; -}; - -static struct swap_cgroup_ctrl swap_cgroup_ctrl[MAX_SWAPFILES]; - -struct swap_cgroup { - unsigned short id; -}; -#define SC_PER_PAGE(PAGE_SIZE/sizeof(struct swap_cgroup)) -
[patch 2/3] mm: page_cgroup: rename file to mm/swap_cgroup.c
Now that the external page_cgroup data structure and its lookup is gone, the only code remaining in there is swap slot accounting. Rename it and move the conditional compilation into mm/Makefile. Signed-off-by: Johannes Weiner han...@cmpxchg.org --- MAINTAINERS | 2 +- include/linux/page_cgroup.h | 40 - include/linux/swap_cgroup.h | 42 + mm/Makefile | 3 +- mm/memcontrol.c | 2 +- mm/page_cgroup.c| 211 mm/swap_cgroup.c| 208 +++ mm/swap_state.c | 1 - mm/swapfile.c | 2 +- 9 files changed, 255 insertions(+), 256 deletions(-) delete mode 100644 include/linux/page_cgroup.h create mode 100644 include/linux/swap_cgroup.h delete mode 100644 mm/page_cgroup.c create mode 100644 mm/swap_cgroup.c diff --git a/MAINTAINERS b/MAINTAINERS index 7e31be07197e..3a60389d3a13 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2583,7 +2583,7 @@ L:cgro...@vger.kernel.org L: linux...@kvack.org S: Maintained F: mm/memcontrol.c -F: mm/page_cgroup.c +F: mm/swap_cgroup.c CORETEMP HARDWARE MONITORING DRIVER M: Fenghua Yu fenghua...@intel.com diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h deleted file mode 100644 index 65be35785c86.. --- a/include/linux/page_cgroup.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __LINUX_PAGE_CGROUP_H -#define __LINUX_PAGE_CGROUP_H - -#include linux/swap.h - -#ifdef CONFIG_MEMCG_SWAP -extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, - unsigned short old, unsigned short new); -extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); -extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); -extern int swap_cgroup_swapon(int type, unsigned long max_pages); -extern void swap_cgroup_swapoff(int type); -#else - -static inline -unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) -{ - return 0; -} - -static inline -unsigned short lookup_swap_cgroup_id(swp_entry_t ent) -{ - return 0; -} - -static inline int -swap_cgroup_swapon(int type, unsigned long max_pages) -{ - return 0; -} - -static inline void swap_cgroup_swapoff(int type) -{ - return; -} - -#endif /* CONFIG_MEMCG_SWAP */ - -#endif /* __LINUX_PAGE_CGROUP_H */ diff --git a/include/linux/swap_cgroup.h b/include/linux/swap_cgroup.h new file mode 100644 index ..145306bdc92f --- /dev/null +++ b/include/linux/swap_cgroup.h @@ -0,0 +1,42 @@ +#ifndef __LINUX_SWAP_CGROUP_H +#define __LINUX_SWAP_CGROUP_H + +#include linux/swap.h + +#ifdef CONFIG_MEMCG_SWAP + +extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, + unsigned short old, unsigned short new); +extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); +extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); +extern int swap_cgroup_swapon(int type, unsigned long max_pages); +extern void swap_cgroup_swapoff(int type); + +#else + +static inline +unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) +{ + return 0; +} + +static inline +unsigned short lookup_swap_cgroup_id(swp_entry_t ent) +{ + return 0; +} + +static inline int +swap_cgroup_swapon(int type, unsigned long max_pages) +{ + return 0; +} + +static inline void swap_cgroup_swapoff(int type) +{ + return; +} + +#endif /* CONFIG_MEMCG_SWAP */ + +#endif /* __LINUX_SWAP_CGROUP_H */ diff --git a/mm/Makefile b/mm/Makefile index 27ddb80403a9..d9d579484f15 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -56,7 +56,8 @@ obj-$(CONFIG_MIGRATION) += migrate.o obj-$(CONFIG_QUICKLIST) += quicklist.o obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o obj-$(CONFIG_PAGE_COUNTER) += page_counter.o -obj-$(CONFIG_MEMCG) += memcontrol.o page_cgroup.o vmpressure.o +obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o +obj-$(CONFIG_MEMCG_SWAP) += swap_cgroup.o obj-$(CONFIG_CGROUP_HUGETLB) += hugetlb_cgroup.o obj-$(CONFIG_MEMORY_FAILURE) += memory-failure.o obj-$(CONFIG_HWPOISON_INJECT) += hwpoison-inject.o diff --git a/mm/memcontrol.c b/mm/memcontrol.c index dc5e0abb18cb..fbb41a170eae 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -51,7 +51,7 @@ #include linux/seq_file.h #include linux/vmpressure.h #include linux/mm_inline.h -#include linux/page_cgroup.h +#include linux/swap_cgroup.h #include linux/cpu.h #include linux/oom.h #include linux/lockdep.h diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c deleted file mode 100644 index f0f31c1d4d0c.. --- a/mm/page_cgroup.c +++ /dev/null @@ -1,211 +0,0 @@ -#include linux/mm.h -#include linux/page_cgroup.h -#include linux/vmalloc.h -#include linux/swapops.h - -#ifdef CONFIG_MEMCG_SWAP - -static DEFINE_MUTEX(swap_cgroup_mutex); -struct swap_cgroup_ctrl { - struct page **map; -