History

Merge branch 'akpm' (patches from Andrew)

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 ...

Linus Torvalds committed 7 years ago

Commit 8dcd1752 parents afe6fe7 fff0490213 files · +4918 −2315Browse files

Showing the changes to include/linux (27 of 213 files). Show all

Unified · Split

27 files
  1. include/linux/backing-dev.h +1 −1
  2. include/linux/balloon_compaction.h +13 −21
  3. include/linux/cgroup-defs.h +4 −0
  4. include/linux/compaction.h +3 −4
  5. include/linux/device.h +1 −1
  6. include/linux/frontswap.h +7 −0
  7. include/linux/fs.h +1 −1
  8. include/linux/gfp.h +15 −15
  9. include/linux/hugetlb.h +67 −3
  10. include/linux/kasan-checks.h +1 −1
  11. include/linux/kernfs.h +6 −0
  12. include/linux/ksm.h +7 −0
  13. include/linux/list.h +11 −0
  14. include/linux/memcontrol.h +43 −4
  15. include/linux/memory_hotplug.h +1 −1
  16. include/linux/mm.h +2 −1
  17. include/linux/mm_types.h +1 −1
  18. include/linux/mmzone.h +3 −5
  19. include/linux/nodemask.h +4 −4
  20. include/linux/page-flags.h +38 −6
  21. include/linux/pagemap.h +9 −22
  22. include/linux/poison.h +1 −1
  23. include/linux/sched.h +5 −0
  24. include/linux/sched/mm.h +40 −8
  25. include/linux/shmem_fs.h +2 −1
  26. include/linux/slub_def.h +6 −6
  27. include/linux/swap.h +2 −2
