diff options
author | Vladimir Davydov <vdavydov@virtuozzo.com> | 2016-01-20 18:03:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-20 20:09:18 -0500 |
commit | 6f2cb2f17700a39567cf3e9a2e95041def5f3688 (patch) | |
tree | 886e9ec0034a1e2851307b86865f2f12379a4b9d | |
parent | eb01aaab43084f1c919ce66183fea005033351b9 (diff) |
swap.h: move memcg related stuff to the end of the file
The following patches will add more functions to the memcg section of
include/linux/swap.h. Some of them will need values defined below the
current location of the section. So let's move the section to the end of
the file. No functional changes intended.
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/swap.h | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 83b95f343ab1..c2bd163a5e7e 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -350,39 +350,7 @@ extern void check_move_unevictable_pages(struct page **, int nr_pages); | |||
350 | 350 | ||
351 | extern int kswapd_run(int nid); | 351 | extern int kswapd_run(int nid); |
352 | extern void kswapd_stop(int nid); | 352 | extern void kswapd_stop(int nid); |
353 | #ifdef CONFIG_MEMCG | ||
354 | static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) | ||
355 | { | ||
356 | /* root ? */ | ||
357 | if (mem_cgroup_disabled() || !memcg->css.parent) | ||
358 | return vm_swappiness; | ||
359 | |||
360 | return memcg->swappiness; | ||
361 | } | ||
362 | 353 | ||
363 | #else | ||
364 | static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | ||
365 | { | ||
366 | return vm_swappiness; | ||
367 | } | ||
368 | #endif | ||
369 | #ifdef CONFIG_MEMCG_SWAP | ||
370 | extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry); | ||
371 | extern int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry); | ||
372 | extern void mem_cgroup_uncharge_swap(swp_entry_t entry); | ||
373 | #else | ||
374 | static inline void mem_cgroup_swapout(struct page *page, swp_entry_t entry) | ||
375 | { | ||
376 | } | ||
377 | static inline int mem_cgroup_try_charge_swap(struct page *page, | ||
378 | swp_entry_t entry) | ||
379 | { | ||
380 | return 0; | ||
381 | } | ||
382 | static inline void mem_cgroup_uncharge_swap(swp_entry_t entry) | ||
383 | { | ||
384 | } | ||
385 | #endif | ||
386 | #ifdef CONFIG_SWAP | 354 | #ifdef CONFIG_SWAP |
387 | /* linux/mm/page_io.c */ | 355 | /* linux/mm/page_io.c */ |
388 | extern int swap_readpage(struct page *); | 356 | extern int swap_readpage(struct page *); |
@@ -561,5 +529,43 @@ static inline swp_entry_t get_swap_page(void) | |||
561 | } | 529 | } |
562 | 530 | ||
563 | #endif /* CONFIG_SWAP */ | 531 | #endif /* CONFIG_SWAP */ |
532 | |||
533 | #ifdef CONFIG_MEMCG | ||
534 | static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) | ||
535 | { | ||
536 | /* root ? */ | ||
537 | if (mem_cgroup_disabled() || !memcg->css.parent) | ||
538 | return vm_swappiness; | ||
539 | |||
540 | return memcg->swappiness; | ||
541 | } | ||
542 | |||
543 | #else | ||
544 | static inline int mem_cgroup_swappiness(struct mem_cgroup *mem) | ||
545 | { | ||
546 | return vm_swappiness; | ||
547 | } | ||
548 | #endif | ||
549 | |||
550 | #ifdef CONFIG_MEMCG_SWAP | ||
551 | extern void mem_cgroup_swapout(struct page *page, swp_entry_t entry); | ||
552 | extern int mem_cgroup_try_charge_swap(struct page *page, swp_entry_t entry); | ||
553 | extern void mem_cgroup_uncharge_swap(swp_entry_t entry); | ||
554 | #else | ||
555 | static inline void mem_cgroup_swapout(struct page *page, swp_entry_t entry) | ||
556 | { | ||
557 | } | ||
558 | |||
559 | static inline int mem_cgroup_try_charge_swap(struct page *page, | ||
560 | swp_entry_t entry) | ||
561 | { | ||
562 | return 0; | ||
563 | } | ||
564 | |||
565 | static inline void mem_cgroup_uncharge_swap(swp_entry_t entry) | ||
566 | { | ||
567 | } | ||
568 | #endif | ||
569 | |||
564 | #endif /* __KERNEL__*/ | 570 | #endif /* __KERNEL__*/ |
565 | #endif /* _LINUX_SWAP_H */ | 571 | #endif /* _LINUX_SWAP_H */ |