Skip to content

Commit 75caf31

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "5 fixes" * emailed patches from Andrew Morton <[email protected]>: include/asm-generic/topology.h: guard cpumask_of_node() macro argument fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info() mm: remove VM_BUG_ON(PageSlab()) from page_mapcount() mm,thp: stop leaking unreleased file pages mm/z3fold: silence kmemleak false positives of slots
2 parents d16eea2 + 4377748 commit 75caf31

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

fs/binfmt_elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
17331733
(!regset->active || regset->active(t->task, regset) > 0)) {
17341734
int ret;
17351735
size_t size = regset_size(t->task, regset);
1736-
void *data = kmalloc(size, GFP_KERNEL);
1736+
void *data = kzalloc(size, GFP_KERNEL);
17371737
if (unlikely(!data))
17381738
return 0;
17391739
ret = regset->get(t->task, regset,

include/asm-generic/topology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#ifdef CONFIG_NEED_MULTIPLE_NODES
4949
#define cpumask_of_node(node) ((node) == 0 ? cpu_online_mask : cpu_none_mask)
5050
#else
51-
#define cpumask_of_node(node) ((void)node, cpu_online_mask)
51+
#define cpumask_of_node(node) ((void)(node), cpu_online_mask)
5252
#endif
5353
#endif
5454
#ifndef pcibus_to_node

include/linux/mm.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,11 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
782782

783783
extern void kvfree(const void *addr);
784784

785+
/*
786+
* Mapcount of compound page as a whole, does not include mapped sub-pages.
787+
*
788+
* Must be called only for compound pages or any their tail sub-pages.
789+
*/
785790
static inline int compound_mapcount(struct page *page)
786791
{
787792
VM_BUG_ON_PAGE(!PageCompound(page), page);
@@ -801,10 +806,16 @@ static inline void page_mapcount_reset(struct page *page)
801806

802807
int __page_mapcount(struct page *page);
803808

809+
/*
810+
* Mapcount of 0-order page; when compound sub-page, includes
811+
* compound_mapcount().
812+
*
813+
* Result is undefined for pages which cannot be mapped into userspace.
814+
* For example SLAB or special types of pages. See function page_has_type().
815+
* They use this place in struct page differently.
816+
*/
804817
static inline int page_mapcount(struct page *page)
805818
{
806-
VM_BUG_ON_PAGE(PageSlab(page), page);
807-
808819
if (unlikely(PageCompound(page)))
809820
return __page_mapcount(page);
810821
return atomic_read(&page->_mapcount) + 1;

mm/khugepaged.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,7 @@ static void collapse_file(struct mm_struct *mm,
16921692
if (page_has_private(page) &&
16931693
!try_to_release_page(page, GFP_KERNEL)) {
16941694
result = SCAN_PAGE_HAS_PRIVATE;
1695+
putback_lru_page(page);
16951696
goto out_unlock;
16961697
}
16971698

mm/z3fold.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <linux/spinlock.h>
4444
#include <linux/zpool.h>
4545
#include <linux/magic.h>
46+
#include <linux/kmemleak.h>
4647

4748
/*
4849
* NCHUNKS_ORDER determines the internal allocation granularity, effectively
@@ -215,6 +216,8 @@ static inline struct z3fold_buddy_slots *alloc_slots(struct z3fold_pool *pool,
215216
(gfp & ~(__GFP_HIGHMEM | __GFP_MOVABLE)));
216217

217218
if (slots) {
219+
/* It will be freed separately in free_handle(). */
220+
kmemleak_not_leak(slots);
218221
memset(slots->slot, 0, sizeof(slots->slot));
219222
slots->pool = (unsigned long)pool;
220223
rwlock_init(&slots->lock);

0 commit comments

Comments
 (0)