include/linux/backing-dev.h+1−1
@@ -365,7 +365,7 @@ unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie) · 364 unmodified lines
365365 rcu_read_lock();
366366
367367 /*
368− * Paired with store_release in inode_switch_wb_work_fn() and
368+ * Paired with store_release in inode_switch_wbs_work_fn() and
369369 * ensures that we see the new wb if we see cleared I_WB_SWITCH.
370370 */
371371 cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
include/linux/balloon_compaction.h+13−21
@@ -4,15 +4,18 @@ · 3 unmodified lines
44 *
55 * Common interface definitions for making balloon pages movable by compaction.
66 *
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.
1013 *
1114 * As the page isolation scanning step a compaction thread does is a lockless
1215 * procedure (from a page standpoint), it might bring some racy situations while
1316 * performing balloon page compaction. In order to sort out these racy scenarios
1417 * 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:
1619 *
1720 * i. when updating a balloon's page ->mapping element, strictly do it under
1821 * the following lock order, independently of the far superior
@@ -21,19 +24,8 @@ · 2 unmodified lines
2124 * +--spin_lock_irq(&b_dev_info->pages_lock);
2225 * ... page->mapping updates here ...
2326 *
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.
3729 *
3830 * The functions provided by this interface are placed to help on coping with
3931 * 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
10395 static inline void balloon_page_insert(struct balloon_dev_info *balloon,
10496 struct page *page)
10597 {
106− __SetPageBalloon(page);
98+ __SetPageOffline(page);
10799 __SetPageMovable(page, balloon->inode->i_mapping);
108100 set_page_private(page, (unsigned long)balloon);
109101 list_add(&page->lru, &balloon->pages);
@@ -119,7 +111,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon, · 9 unmodified lines
119111 */
120112 static inline void balloon_page_delete(struct page *page)
121113 {
122− __ClearPageBalloon(page);
114+ __ClearPageOffline(page);
123115 __ClearPageMovable(page);
124116 set_page_private(page, 0);
125117 /*
@@ -149,13 +141,13 @@ static inline gfp_t balloon_mapping_gfp_mask(void) · 23 unmodified lines
149141 static inline void balloon_page_insert(struct balloon_dev_info *balloon,
150142 struct page *page)
151143 {
152− __SetPageBalloon(page);
144+ __SetPageOffline(page);
153145 list_add(&page->lru, &balloon->pages);
154146 }
155147
156148 static inline void balloon_page_delete(struct page *page)
157149 {
158− __ClearPageBalloon(page);
150+ __ClearPageOffline(page);
159151 list_del(&page->lru);
160152 }
161153
include/linux/cgroup-defs.h+4−0
@@ -32,6 +32,7 @@ struct kernfs_node; · 31 unmodified lines
3232 struct kernfs_ops;
3333 struct kernfs_open_file;
3434 struct seq_file;
35+struct poll_table_struct;
3536
3637 #define MAX_CGROUP_TYPE_NAMELEN 32
3738 #define MAX_CGROUP_ROOT_NAMELEN 64
@@ -574,6 +575,9 @@ struct cftype { · 536 unmodified lines
574575 ssize_t (*write)(struct kernfs_open_file *of,
575576 char *buf, size_t nbytes, loff_t off);
576577
578+ __poll_t (*poll)(struct kernfs_open_file *of,
579+ struct poll_table_struct *pt);
580+
577581 #ifdef CONFIG_DEBUG_LOCK_ALLOC
578582 struct lock_class_key lockdep_key;
579583 #endif
include/linux/compaction.h+3−4
@@ -88,14 +88,13 @@ extern int sysctl_compact_memory; · 87 unmodified lines
8888 extern int sysctl_compaction_handler(struct ctl_table *table, int write,
8989 void __user *buffer, size_t *length, loff_t *ppos);
9090 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);
9391 extern int sysctl_compact_unevictable_allowed;
9492
9593 extern int fragmentation_index(struct zone *zone, unsigned int order);
9694 extern enum compact_result try_to_compact_pages(gfp_t gfp_mask,
9795 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);
9998 extern void reset_isolation_suitable(pg_data_t *pgdat);
10099 extern enum compact_result compaction_suitable(struct zone *zone, int order,
101100 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
227226
228227 #endif /* CONFIG_COMPACTION */
229228
230−#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
231229 struct node;
230+#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
232231 extern int compaction_register_node(struct node *node);
233232 extern void compaction_unregister_node(struct node *node);
234233
include/linux/device.h+1−1
@@ -1095,7 +1095,7 @@ static inline void set_dev_node(struct device *dev, int node) · 1094 unmodified lines
10951095 #else
10961096 static inline int dev_to_node(struct device *dev)
10971097 {
1098− return -1;
1098+ return NUMA_NO_NODE;
10991099 }
11001100 static inline void set_dev_node(struct device *dev, int node)
11011101 {
include/linux/frontswap.h+7−0
@@ -7,6 +7,13 @@ · 6 unmodified lines
77 #include <linux/bitops.h>
88 #include <linux/jump_label.h>
99
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+
1017 struct frontswap_ops {
1118 void (*init)(unsigned); /* this swap type was just swapon'ed */
1219 int (*store)(unsigned, pgoff_t, struct page *); /* store a page */
include/linux/fs.h+1−1
@@ -2091,7 +2091,7 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) · 2090 unmodified lines
20912091 * I_WB_SWITCH Cgroup bdi_writeback switching in progress. Used to
20922092 * synchronize competing switching instances and to tell
20932093 * 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.
20952095 *
20962096 * I_OVL_INUSE Used by overlayfs to get exclusive ownership on upper
20972097 * and work dirs among overlayfs mounts.
include/linux/gfp.h+15−15
@@ -24,21 +24,21 @@ struct vm_area_struct; · 23 unmodified lines
2424 #define ___GFP_HIGH 0x20u
2525 #define ___GFP_IO 0x40u
2626 #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
4242 #ifdef CONFIG_LOCKDEP
4343 #define ___GFP_NOLOCKDEP 0x800000u
4444 #else
include/linux/hugetlb.h+67−3
@@ -371,6 +371,8 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, · 370 unmodified lines
371371 nodemask_t *nmask);
372372 struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
373373 unsigned long address);
374+struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask,
375+ int nid, nodemask_t *nmask);
374376 int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
375377 pgoff_t idx);
376378
@@ -493,17 +495,54 @@ static inline pgoff_t basepage_index(struct page *page) · 116 unmodified lines
493495 extern int dissolve_free_huge_page(struct page *page);
494496 extern int dissolve_free_huge_pages(unsigned long start_pfn,
495497 unsigned long end_pfn);
496−static inline bool hugepage_migration_supported(struct hstate *h)
497−{
498+
498499 #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
500+#ifndef arch_hugetlb_migration_supported
501+static inline bool arch_hugetlb_migration_supported(struct hstate *h)
502+{
499503 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))
501506 return true;
502507 else
503508 return false;
509+}
510+#endif
504511 #else
512+static inline bool arch_hugetlb_migration_supported(struct hstate *h)
513+{
505514 return false;
515+}
506516 #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;
507546 }
508547
509548 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
543582 set_huge_pte_at(mm, addr, ptep, pte);
544583 }
545584 #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+
546605 #else /* CONFIG_HUGETLB_PAGE */
547606 struct hstate {};
548607 #define alloc_huge_page(v, a, r) NULL
@@ -602,6 +661,11 @@ static inline bool hugepage_migration_supported(struct hstate *h) · 53 unmodified lines
602661 return false;
603662 }
604663
664+static inline bool hugepage_movable_supported(struct hstate *h)
665+{
666+ return false;
667+}
668+
605669 static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
606670 struct mm_struct *mm, pte_t *pte)
607671 {
include/linux/kasan-checks.h+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 #ifndef _LINUX_KASAN_CHECKS_H
33 #define _LINUX_KASAN_CHECKS_H
44
5−#ifdef CONFIG_KASAN
5+#if defined(__SANITIZE_ADDRESS__) || defined(__KASAN_INTERNAL)
66 void kasan_check_read(const volatile void *p, unsigned int size);
77 void kasan_check_write(const volatile void *p, unsigned int size);
88 #else
include/linux/kernfs.h+6−0
@@ -25,6 +25,7 @@ struct seq_file; · 24 unmodified lines
2525 struct vm_area_struct;
2626 struct super_block;
2727 struct file_system_type;
28+struct poll_table_struct;
2829
2930 struct kernfs_open_node;
3031 struct kernfs_iattrs;
@@ -261,6 +262,9 @@ struct kernfs_ops { · 230 unmodified lines
261262 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
262263 loff_t off);
263264
265+ __poll_t (*poll)(struct kernfs_open_file *of,
266+ struct poll_table_struct *pt);
267+
264268 int (*mmap)(struct kernfs_open_file *of, struct vm_area_struct *vma);
265269
266270 #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
350354 int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
351355 const char *new_name, const void *new_ns);
352356 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);
353359 void kernfs_notify(struct kernfs_node *kn);
354360
355361 const void *kernfs_super_ns(struct super_block *sb);
include/linux/ksm.h+7−0
@@ -53,6 +53,8 @@ struct page *ksm_might_need_to_copy(struct page *page, · 52 unmodified lines
5353
5454 void rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc);
5555 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);
5658
5759 #else /* !CONFIG_KSM */
5860
@@ -86,6 +88,11 @@ static inline void rmap_walk_ksm(struct page *page, · 27 unmodified lines
8688 static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
8789 {
8890 }
91+static inline bool reuse_ksm_page(struct page *page,
92+ struct vm_area_struct *vma, unsigned long address)
93+{
94+ return false;
95+}
8996 #endif /* CONFIG_MMU */
9097 #endif /* !CONFIG_KSM */
9198
include/linux/list.h+11−0
@@ -206,6 +206,17 @@ static inline void list_bulk_move_tail(struct list_head *head, · 205 unmodified lines
206206 head->prev = last;
207207 }
208208
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+
209220 /**
210221 * list_is_last - tests whether @list is the last entry in list @head
211222 * @list: the entry to test
include/linux/memcontrol.h+43−4
@@ -429,6 +429,11 @@ static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) · 428 unmodified lines
429429 }
430430 struct mem_cgroup *mem_cgroup_from_id(unsigned short id);
431431
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+
432437 static inline struct mem_cgroup *lruvec_memcg(struct lruvec *lruvec)
433438 {
434439 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
937942 return NULL;
938943 }
939944
945+static inline struct mem_cgroup *mem_cgroup_from_seq(struct seq_file *m)
946+{
947+ return NULL;
948+}
949+
940950 static inline struct mem_cgroup *lruvec_memcg(struct lruvec *lruvec)
941951 {
942952 return NULL;
@@ -1273,12 +1283,12 @@ static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) · 330 unmodified lines
12731283
12741284 struct kmem_cache *memcg_kmem_get_cache(struct kmem_cache *cachep);
12751285 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);
12781286
12791287 #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);
12821292
12831293 extern struct static_key_false memcg_kmem_enabled_key;
12841294 extern struct workqueue_struct *memcg_kmem_cache_wq;
@@ -1300,6 +1310,26 @@ static inline bool memcg_kmem_enabled(void) · 15 unmodified lines
13001310 return static_branch_unlikely(&memcg_kmem_enabled_key);
13011311 }
13021312
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+}
13031333 /*
13041334 * helper for accessing a memcg's index. It will be used as an index in the
13051335 * 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
13251355 {
13261356 }
13271357
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+
13281367 #define for_each_memcg_cache_index(_idx) \
13291368 for (; NULL; )
13301369
include/linux/memory_hotplug.h+1−1
@@ -89,7 +89,7 @@ extern int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, · 88 unmodified lines
8989 unsigned long *valid_start, unsigned long *valid_end);
9090 extern void __offline_isolated_pages(unsigned long, unsigned long);
9191
92−typedef void (*online_page_callback_t)(struct page *page);
92+typedef void (*online_page_callback_t)(struct page *page, unsigned int order);
9393
9494 extern int set_online_page_callback(online_page_callback_t callback);
9595 extern int restore_online_page_callback(online_page_callback_t callback);
include/linux/mm.h+2−1
@@ -1536,7 +1536,8 @@ long get_user_pages_locked(unsigned long start, unsigned long nr_pages, · 1535 unmodified lines
15361536 unsigned int gup_flags, struct page **pages, int *locked);
15371537 long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
15381538 struct page **pages, unsigned int gup_flags);
1539−#ifdef CONFIG_FS_DAX
1539+
1540+#if defined(CONFIG_FS_DAX) || defined(CONFIG_CMA)
15401541 long get_user_pages_longterm(unsigned long start, unsigned long nr_pages,
15411542 unsigned int gup_flags, struct page **pages,
15421543 struct vm_area_struct **vmas);
include/linux/mm_types.h+1−1
@@ -80,7 +80,7 @@ struct page { · 79 unmodified lines
8080 struct { /* Page cache and anonymous pages */
8181 /**
8282 * @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
8484 * by the page owner.
8585 */
8686 struct list_head lru;
include/linux/mmzone.h+3−5
@@ -480,6 +480,8 @@ struct zone { · 479 unmodified lines
480480 unsigned long compact_cached_free_pfn;
481481 /* pfn where async and sync compaction migration scanner should start */
482482 unsigned long compact_cached_migrate_pfn[2];
483+ unsigned long compact_init_migrate_pfn;
484+ unsigned long compact_init_free_pfn;
483485 #endif
484486
485487 #ifdef CONFIG_COMPACTION
@@ -728,10 +730,6 @@ typedef struct pglist_data { · 242 unmodified lines
728730
729731 #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
730732 #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−}
735733
736734 static inline struct lruvec *node_lruvec(struct pglist_data *pgdat)
737735 {
@@ -1299,7 +1297,7 @@ void memory_present(int nid, unsigned long start, unsigned long end); · 561 unmodified lines
12991297
13001298 /*
13011299 * 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.
13031301 * pfn_valid_within() should be used in this case; we optimise this away
13041302 * when we have no holes within a MAX_ORDER_NR_PAGES block.
13051303 */
include/linux/nodemask.h+4−4
@@ -444,8 +444,8 @@ static inline int next_memory_node(int nid) · 443 unmodified lines
444444 return next_node(nid, node_states[N_MEMORY]);
445445 }
446446
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;
449449
450450 static inline void node_set_online(int nid)
451451 {
@@ -485,8 +485,8 @@ static inline int num_node_state(enum node_states state) · 33 unmodified lines
485485 #define first_online_node 0
486486 #define first_memory_node 0
487487 #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
490490
491491 #define node_set_online(node) node_set_state((node), N_ONLINE)
492492 #define node_set_offline(node) node_clear_state((node), N_ONLINE)
include/linux/page-flags.h+38−6
@@ -17,8 +17,37 @@ · 16 unmodified lines
1717 /*
1818 * Various page->flags bits:
1919 *
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.
2251 *
2352 * The PG_private bitflag is set on pagecache pages if they contain filesystem
2453 * specific data (which is normally at page->private). It can be used by
@@ -671,7 +700,7 @@ PAGEFLAG_FALSE(DoubleMap) · 646 unmodified lines
671700 /* Reserve 0x0000007f to catch underflows of page_mapcount */
672701 #define PAGE_MAPCOUNT_RESERVE -128
673702 #define PG_buddy 0x00000080
674−#define PG_balloon 0x00000100
703+#define PG_offline 0x00000100
675704 #define PG_kmemcg 0x00000200
676705 #define PG_table 0x00000400
677706
@@ -706,10 +735,13 @@ static __always_inline void __ClearPage##uname(struct page *page) \ · 28 unmodified lines
706735 PAGE_TYPE_OPS(Buddy, buddy)
707736
708737 /*
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.
711743 */
712−PAGE_TYPE_OPS(Balloon, balloon)
744+PAGE_TYPE_OPS(Offline, offline)
713745
714746 /*
715747 * If kmemcg is enabled, the buddy allocator will set PageKmemcg() on
include/linux/pagemap.h+9−22
@@ -164,7 +164,7 @@ void release_pages(struct page **pages, int nr); · 163 unmodified lines
164164 * will find the page or it will not. Likewise, the old find_get_page could run
165165 * either before the insertion or afterwards, depending on timing.
166166 */
167−static inline int page_cache_get_speculative(struct page *page)
167+static inline int __page_cache_add_speculative(struct page *page, int count)
168168 {
169169 #ifdef CONFIG_TINY_RCU
170170 # ifdef CONFIG_PREEMPT_COUNT
@@ -180,10 +180,10 @@ static inline int page_cache_get_speculative(struct page *page) · 9 unmodified lines
180180 * SMP requires.
181181 */
182182 VM_BUG_ON_PAGE(page_count(page) == 0, page);
183− page_ref_inc(page);
183+ page_ref_add(page, count);
184184
185185 #else
186− if (unlikely(!get_page_unless_zero(page))) {
186+ if (unlikely(!page_ref_add_unless(page, count, 0))) {
187187 /*
188188 * Either the page has been freed, or will be freed.
189189 * 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
197197 return 1;
198198 }
199199
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)
204201 {
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+}
219204
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);
221208 }
222209
223210 #ifdef CONFIG_NUMA
include/linux/poison.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 */
3131 #define TIMER_ENTRY_STATIC ((void *) 0x300 + POISON_POINTER_DELTA)
3232
33−/********** mm/debug-pagealloc.c **********/
33+/********** mm/page_poison.c **********/
3434 #ifdef CONFIG_PAGE_POISONING_ZERO
3535 #define PAGE_POISON 0x00
3636 #else
include/linux/sched.h+5−0
@@ -48,6 +48,7 @@ struct pid_namespace; · 47 unmodified lines
4848 struct pipe_inode_info;
4949 struct rcu_node;
5050 struct reclaim_state;
51+struct capture_control;
5152 struct robust_list_head;
5253 struct sched_attr;
5354 struct sched_param;
@@ -950,6 +951,9 @@ struct task_struct { · 896 unmodified lines
950951
951952 struct io_context *io_context;
952953
954+#ifdef CONFIG_COMPACTION
955+ struct capture_control *capture_control;
956+#endif
953957 /* Ptrace state: */
954958 unsigned long ptrace_message;
955959 kernel_siginfo_t *last_siginfo;
@@ -1395,6 +1399,7 @@ extern struct pid *cad_pid; · 439 unmodified lines
13951399 #define PF_UMH 0x02000000 /* I'm an Usermodehelper process */
13961400 #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
13971401 #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 */
13981403 #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
13991404 #define PF_SUSPEND_TASK 0x80000000 /* This thread called freeze_processes() and should not be frozen */
14001405
include/linux/sched/mm.h+40−8
@@ -148,17 +148,25 @@ static inline bool in_vfork(struct task_struct *tsk) · 147 unmodified lines
148148 * Applies per-task gfp context to the given allocation flags.
149149 * PF_MEMALLOC_NOIO implies GFP_NOIO
150150 * PF_MEMALLOC_NOFS implies GFP_NOFS
151+ * PF_MEMALLOC_NOCMA implies no allocation from CMA region.
151152 */
152153 static inline gfp_t current_gfp_context(gfp_t flags)
153154 {
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+ }
162170 return flags;
163171 }
164172
@@ -248,6 +256,30 @@ static inline void memalloc_noreclaim_restore(unsigned int flags) · 83 unmodified lines
248256 current->flags = (current->flags & ~PF_MEMALLOC) | flags;
249257 }
250258
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+
251283 #ifdef CONFIG_MEMCG
252284 /**
253285 * memalloc_use_memcg - Starts the remote memcg charging scope.
include/linux/shmem_fs.h+2−1
@@ -72,7 +72,8 @@ extern void shmem_unlock_mapping(struct address_space *mapping); · 71 unmodified lines
7272 extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
7373 pgoff_t index, gfp_t gfp_mask);
7474 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);
7677
7778 extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
7879 extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
include/linux/slub_def.h+6−6
@@ -81,12 +81,12 @@ struct kmem_cache_order_objects { · 80 unmodified lines
8181 */
8282 struct kmem_cache {
8383 struct kmem_cache_cpu __percpu *cpu_slab;
84− /* Used for retriving partial slabs etc */
84+ /* Used for retrieving partial slabs, etc. */
8585 slab_flags_t flags;
8686 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 */
9090 #ifdef CONFIG_SLUB_CPU_PARTIAL
9191 /* Number of per cpu partial objects to keep around */
9292 unsigned int cpu_partial;
@@ -110,7 +110,7 @@ struct kmem_cache { · 17 unmodified lines
110110 #endif
111111 #ifdef CONFIG_MEMCG
112112 struct memcg_cache_params memcg_params;
113− /* for propagation, maximum size of a stored attr */
113+ /* For propagation, maximum size of a stored attr */
114114 unsigned int max_attr_size;
115115 #ifdef CONFIG_SYSFS
116116 struct kset *memcg_kset;
@@ -151,7 +151,7 @@ struct kmem_cache { · 34 unmodified lines
151151 #else
152152 #define slub_cpu_partial(s) (0)
153153 #define slub_set_cpu_partial(s, n)
154−#endif // CONFIG_SLUB_CPU_PARTIAL
154+#endif /* CONFIG_SLUB_CPU_PARTIAL */
155155
156156 #ifdef CONFIG_SYSFS
157157 #define SLAB_SUPPORTS_SYSFS
include/linux/swap.h+2−2
@@ -307,7 +307,7 @@ struct vma_swap_readahead { · 306 unmodified lines
307307 };
308308
309309 /* linux/mm/workingset.c */
310−void *workingset_eviction(struct address_space *mapping, struct page *page);
310+void *workingset_eviction(struct page *page);
311311 void workingset_refault(struct page *page, void *shadow);
312312 void workingset_activation(struct page *page);
313313
@@ -625,7 +625,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) · 311 unmodified lines
625625 return vm_swappiness;
626626
627627 /* root ? */
628− if (mem_cgroup_disabled() || !memcg->css.parent)
628+ if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg))
629629 return vm_swappiness;
630630
631631 return memcg->swappiness;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t