diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-28 19:55:46 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-28 19:55:46 -0500 |
| commit | f346b0becb1bc62e45495f9cdbae3eef35d0b635 (patch) | |
| tree | ae79f3dfb8e031da51d38f0f095f89d7d23f3643 /mm/kmemleak.c | |
| parent | 00d59fde8532b2d42e80909d2e58678755e04da9 (diff) | |
| parent | 0f4991e8fd48987ae476a92cdee6bfec4aff31b8 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton:
- large KASAN update to use arm's "software tag-based mode"
- a few misc things
- sh updates
- ocfs2 updates
- just about all of MM
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (167 commits)
kernel/fork.c: mark 'stack_vm_area' with __maybe_unused
memcg, oom: notify on oom killer invocation from the charge path
mm, swap: fix swapoff with KSM pages
include/linux/gfp.h: fix typo
mm/hmm: fix memremap.h, move dev_page_fault_t callback to hmm
hugetlbfs: Use i_mmap_rwsem to fix page fault/truncate race
hugetlbfs: use i_mmap_rwsem for more pmd sharing synchronization
memory_hotplug: add missing newlines to debugging output
mm: remove __hugepage_set_anon_rmap()
include/linux/vmstat.h: remove unused page state adjustment macro
mm/page_alloc.c: allow error injection
mm: migrate: drop unused argument of migrate_page_move_mapping()
blkdev: avoid migration stalls for blkdev pages
mm: migrate: provide buffer_migrate_page_norefs()
mm: migrate: move migrate_page_lock_buffers()
mm: migrate: lock buffers before migrate_page_move_mapping()
mm: migration: factor out code to compute expected number of page references
mm, page_alloc: enable pcpu_drain with zone capability
kmemleak: add config to select auto scan
mm/page_alloc.c: don't call kasan_free_pages() at deferred mem init
...
Diffstat (limited to 'mm/kmemleak.c')
| -rw-r--r-- | mm/kmemleak.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 877de4fa0720..f9d9dc250428 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
| @@ -1547,11 +1547,14 @@ static void kmemleak_scan(void) | |||
| 1547 | unsigned long pfn; | 1547 | unsigned long pfn; |
| 1548 | 1548 | ||
| 1549 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { | 1549 | for (pfn = start_pfn; pfn < end_pfn; pfn++) { |
| 1550 | struct page *page; | 1550 | struct page *page = pfn_to_online_page(pfn); |
| 1551 | 1551 | ||
| 1552 | if (!pfn_valid(pfn)) | 1552 | if (!page) |
| 1553 | continue; | ||
| 1554 | |||
| 1555 | /* only scan pages belonging to this node */ | ||
| 1556 | if (page_to_nid(page) != i) | ||
| 1553 | continue; | 1557 | continue; |
| 1554 | page = pfn_to_page(pfn); | ||
| 1555 | /* only scan if page is in use */ | 1558 | /* only scan if page is in use */ |
| 1556 | if (page_count(page) == 0) | 1559 | if (page_count(page) == 0) |
| 1557 | continue; | 1560 | continue; |
| @@ -1647,7 +1650,7 @@ static void kmemleak_scan(void) | |||
| 1647 | */ | 1650 | */ |
| 1648 | static int kmemleak_scan_thread(void *arg) | 1651 | static int kmemleak_scan_thread(void *arg) |
| 1649 | { | 1652 | { |
| 1650 | static int first_run = 1; | 1653 | static int first_run = IS_ENABLED(CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN); |
| 1651 | 1654 | ||
| 1652 | pr_info("Automatic memory scanning thread started\n"); | 1655 | pr_info("Automatic memory scanning thread started\n"); |
| 1653 | set_user_nice(current, 10); | 1656 | set_user_nice(current, 10); |
| @@ -2141,9 +2144,11 @@ static int __init kmemleak_late_init(void) | |||
| 2141 | return -ENOMEM; | 2144 | return -ENOMEM; |
| 2142 | } | 2145 | } |
| 2143 | 2146 | ||
| 2144 | mutex_lock(&scan_mutex); | 2147 | if (IS_ENABLED(CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN)) { |
| 2145 | start_scan_thread(); | 2148 | mutex_lock(&scan_mutex); |
| 2146 | mutex_unlock(&scan_mutex); | 2149 | start_scan_thread(); |
| 2150 | mutex_unlock(&scan_mutex); | ||
| 2151 | } | ||
| 2147 | 2152 | ||
| 2148 | pr_info("Kernel memory leak detector initialized\n"); | 2153 | pr_info("Kernel memory leak detector initialized\n"); |
| 2149 | 2154 | ||
