Merge misc updates from Andrew Morton: - a few misc things - ocfs2 updates - most of MM * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (159 commits) tools/testing/selftests/proc/proc-self-syscall.c: remove duplicate include proc: more robust bulk read test proc: test /proc/*/maps, smaps, smaps_rollup, statm proc: use seq_puts() everywhere proc: read kernel cpu stat pointer once proc: remove unused argument in proc_pid_lookup() fs/proc/thread_self.c: code cleanup for proc_setup_thread_self() fs/proc/self.c: code cleanup for proc_setup_self() proc: return exit code 4 for skipped tests mm,mremap: bail out earlier in mremap_to under map pressure mm/sparse: fix a bad comparison mm/memory.c: do_fault: avoid usage of stale vm_area_struct writeback: fix inode cgroup switching comment mm/huge_memory.c: fix "orig_pud" set but not used mm/hotplug: fix an imbalance with DEBUG_PAGEALLOC mm/memcontrol.c: fix bad line in comment mm/cma.c: cma_declare_contiguous: correct err handling mm/page_ext.c: fix an imbalance with kmemleak mm/compaction: pass pgdat to too_many_isolated() instead of zone mm: remove zone_lru_lock() function, access ->lru_lock directly ...
Showing the changes to include/linux (27 of 213 files). Show all
Unified · Split
| @@ -365,7 +365,7 @@ unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie) · 364 unmodified lines | ||
| 365 | 365 | rcu_read_lock(); |
| 366 | 366 | |
| 367 | 367 | /* |
| 368 | − * Paired with store_release in inode_switch_wb_work_fn() and | |
| 368 | + * Paired with store_release in inode_switch_wbs_work_fn() and | |
| 369 | 369 | * ensures that we see the new wb if we see cleared I_WB_SWITCH. |
| 370 | 370 | */ |
| 371 | 371 | cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH; |
| @@ -4,15 +4,18 @@ · 3 unmodified lines | ||
| 4 | 4 | * |
| 5 | 5 | * Common interface definitions for making balloon pages movable by compaction. |
| 6 | 6 | * |
| 7 | − * Despite being perfectly possible to perform ballooned pages migration, they | |
| 8 | − * make a special corner case to compaction scans because balloon pages are not | |
| 9 | − * enlisted at any LRU list like the other pages we do compact / migrate. | |
| 7 | + * Balloon page migration makes use of the general non-lru movable page | |
| 8 | + * feature. | |
| 9 | + * | |
| 10 | + * page->private is used to reference the responsible balloon device. | |
| 11 | + * page->mapping is used in context of non-lru page migration to reference | |
| 12 | + * the address space operations for page isolation/migration/compaction. | |
| 10 | 13 | * |
| 11 | 14 | * As the page isolation scanning step a compaction thread does is a lockless |
| 12 | 15 | * procedure (from a page standpoint), it might bring some racy situations while |
| 13 | 16 | * performing balloon page compaction. In order to sort out these racy scenarios |
| 14 | 17 | * and safely perform balloon's page compaction and migration we must, always, |
| 15 | − * ensure following these three simple rules: | |
| 18 | + * ensure following these simple rules: | |
| 16 | 19 | * |
| 17 | 20 | * i. when updating a balloon's page ->mapping element, strictly do it under |
| 18 | 21 | * the following lock order, independently of the far superior |
| @@ -21,19 +24,8 @@ · 2 unmodified lines | ||
| 21 | 24 | * +--spin_lock_irq(&b_dev_info->pages_lock); |
| 22 | 25 | * ... page->mapping updates here ... |
| 23 | 26 | * |
| 24 | − * ii. before isolating or dequeueing a balloon page from the balloon device | |
| 25 | − * pages list, the page reference counter must be raised by one and the | |
| 26 | − * extra refcount must be dropped when the page is enqueued back into | |
| 27 | − * the balloon device page list, thus a balloon page keeps its reference | |
| 28 | − * counter raised only while it is under our special handling; | |
| 29 | − * | |
| 30 | − * iii. after the lockless scan step have selected a potential balloon page for | |
| 31 | − * isolation, re-test the PageBalloon mark and the PagePrivate flag | |
| 32 | − * under the proper page lock, to ensure isolating a valid balloon page | |
| 33 | − * (not yet isolated, nor under release procedure) | |
| 34 | − * | |
| 35 | − * iv. isolation or dequeueing procedure must clear PagePrivate flag under | |
| 36 | − * page lock together with removing page from balloon device page list. | |
| 27 | + * ii. isolation or dequeueing procedure must remove the page from balloon | |
| 28 | + * device page list under b_dev_info->pages_lock. | |
| 37 | 29 | * |
| 38 | 30 | * The functions provided by this interface are placed to help on coping with |
| 39 | 31 | * the aforementioned balloon page corner case, as well as to ensure the simple |
| @@ -103,7 +95,7 @@ extern int balloon_page_migrate(struct address_space *mapping, · 63 unmodified lines | ||
| 103 | 95 | static inline void balloon_page_insert(struct balloon_dev_info *balloon, |
| 104 | 96 | struct page *page) |
| 105 | 97 | { |
| 106 | − __SetPageBalloon(page); | |
| 98 | + __SetPageOffline(page); | |
| 107 | 99 | __SetPageMovable(page, balloon->inode->i_mapping); |
| 108 | 100 | set_page_private(page, (unsigned long)balloon); |
| 109 | 101 | list_add(&page->lru, &balloon->pages); |
| @@ -119,7 +111,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon, · 9 unmodified lines | ||
| 119 | 111 | */ |
| 120 | 112 | static inline void balloon_page_delete(struct page *page) |
| 121 | 113 | { |
| 122 | − __ClearPageBalloon(page); | |
| 114 | + __ClearPageOffline(page); | |
| 123 | 115 | __ClearPageMovable(page); |
| 124 | 116 | set_page_private(page, 0); |
| 125 | 117 | /* |
| @@ -149,13 +141,13 @@ static inline gfp_t balloon_mapping_gfp_mask(void) · 23 unmodified lines | ||
| 149 | 141 | static inline void balloon_page_insert(struct balloon_dev_info *balloon, |
| 150 | 142 | struct page *page) |
| 151 | 143 | { |
| 152 | − __SetPageBalloon(page); | |
| 144 | + __SetPageOffline(page); | |
| 153 | 145 | list_add(&page->lru, &balloon->pages); |
| 154 | 146 | } |
| 155 | 147 | |
| 156 | 148 | static inline void balloon_page_delete(struct page *page) |
| 157 | 149 | { |
| 158 | − __ClearPageBalloon(page); | |
| 150 | + __ClearPageOffline(page); | |
| 159 | 151 | list_del(&page->lru); |
| 160 | 152 | } |
| 161 | 153 | |
| @@ -32,6 +32,7 @@ struct kernfs_node; · 31 unmodified lines | ||
| 32 | 32 | struct kernfs_ops; |
| 33 | 33 | struct kernfs_open_file; |
| 34 | 34 | struct seq_file; |
| 35 | +struct poll_table_struct; | |
| 35 | 36 | |
| 36 | 37 | #define MAX_CGROUP_TYPE_NAMELEN 32 |
| 37 | 38 | #define MAX_CGROUP_ROOT_NAMELEN 64 |
| @@ -574,6 +575,9 @@ struct cftype { · 536 unmodified lines | ||
| 574 | 575 | ssize_t (*write)(struct kernfs_open_file *of, |
| 575 | 576 | char *buf, size_t nbytes, loff_t off); |
| 576 | 577 | |
| 578 | + __poll_t (*poll)(struct kernfs_open_file *of, | |
| 579 | + struct poll_table_struct *pt); | |
| 580 | + | |
| 577 | 581 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 578 | 582 | struct lock_class_key lockdep_key; |
| 579 | 583 | #endif |
| @@ -88,14 +88,13 @@ extern int sysctl_compact_memory; · 87 unmodified lines | ||
| 88 | 88 | extern int sysctl_compaction_handler(struct ctl_table *table, int write, |
| 89 | 89 | void __user *buffer, size_t *length, loff_t *ppos); |
| 90 | 90 | extern int sysctl_extfrag_threshold; |
| 91 | −extern int sysctl_extfrag_handler(struct ctl_table *table, int write, | |
| 92 | − void __user *buffer, size_t *length, loff_t *ppos); | |
| 93 | 91 | extern int sysctl_compact_unevictable_allowed; |
| 94 | 92 | |
| 95 | 93 | extern int fragmentation_index(struct zone *zone, unsigned int order); |
| 96 | 94 | extern enum compact_result try_to_compact_pages(gfp_t gfp_mask, |
| 97 | 95 | unsigned int order, unsigned int alloc_flags, |
| 98 | − const struct alloc_context *ac, enum compact_priority prio); | |
| 96 | + const struct alloc_context *ac, enum compact_priority prio, | |
| 97 | + struct page **page); | |
| 99 | 98 | extern void reset_isolation_suitable(pg_data_t *pgdat); |
| 100 | 99 | extern enum compact_result compaction_suitable(struct zone *zone, int order, |
| 101 | 100 | unsigned int alloc_flags, int classzone_idx); |
| @@ -227,8 +226,8 @@ static inline void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_i · 125 unmodified lines | ||
| 227 | 226 | |
| 228 | 227 | #endif /* CONFIG_COMPACTION */ |
| 229 | 228 | |
| 230 | −#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA) | |
| 231 | 229 | struct node; |
| 230 | +#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA) | |
| 232 | 231 | extern int compaction_register_node(struct node *node); |
| 233 | 232 | extern void compaction_unregister_node(struct node *node); |
| 234 | 233 | |
| @@ -1095,7 +1095,7 @@ static inline void set_dev_node(struct device *dev, int node) · 1094 unmodified lines | ||
| 1095 | 1095 | #else |
| 1096 | 1096 | static inline int dev_to_node(struct device *dev) |
| 1097 | 1097 | { |
| 1098 | − return -1; | |
| 1098 | + return NUMA_NO_NODE; | |
| 1099 | 1099 | } |
| 1100 | 1100 | static inline void set_dev_node(struct device *dev, int node) |
| 1101 | 1101 | { |
| @@ -7,6 +7,13 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/bitops.h> |
| 8 | 8 | #include <linux/jump_label.h> |
| 9 | 9 | |
| 10 | +/* | |
| 11 | + * Return code to denote that requested number of | |
| 12 | + * frontswap pages are unused(moved to page cache). | |
| 13 | + * Used in in shmem_unuse and try_to_unuse. | |
| 14 | + */ | |
| 15 | +#define FRONTSWAP_PAGES_UNUSED 2 | |
| 16 | + | |
| 10 | 17 | struct frontswap_ops { |
| 11 | 18 | void (*init)(unsigned); /* this swap type was just swapon'ed */ |
| 12 | 19 | int (*store)(unsigned, pgoff_t, struct page *); /* store a page */ |
| @@ -2091,7 +2091,7 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) · 2090 unmodified lines | ||
| 2091 | 2091 | * I_WB_SWITCH Cgroup bdi_writeback switching in progress. Used to |
| 2092 | 2092 | * synchronize competing switching instances and to tell |
| 2093 | 2093 | * wb stat updates to grab the i_pages lock. See |
| 2094 | − * inode_switch_wb_work_fn() for details. | |
| 2094 | + * inode_switch_wbs_work_fn() for details. | |
| 2095 | 2095 | * |
| 2096 | 2096 | * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper |
| 2097 | 2097 | * and work dirs among overlayfs mounts. |
| @@ -24,21 +24,21 @@ struct vm_area_struct; · 23 unmodified lines | ||
| 24 | 24 | #define ___GFP_HIGH 0x20u |
| 25 | 25 | #define ___GFP_IO 0x40u |
| 26 | 26 | #define ___GFP_FS 0x80u |
| 27 | −#define ___GFP_WRITE 0x100u | |
| 28 | −#define ___GFP_NOWARN 0x200u | |
| 29 | −#define ___GFP_RETRY_MAYFAIL 0x400u | |
| 30 | −#define ___GFP_NOFAIL 0x800u | |
| 31 | −#define ___GFP_NORETRY 0x1000u | |
| 32 | −#define ___GFP_MEMALLOC 0x2000u | |
| 33 | −#define ___GFP_COMP 0x4000u | |
| 34 | −#define ___GFP_ZERO 0x8000u | |
| 35 | −#define ___GFP_NOMEMALLOC 0x10000u | |
| 36 | −#define ___GFP_HARDWALL 0x20000u | |
| 37 | −#define ___GFP_THISNODE 0x40000u | |
| 38 | −#define ___GFP_ATOMIC 0x80000u | |
| 39 | −#define ___GFP_ACCOUNT 0x100000u | |
| 40 | −#define ___GFP_DIRECT_RECLAIM 0x200000u | |
| 41 | −#define ___GFP_KSWAPD_RECLAIM 0x400000u | |
| 27 | +#define ___GFP_ZERO 0x100u | |
| 28 | +#define ___GFP_ATOMIC 0x200u | |
| 29 | +#define ___GFP_DIRECT_RECLAIM 0x400u | |
| 30 | +#define ___GFP_KSWAPD_RECLAIM 0x800u | |
| 31 | +#define ___GFP_WRITE 0x1000u | |
| 32 | +#define ___GFP_NOWARN 0x2000u | |
| 33 | +#define ___GFP_RETRY_MAYFAIL 0x4000u | |
| 34 | +#define ___GFP_NOFAIL 0x8000u | |
| 35 | +#define ___GFP_NORETRY 0x10000u | |
| 36 | +#define ___GFP_MEMALLOC 0x20000u | |
| 37 | +#define ___GFP_COMP 0x40000u | |
| 38 | +#define ___GFP_NOMEMALLOC 0x80000u | |
| 39 | +#define ___GFP_HARDWALL 0x100000u | |
| 40 | +#define ___GFP_THISNODE 0x200000u | |
| 41 | +#define ___GFP_ACCOUNT 0x400000u | |
| 42 | 42 | #ifdef CONFIG_LOCKDEP |
| 43 | 43 | #define ___GFP_NOLOCKDEP 0x800000u |
| 44 | 44 | #else |
| @@ -371,6 +371,8 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, · 370 unmodified lines | ||
| 371 | 371 | nodemask_t *nmask); |
| 372 | 372 | struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, |
| 373 | 373 | unsigned long address); |
| 374 | +struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, | |
| 375 | + int nid, nodemask_t *nmask); | |
| 374 | 376 | int huge_add_to_page_cache(struct page *page, struct address_space *mapping, |
| 375 | 377 | pgoff_t idx); |
| 376 | 378 | |
| @@ -493,17 +495,54 @@ static inline pgoff_t basepage_index(struct page *page) · 116 unmodified lines | ||
| 493 | 495 | extern int dissolve_free_huge_page(struct page *page); |
| 494 | 496 | extern int dissolve_free_huge_pages(unsigned long start_pfn, |
| 495 | 497 | unsigned long end_pfn); |
| 496 | −static inline bool hugepage_migration_supported(struct hstate *h) | |
| 497 | −{ | |
| 498 | + | |
| 498 | 499 | #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION |
| 500 | +#ifndef arch_hugetlb_migration_supported | |
| 501 | +static inline bool arch_hugetlb_migration_supported(struct hstate *h) | |
| 502 | +{ | |
| 499 | 503 | if ((huge_page_shift(h) == PMD_SHIFT) || |
| 500 | − (huge_page_shift(h) == PGDIR_SHIFT)) | |
| 504 | + (huge_page_shift(h) == PUD_SHIFT) || | |
| 505 | + (huge_page_shift(h) == PGDIR_SHIFT)) | |
| 501 | 506 | return true; |
| 502 | 507 | else |
| 503 | 508 | return false; |
| 509 | +} | |
| 510 | +#endif | |
| 504 | 511 | #else |
| 512 | +static inline bool arch_hugetlb_migration_supported(struct hstate *h) | |
| 513 | +{ | |
| 505 | 514 | return false; |
| 515 | +} | |
| 506 | 516 | #endif |
| 517 | + | |
| 518 | +static inline bool hugepage_migration_supported(struct hstate *h) | |
| 519 | +{ | |
| 520 | + return arch_hugetlb_migration_supported(h); | |
| 521 | +} | |
| 522 | + | |
| 523 | +/* | |
| 524 | + * Movability check is different as compared to migration check. | |
| 525 | + * It determines whether or not a huge page should be placed on | |
| 526 | + * movable zone or not. Movability of any huge page should be | |
| 527 | + * required only if huge page size is supported for migration. | |
| 528 | + * There wont be any reason for the huge page to be movable if | |
| 529 | + * it is not migratable to start with. Also the size of the huge | |
| 530 | + * page should be large enough to be placed under a movable zone | |
| 531 | + * and still feasible enough to be migratable. Just the presence | |
| 532 | + * in movable zone does not make the migration feasible. | |
| 533 | + * | |
| 534 | + * So even though large huge page sizes like the gigantic ones | |
| 535 | + * are migratable they should not be movable because its not | |
| 536 | + * feasible to migrate them from movable zone. | |
| 537 | + */ | |
| 538 | +static inline bool hugepage_movable_supported(struct hstate *h) | |
| 539 | +{ | |
| 540 | + if (!hugepage_migration_supported(h)) | |
| 541 | + return false; | |
| 542 | + | |
| 543 | + if (hstate_is_gigantic(h)) | |
| 544 | + return false; | |
| 545 | + return true; | |
| 507 | 546 | } |
| 508 | 547 | |
| 509 | 548 | static inline spinlock_t *huge_pte_lockptr(struct hstate *h, |
| @@ -543,6 +582,26 @@ static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr · 33 unmodified lines | ||
| 543 | 582 | set_huge_pte_at(mm, addr, ptep, pte); |
| 544 | 583 | } |
| 545 | 584 | #endif |
| 585 | + | |
| 586 | +#ifndef huge_ptep_modify_prot_start | |
| 587 | +#define huge_ptep_modify_prot_start huge_ptep_modify_prot_start | |
| 588 | +static inline pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, | |
| 589 | + unsigned long addr, pte_t *ptep) | |
| 590 | +{ | |
| 591 | + return huge_ptep_get_and_clear(vma->vm_mm, addr, ptep); | |
| 592 | +} | |
| 593 | +#endif | |
| 594 | + | |
| 595 | +#ifndef huge_ptep_modify_prot_commit | |
| 596 | +#define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit | |
| 597 | +static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, | |
| 598 | + unsigned long addr, pte_t *ptep, | |
| 599 | + pte_t old_pte, pte_t pte) | |
| 600 | +{ | |
| 601 | + set_huge_pte_at(vma->vm_mm, addr, ptep, pte); | |
| 602 | +} | |
| 603 | +#endif | |
| 604 | + | |
| 546 | 605 | #else /* CONFIG_HUGETLB_PAGE */ |
| 547 | 606 | struct hstate {}; |
| 548 | 607 | #define alloc_huge_page(v, a, r) NULL |
| @@ -602,6 +661,11 @@ static inline bool hugepage_migration_supported(struct hstate *h) · 53 unmodified lines | ||
| 602 | 661 | return false; |
| 603 | 662 | } |
| 604 | 663 | |
| 664 | +static inline bool hugepage_movable_supported(struct hstate *h) | |
| 665 | +{ | |
| 666 | + return false; | |
| 667 | +} | |
| 668 | + | |
| 605 | 669 | static inline spinlock_t *huge_pte_lockptr(struct hstate *h, |
| 606 | 670 | struct mm_struct *mm, pte_t *pte) |
| 607 | 671 | { |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef _LINUX_KASAN_CHECKS_H |
| 3 | 3 | #define _LINUX_KASAN_CHECKS_H |
| 4 | 4 | |
| 5 | −#ifdef CONFIG_KASAN | |
| 5 | +#if defined(__SANITIZE_ADDRESS__) || defined(__KASAN_INTERNAL) | |
| 6 | 6 | void kasan_check_read(const volatile void *p, unsigned int size); |
| 7 | 7 | void kasan_check_write(const volatile void *p, unsigned int size); |
| 8 | 8 | #else |
| @@ -25,6 +25,7 @@ struct seq_file; · 24 unmodified lines | ||
| 25 | 25 | struct vm_area_struct; |
| 26 | 26 | struct super_block; |
| 27 | 27 | struct file_system_type; |
| 28 | +struct poll_table_struct; | |
| 28 | 29 | |
| 29 | 30 | struct kernfs_open_node; |
| 30 | 31 | struct kernfs_iattrs; |
| @@ -261,6 +262,9 @@ struct kernfs_ops { · 230 unmodified lines | ||
| 261 | 262 | ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes, |
| 262 | 263 | loff_t off); |
| 263 | 264 | |
| 265 | + __poll_t (*poll)(struct kernfs_open_file *of, | |
| 266 | + struct poll_table_struct *pt); | |
| 267 | + | |
| 264 | 268 | int (*mmap)(struct kernfs_open_file *of, struct vm_area_struct *vma); |
| 265 | 269 | |
| 266 | 270 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| @@ -350,6 +354,8 @@ int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, · 83 unmodified lines | ||
| 350 | 354 | int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, |
| 351 | 355 | const char *new_name, const void *new_ns); |
| 352 | 356 | int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr); |
| 357 | +__poll_t kernfs_generic_poll(struct kernfs_open_file *of, | |
| 358 | + struct poll_table_struct *pt); | |
| 353 | 359 | void kernfs_notify(struct kernfs_node *kn); |
| 354 | 360 | |
| 355 | 361 | const void *kernfs_super_ns(struct super_block *sb); |
| @@ -53,6 +53,8 @@ struct page *ksm_might_need_to_copy(struct page *page, · 52 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc); |
| 55 | 55 | void ksm_migrate_page(struct page *newpage, struct page *oldpage); |
| 56 | +bool reuse_ksm_page(struct page *page, | |
| 57 | + struct vm_area_struct *vma, unsigned long address); | |
| 56 | 58 | |
| 57 | 59 | #else /* !CONFIG_KSM */ |
| 58 | 60 | |
| @@ -86,6 +88,11 @@ static inline void rmap_walk_ksm(struct page *page, · 27 unmodified lines | ||
| 86 | 88 | static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage) |
| 87 | 89 | { |
| 88 | 90 | } |
| 91 | +static inline bool reuse_ksm_page(struct page *page, | |
| 92 | + struct vm_area_struct *vma, unsigned long address) | |
| 93 | +{ | |
| 94 | + return false; | |
| 95 | +} | |
| 89 | 96 | #endif /* CONFIG_MMU */ |
| 90 | 97 | #endif /* !CONFIG_KSM */ |
| 91 | 98 | |
| @@ -206,6 +206,17 @@ static inline void list_bulk_move_tail(struct list_head *head, · 205 unmodified lines | ||
| 206 | 206 | head->prev = last; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | +/** | |
| 210 | + * list_is_first -- tests whether @ list is the first entry in list @head | |
| 211 | + * @list: the entry to test | |
| 212 | + * @head: the head of the list | |
| 213 | + */ | |
| 214 | +static inline int list_is_first(const struct list_head *list, | |
| 215 | + const struct list_head *head) | |
| 216 | +{ | |
| 217 | + return list->prev == head; | |
| 218 | +} | |
| 219 | + | |
| 209 | 220 | /** |
| 210 | 221 | * list_is_last - tests whether @list is the last entry in list @head |
| 211 | 222 | * @list: the entry to test |
| @@ -429,6 +429,11 @@ static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) · 428 unmodified lines | ||
| 429 | 429 | } |
| 430 | 430 | struct mem_cgroup *mem_cgroup_from_id(unsigned short id); |
| 431 | 431 | |
| 432 | +static inline struct mem_cgroup *mem_cgroup_from_seq(struct seq_file *m) | |
| 433 | +{ | |
| 434 | + return mem_cgroup_from_css(seq_css(m)); | |
| 435 | +} | |
| 436 | + | |
| 432 | 437 | static inline struct mem_cgroup *lruvec_memcg(struct lruvec *lruvec) |
| 433 | 438 | { |
| 434 | 439 | struct mem_cgroup_per_node *mz; |
| @@ -937,6 +942,11 @@ static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id) · 502 unmodified lines | ||
| 937 | 942 | return NULL; |
| 938 | 943 | } |
| 939 | 944 | |
| 945 | +static inline struct mem_cgroup *mem_cgroup_from_seq(struct seq_file *m) | |
| 946 | +{ | |
| 947 | + return NULL; | |
| 948 | +} | |
| 949 | + | |
| 940 | 950 | static inline struct mem_cgroup *lruvec_memcg(struct lruvec *lruvec) |
| 941 | 951 | { |
| 942 | 952 | return NULL; |
| @@ -1273,12 +1283,12 @@ static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) · 330 unmodified lines | ||
| 1273 | 1283 | |
| 1274 | 1284 | struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep); |
| 1275 | 1285 | void memcg_kmem_put_cache(struct kmem_cache *cachep); |
| 1276 | −int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, | |
| 1277 | − struct mem_cgroup *memcg); | |
| 1278 | 1286 | |
| 1279 | 1287 | #ifdef CONFIG_MEMCG_KMEM |
| 1280 | −int memcg_kmem_charge(struct page *page, gfp_t gfp, int order); | |
| 1281 | −void memcg_kmem_uncharge(struct page *page, int order); | |
| 1288 | +int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order); | |
| 1289 | +void __memcg_kmem_uncharge(struct page *page, int order); | |
| 1290 | +int __memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, int order, | |
| 1291 | + struct mem_cgroup *memcg); | |
| 1282 | 1292 | |
| 1283 | 1293 | extern struct static_key_false memcg_kmem_enabled_key; |
| 1284 | 1294 | extern struct workqueue_struct *memcg_kmem_cache_wq; |
| @@ -1300,6 +1310,26 @@ static inline bool memcg_kmem_enabled(void) · 15 unmodified lines | ||
| 1300 | 1310 | return static_branch_unlikely(&memcg_kmem_enabled_key); |
| 1301 | 1311 | } |
| 1302 | 1312 | |
| 1313 | +static inline int memcg_kmem_charge(struct page *page, gfp_t gfp, int order) | |
| 1314 | +{ | |
| 1315 | + if (memcg_kmem_enabled()) | |
| 1316 | + return __memcg_kmem_charge(page, gfp, order); | |
| 1317 | + return 0; | |
| 1318 | +} | |
| 1319 | + | |
| 1320 | +static inline void memcg_kmem_uncharge(struct page *page, int order) | |
| 1321 | +{ | |
| 1322 | + if (memcg_kmem_enabled()) | |
| 1323 | + __memcg_kmem_uncharge(page, order); | |
| 1324 | +} | |
| 1325 | + | |
| 1326 | +static inline int memcg_kmem_charge_memcg(struct page *page, gfp_t gfp, | |
| 1327 | + int order, struct mem_cgroup *memcg) | |
| 1328 | +{ | |
| 1329 | + if (memcg_kmem_enabled()) | |
| 1330 | + return __memcg_kmem_charge_memcg(page, gfp, order, memcg); | |
| 1331 | + return 0; | |
| 1332 | +} | |
| 1303 | 1333 | /* |
| 1304 | 1334 | * helper for accessing a memcg's index. It will be used as an index in the |
| 1305 | 1335 | * child cache array in kmem_cache, and also to derive its name. This function |
| @@ -1325,6 +1355,15 @@ static inline void memcg_kmem_uncharge(struct page *page, int order) · 19 unmodified lines | ||
| 1325 | 1355 | { |
| 1326 | 1356 | } |
| 1327 | 1357 | |
| 1358 | +static inline int __memcg_kmem_charge(struct page *page, gfp_t gfp, int order) | |
| 1359 | +{ | |
| 1360 | + return 0; | |
| 1361 | +} | |
| 1362 | + | |
| 1363 | +static inline void __memcg_kmem_uncharge(struct page *page, int order) | |
| 1364 | +{ | |
| 1365 | +} | |
| 1366 | + | |
| 1328 | 1367 | #define for_each_memcg_cache_index(_idx) \ |
| 1329 | 1368 | for (; NULL; ) |
| 1330 | 1369 | |
| @@ -89,7 +89,7 @@ extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, · 88 unmodified lines | ||
| 89 | 89 | unsigned long *valid_start, unsigned long *valid_end); |
| 90 | 90 | extern void __offline_isolated_pages(unsigned long, unsigned long); |
| 91 | 91 | |
| 92 | −typedef void (*online_page_callback_t)(struct page *page); | |
| 92 | +typedef void (*online_page_callback_t)(struct page *page, unsigned int order); | |
| 93 | 93 | |
| 94 | 94 | extern int set_online_page_callback(online_page_callback_t callback); |
| 95 | 95 | extern int restore_online_page_callback(online_page_callback_t callback); |
| @@ -1536,7 +1536,8 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages, · 1535 unmodified lines | ||
| 1536 | 1536 | unsigned int gup_flags, struct page **pages, int *locked); |
| 1537 | 1537 | long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, |
| 1538 | 1538 | struct page **pages, unsigned int gup_flags); |
| 1539 | −#ifdef CONFIG_FS_DAX | |
| 1539 | + | |
| 1540 | +#if defined(CONFIG_FS_DAX) || defined(CONFIG_CMA) | |
| 1540 | 1541 | long get_user_pages_longterm(unsigned long start, unsigned long nr_pages, |
| 1541 | 1542 | unsigned int gup_flags, struct page **pages, |
| 1542 | 1543 | struct vm_area_struct **vmas); |
| @@ -80,7 +80,7 @@ struct page { · 79 unmodified lines | ||
| 80 | 80 | struct { /* Page cache and anonymous pages */ |
| 81 | 81 | /** |
| 82 | 82 | * @lru: Pageout list, eg. active_list protected by |
| 83 | − * zone_lru_lock. Sometimes used as a generic list | |
| 83 | + * pgdat->lru_lock. Sometimes used as a generic list | |
| 84 | 84 | * by the page owner. |
| 85 | 85 | */ |
| 86 | 86 | struct list_head lru; |
| @@ -480,6 +480,8 @@ struct zone { · 479 unmodified lines | ||
| 480 | 480 | unsigned long compact_cached_free_pfn; |
| 481 | 481 | /* pfn where async and sync compaction migration scanner should start */ |
| 482 | 482 | unsigned long compact_cached_migrate_pfn[2]; |
| 483 | + unsigned long compact_init_migrate_pfn; | |
| 484 | + unsigned long compact_init_free_pfn; | |
| 483 | 485 | #endif |
| 484 | 486 | |
| 485 | 487 | #ifdef CONFIG_COMPACTION |
| @@ -728,10 +730,6 @@ typedef struct pglist_data { · 242 unmodified lines | ||
| 728 | 730 | |
| 729 | 731 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) |
| 730 | 732 | #define node_end_pfn(nid) pgdat_end_pfn(NODE_DATA(nid)) |
| 731 | −static inline spinlock_t *zone_lru_lock(struct zone *zone) | |
| 732 | −{ | |
| 733 | − return &zone->zone_pgdat->lru_lock; | |
| 734 | −} | |
| 735 | 733 | |
| 736 | 734 | static inline struct lruvec *node_lruvec(struct pglist_data *pgdat) |
| 737 | 735 | { |
| @@ -1299,7 +1297,7 @@ void memory_present(int nid, unsigned long start, unsigned long end); · 561 unmodified lines | ||
| 1299 | 1297 | |
| 1300 | 1298 | /* |
| 1301 | 1299 | * If it is possible to have holes within a MAX_ORDER_NR_PAGES, then we |
| 1302 | − * need to check pfn validility within that MAX_ORDER_NR_PAGES block. | |
| 1300 | + * need to check pfn validity within that MAX_ORDER_NR_PAGES block. | |
| 1303 | 1301 | * pfn_valid_within() should be used in this case; we optimise this away |
| 1304 | 1302 | * when we have no holes within a MAX_ORDER_NR_PAGES block. |
| 1305 | 1303 | */ |
| @@ -444,8 +444,8 @@ static inline int next_memory_node(int nid) · 443 unmodified lines | ||
| 444 | 444 | return next_node(nid, node_states[N_MEMORY]); |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | −extern int nr_node_ids; | |
| 448 | −extern int nr_online_nodes; | |
| 447 | +extern unsigned int nr_node_ids; | |
| 448 | +extern unsigned int nr_online_nodes; | |
| 449 | 449 | |
| 450 | 450 | static inline void node_set_online(int nid) |
| 451 | 451 | { |
| @@ -485,8 +485,8 @@ static inline int num_node_state(enum node_states state) · 33 unmodified lines | ||
| 485 | 485 | #define first_online_node 0 |
| 486 | 486 | #define first_memory_node 0 |
| 487 | 487 | #define next_online_node(nid) (MAX_NUMNODES) |
| 488 | −#define nr_node_ids 1 | |
| 489 | −#define nr_online_nodes 1 | |
| 488 | +#define nr_node_ids 1U | |
| 489 | +#define nr_online_nodes 1U | |
| 490 | 490 | |
| 491 | 491 | #define node_set_online(node) node_set_state((node), N_ONLINE) |
| 492 | 492 | #define node_set_offline(node) node_clear_state((node), N_ONLINE) |
| @@ -17,8 +17,37 @@ · 16 unmodified lines | ||
| 17 | 17 | /* |
| 18 | 18 | * Various page->flags bits: |
| 19 | 19 | * |
| 20 | − * PG_reserved is set for special pages, which can never be swapped out. Some | |
| 21 | − * of them might not even exist... | |
| 20 | + * PG_reserved is set for special pages. The "struct page" of such a page | |
| 21 | + * should in general not be touched (e.g. set dirty) except by its owner. | |
| 22 | + * Pages marked as PG_reserved include: | |
| 23 | + * - Pages part of the kernel image (including vDSO) and similar (e.g. BIOS, | |
| 24 | + * initrd, HW tables) | |
| 25 | + * - Pages reserved or allocated early during boot (before the page allocator | |
| 26 | + * was initialized). This includes (depending on the architecture) the | |
| 27 | + * initial vmemmap, initial page tables, crashkernel, elfcorehdr, and much | |
| 28 | + * much more. Once (if ever) freed, PG_reserved is cleared and they will | |
| 29 | + * be given to the page allocator. | |
| 30 | + * - Pages falling into physical memory gaps - not IORESOURCE_SYSRAM. Trying | |
| 31 | + * to read/write these pages might end badly. Don't touch! | |
| 32 | + * - The zero page(s) | |
| 33 | + * - Pages not added to the page allocator when onlining a section because | |
| 34 | + * they were excluded via the online_page_callback() or because they are | |
| 35 | + * PG_hwpoison. | |
| 36 | + * - Pages allocated in the context of kexec/kdump (loaded kernel image, | |
| 37 | + * control pages, vmcoreinfo) | |
| 38 | + * - MMIO/DMA pages. Some architectures don't allow to ioremap pages that are | |
| 39 | + * not marked PG_reserved (as they might be in use by somebody else who does | |
| 40 | + * not respect the caching strategy). | |
| 41 | + * - Pages part of an offline section (struct pages of offline sections should | |
| 42 | + * not be trusted as they will be initialized when first onlined). | |
| 43 | + * - MCA pages on ia64 | |
| 44 | + * - Pages holding CPU notes for POWER Firmware Assisted Dump | |
| 45 | + * - Device memory (e.g. PMEM, DAX, HMM) | |
| 46 | + * Some PG_reserved pages will be excluded from the hibernation image. | |
| 47 | + * PG_reserved does in general not hinder anybody from dumping or swapping | |
| 48 | + * and is no longer required for remap_pfn_range(). ioremap might require it. | |
| 49 | + * Consequently, PG_reserved for a page mapped into user space can indicate | |
| 50 | + * the zero page, the vDSO, MMIO pages or device memory. | |
| 22 | 51 | * |
| 23 | 52 | * The PG_private bitflag is set on pagecache pages if they contain filesystem |
| 24 | 53 | * specific data (which is normally at page->private). It can be used by |
| @@ -671,7 +700,7 @@ PAGEFLAG_FALSE(DoubleMap) · 646 unmodified lines | ||
| 671 | 700 | /* Reserve 0x0000007f to catch underflows of page_mapcount */ |
| 672 | 701 | #define PAGE_MAPCOUNT_RESERVE -128 |
| 673 | 702 | #define PG_buddy 0x00000080 |
| 674 | −#define PG_balloon 0x00000100 | |
| 703 | +#define PG_offline 0x00000100 | |
| 675 | 704 | #define PG_kmemcg 0x00000200 |
| 676 | 705 | #define PG_table 0x00000400 |
| 677 | 706 | |
| @@ -706,10 +735,13 @@ static __always_inline void __ClearPage##uname(struct page *page) \ · 28 unmodified lines | ||
| 706 | 735 | PAGE_TYPE_OPS(Buddy, buddy) |
| 707 | 736 | |
| 708 | 737 | /* |
| 709 | − * PageBalloon() is true for pages that are on the balloon page list | |
| 710 | − * (see mm/balloon_compaction.c). | |
| 738 | + * PageOffline() indicates that the page is logically offline although the | |
| 739 | + * containing section is online. (e.g. inflated in a balloon driver or | |
| 740 | + * not onlined when onlining the section). | |
| 741 | + * The content of these pages is effectively stale. Such pages should not | |
| 742 | + * be touched (read/write/dump/save) except by their owner. | |
| 711 | 743 | */ |
| 712 | −PAGE_TYPE_OPS(Balloon, balloon) | |
| 744 | +PAGE_TYPE_OPS(Offline, offline) | |
| 713 | 745 | |
| 714 | 746 | /* |
| 715 | 747 | * If kmemcg is enabled, the buddy allocator will set PageKmemcg() on |
| @@ -164,7 +164,7 @@ void release_pages(struct page **pages, int nr); · 163 unmodified lines | ||
| 164 | 164 | * will find the page or it will not. Likewise, the old find_get_page could run |
| 165 | 165 | * either before the insertion or afterwards, depending on timing. |
| 166 | 166 | */ |
| 167 | −static inline int page_cache_get_speculative(struct page *page) | |
| 167 | +static inline int __page_cache_add_speculative(struct page *page, int count) | |
| 168 | 168 | { |
| 169 | 169 | #ifdef CONFIG_TINY_RCU |
| 170 | 170 | # ifdef CONFIG_PREEMPT_COUNT |
| @@ -180,10 +180,10 @@ static inline int page_cache_get_speculative(struct page *page) · 9 unmodified lines | ||
| 180 | 180 | * SMP requires. |
| 181 | 181 | */ |
| 182 | 182 | VM_BUG_ON_PAGE(page_count(page) == 0, page); |
| 183 | − page_ref_inc(page); | |
| 183 | + page_ref_add(page, count); | |
| 184 | 184 | |
| 185 | 185 | #else |
| 186 | − if (unlikely(!get_page_unless_zero(page))) { | |
| 186 | + if (unlikely(!page_ref_add_unless(page, count, 0))) { | |
| 187 | 187 | /* |
| 188 | 188 | * Either the page has been freed, or will be freed. |
| 189 | 189 | * In either case, retry here and the caller should |
| @@ -197,27 +197,14 @@ static inline int page_cache_get_speculative(struct page *page) · 7 unmodified lines | ||
| 197 | 197 | return 1; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | −/* | |
| 201 | − * Same as above, but add instead of inc (could just be merged) | |
| 202 | − */ | |
| 203 | −static inline int page_cache_add_speculative(struct page *page, int count) | |
| 200 | +static inline int page_cache_get_speculative(struct page *page) | |
| 204 | 201 | { |
| 205 | − VM_BUG_ON(in_interrupt()); | |
| 206 | − | |
| 207 | −#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) | |
| 208 | −# ifdef CONFIG_PREEMPT_COUNT | |
| 209 | − VM_BUG_ON(!in_atomic() && !irqs_disabled()); | |
| 210 | −# endif | |
| 211 | − VM_BUG_ON_PAGE(page_count(page) == 0, page); | |
| 212 | − page_ref_add(page, count); | |
| 213 | − | |
| 214 | −#else | |
| 215 | − if (unlikely(!page_ref_add_unless(page, count, 0))) | |
| 216 | − return 0; | |
| 217 | −#endif | |
| 218 | − VM_BUG_ON_PAGE(PageCompound(page) && page != compound_head(page), page); | |
| 202 | + return __page_cache_add_speculative(page, 1); | |
| 203 | +} | |
| 219 | 204 | |
| 220 | − return 1; | |
| 205 | +static inline int page_cache_add_speculative(struct page *page, int count) | |
| 206 | +{ | |
| 207 | + return __page_cache_add_speculative(page, count); | |
| 221 | 208 | } |
| 222 | 209 | |
| 223 | 210 | #ifdef CONFIG_NUMA |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | */ |
| 31 | 31 | #define TIMER_ENTRY_STATIC ((void *) 0x300 + POISON_POINTER_DELTA) |
| 32 | 32 | |
| 33 | −/********** mm/debug-pagealloc.c **********/ | |
| 33 | +/********** mm/page_poison.c **********/ | |
| 34 | 34 | #ifdef CONFIG_PAGE_POISONING_ZERO |
| 35 | 35 | #define PAGE_POISON 0x00 |
| 36 | 36 | #else |
| @@ -48,6 +48,7 @@ struct pid_namespace; · 47 unmodified lines | ||
| 48 | 48 | struct pipe_inode_info; |
| 49 | 49 | struct rcu_node; |
| 50 | 50 | struct reclaim_state; |
| 51 | +struct capture_control; | |
| 51 | 52 | struct robust_list_head; |
| 52 | 53 | struct sched_attr; |
| 53 | 54 | struct sched_param; |
| @@ -950,6 +951,9 @@ struct task_struct { · 896 unmodified lines | ||
| 950 | 951 | |
| 951 | 952 | struct io_context *io_context; |
| 952 | 953 | |
| 954 | +#ifdef CONFIG_COMPACTION | |
| 955 | + struct capture_control *capture_control; | |
| 956 | +#endif | |
| 953 | 957 | /* Ptrace state: */ |
| 954 | 958 | unsigned long ptrace_message; |
| 955 | 959 | kernel_siginfo_t *last_siginfo; |
| @@ -1395,6 +1399,7 @@ extern struct pid *cad_pid; · 439 unmodified lines | ||
| 1395 | 1399 | #define PF_UMH 0x02000000 /* I'm an Usermodehelper process */ |
| 1396 | 1400 | #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ |
| 1397 | 1401 | #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ |
| 1402 | +#define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ | |
| 1398 | 1403 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ |
| 1399 | 1404 | #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */ |
| 1400 | 1405 | |
| @@ -148,17 +148,25 @@ static inline bool in_vfork(struct task_struct *tsk) · 147 unmodified lines | ||
| 148 | 148 | * Applies per-task gfp context to the given allocation flags. |
| 149 | 149 | * PF_MEMALLOC_NOIO implies GFP_NOIO |
| 150 | 150 | * PF_MEMALLOC_NOFS implies GFP_NOFS |
| 151 | + * PF_MEMALLOC_NOCMA implies no allocation from CMA region. | |
| 151 | 152 | */ |
| 152 | 153 | static inline gfp_t current_gfp_context(gfp_t flags) |
| 153 | 154 | { |
| 154 | − /* | |
| 155 | − * NOIO implies both NOIO and NOFS and it is a weaker context | |
| 156 | − * so always make sure it makes precedence | |
| 157 | − */ | |
| 158 | − if (unlikely(current->flags & PF_MEMALLOC_NOIO)) | |
| 159 | − flags &= ~(__GFP_IO | __GFP_FS); | |
| 160 | − else if (unlikely(current->flags & PF_MEMALLOC_NOFS)) | |
| 161 | − flags &= ~__GFP_FS; | |
| 155 | + if (unlikely(current->flags & | |
| 156 | + (PF_MEMALLOC_NOIO | PF_MEMALLOC_NOFS | PF_MEMALLOC_NOCMA))) { | |
| 157 | + /* | |
| 158 | + * NOIO implies both NOIO and NOFS and it is a weaker context | |
| 159 | + * so always make sure it makes precedence | |
| 160 | + */ | |
| 161 | + if (current->flags & PF_MEMALLOC_NOIO) | |
| 162 | + flags &= ~(__GFP_IO | __GFP_FS); | |
| 163 | + else if (current->flags & PF_MEMALLOC_NOFS) | |
| 164 | + flags &= ~__GFP_FS; | |
| 165 | +#ifdef CONFIG_CMA | |
| 166 | + if (current->flags & PF_MEMALLOC_NOCMA) | |
| 167 | + flags &= ~__GFP_MOVABLE; | |
| 168 | +#endif | |
| 169 | + } | |
| 162 | 170 | return flags; |
| 163 | 171 | } |
| 164 | 172 | |
| @@ -248,6 +256,30 @@ static inline void memalloc_noreclaim_restore(unsigned int flags) · 83 unmodified lines | ||
| 248 | 256 | current->flags = (current->flags & ~PF_MEMALLOC) | flags; |
| 249 | 257 | } |
| 250 | 258 | |
| 259 | +#ifdef CONFIG_CMA | |
| 260 | +static inline unsigned int memalloc_nocma_save(void) | |
| 261 | +{ | |
| 262 | + unsigned int flags = current->flags & PF_MEMALLOC_NOCMA; | |
| 263 | + | |
| 264 | + current->flags |= PF_MEMALLOC_NOCMA; | |
| 265 | + return flags; | |
| 266 | +} | |
| 267 | + | |
| 268 | +static inline void memalloc_nocma_restore(unsigned int flags) | |
| 269 | +{ | |
| 270 | + current->flags = (current->flags & ~PF_MEMALLOC_NOCMA) | flags; | |
| 271 | +} | |
| 272 | +#else | |
| 273 | +static inline unsigned int memalloc_nocma_save(void) | |
| 274 | +{ | |
| 275 | + return 0; | |
| 276 | +} | |
| 277 | + | |
| 278 | +static inline void memalloc_nocma_restore(unsigned int flags) | |
| 279 | +{ | |
| 280 | +} | |
| 281 | +#endif | |
| 282 | + | |
| 251 | 283 | #ifdef CONFIG_MEMCG |
| 252 | 284 | /** |
| 253 | 285 | * memalloc_use_memcg - Starts the remote memcg charging scope. |
| @@ -72,7 +72,8 @@ extern void shmem_unlock_mapping(struct address_space *mapping); · 71 unmodified lines | ||
| 72 | 72 | extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, |
| 73 | 73 | pgoff_t index, gfp_t gfp_mask); |
| 74 | 74 | extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); |
| 75 | −extern int shmem_unuse(swp_entry_t entry, struct page *page); | |
| 75 | +extern int shmem_unuse(unsigned int type, bool frontswap, | |
| 76 | + unsigned long *fs_pages_to_unuse); | |
| 76 | 77 | |
| 77 | 78 | extern unsigned long shmem_swap_usage(struct vm_area_struct *vma); |
| 78 | 79 | extern unsigned long shmem_partial_swap_usage(struct address_space *mapping, |
| @@ -81,12 +81,12 @@ struct kmem_cache_order_objects { · 80 unmodified lines | ||
| 81 | 81 | */ |
| 82 | 82 | struct kmem_cache { |
| 83 | 83 | struct kmem_cache_cpu __percpu *cpu_slab; |
| 84 | − /* Used for retriving partial slabs etc */ | |
| 84 | + /* Used for retrieving partial slabs, etc. */ | |
| 85 | 85 | slab_flags_t flags; |
| 86 | 86 | unsigned long min_partial; |
| 87 | − unsigned int size; /* The size of an object including meta data */ | |
| 88 | − unsigned int object_size;/* The size of an object without meta data */ | |
| 89 | − unsigned int offset; /* Free pointer offset. */ | |
| 87 | + unsigned int size; /* The size of an object including metadata */ | |
| 88 | + unsigned int object_size;/* The size of an object without metadata */ | |
| 89 | + unsigned int offset; /* Free pointer offset */ | |
| 90 | 90 | #ifdef CONFIG_SLUB_CPU_PARTIAL |
| 91 | 91 | /* Number of per cpu partial objects to keep around */ |
| 92 | 92 | unsigned int cpu_partial; |
| @@ -110,7 +110,7 @@ struct kmem_cache { · 17 unmodified lines | ||
| 110 | 110 | #endif |
| 111 | 111 | #ifdef CONFIG_MEMCG |
| 112 | 112 | struct memcg_cache_params memcg_params; |
| 113 | − /* for propagation, maximum size of a stored attr */ | |
| 113 | + /* For propagation, maximum size of a stored attr */ | |
| 114 | 114 | unsigned int max_attr_size; |
| 115 | 115 | #ifdef CONFIG_SYSFS |
| 116 | 116 | struct kset *memcg_kset; |
| @@ -151,7 +151,7 @@ struct kmem_cache { · 34 unmodified lines | ||
| 151 | 151 | #else |
| 152 | 152 | #define slub_cpu_partial(s) (0) |
| 153 | 153 | #define slub_set_cpu_partial(s, n) |
| 154 | −#endif // CONFIG_SLUB_CPU_PARTIAL | |
| 154 | +#endif /* CONFIG_SLUB_CPU_PARTIAL */ | |
| 155 | 155 | |
| 156 | 156 | #ifdef CONFIG_SYSFS |
| 157 | 157 | #define SLAB_SUPPORTS_SYSFS |
| @@ -307,7 +307,7 @@ struct vma_swap_readahead { · 306 unmodified lines | ||
| 307 | 307 | }; |
| 308 | 308 | |
| 309 | 309 | /* linux/mm/workingset.c */ |
| 310 | −void *workingset_eviction(struct address_space *mapping, struct page *page); | |
| 310 | +void *workingset_eviction(struct page *page); | |
| 311 | 311 | void workingset_refault(struct page *page, void *shadow); |
| 312 | 312 | void workingset_activation(struct page *page); |
| 313 | 313 | |
| @@ -625,7 +625,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) · 311 unmodified lines | ||
| 625 | 625 | return vm_swappiness; |
| 626 | 626 | |
| 627 | 627 | /* root ? */ |
| 628 | − if (mem_cgroup_disabled() || !memcg->css.parent) | |
| 628 | + if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg)) | |
| 629 | 629 | return vm_swappiness; |
| 630 | 630 | |
| 631 | 631 | return memcg->swappiness; |