Commit bec8b6e9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "11 fixes"

MM fixes and one xz decompressor fix.

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  mm/debug.c: PageAnon() is true for PageKsm() pages
  mm/debug.c: __dump_page() prints an extra line
  mm/page_io.c: do not free shared swap slots
  mm/memory_hotplug: fix try_offline_node()
  mm,thp: recheck each page before collapsing file THP
  mm: slub: really fix slab walking for init_on_free
  mm: hugetlb: switch to css_tryget() in hugetlb_cgroup_charge_cgroup()
  mm: memcg: switch to css_tryget() in get_mem_cgroup_from_mm()
  lib/xz: fix XZ_DYNALLOC to avoid useless memory reallocations
  mm: fix trying to reclaim unevictable lru page when calling madvise_pageout
  mm: mempolicy: fix the wrong return value and potential pages leak of mbind
parents 6c9594bd 6855ac4a
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -872,3 +872,39 @@ int walk_memory_blocks(unsigned long start, unsigned long size,
	}
	return ret;
}

struct for_each_memory_block_cb_data {
	walk_memory_blocks_func_t func;
	void *arg;
};

static int for_each_memory_block_cb(struct device *dev, void *data)
{
	struct memory_block *mem = to_memory_block(dev);
	struct for_each_memory_block_cb_data *cb_data = data;

	return cb_data->func(mem, cb_data->arg);
}

/**
 * for_each_memory_block - walk through all present memory blocks
 *
 * @arg: argument passed to func
 * @func: callback for each memory block walked
 *
 * This function walks through all present memory blocks, calling func on
 * each memory block.
 *
 * In case func() returns an error, walking is aborted and the error is
 * returned.
 */
int for_each_memory_block(void *arg, walk_memory_blocks_func_t func)
{
	struct for_each_memory_block_cb_data cb_data = {
		.func = func,
		.arg = arg,
	};

	return bus_for_each_dev(&memory_subsys, NULL, &cb_data,
				for_each_memory_block_cb);
}
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ extern struct memory_block *find_memory_block(struct mem_section *);
typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *);
extern int walk_memory_blocks(unsigned long start, unsigned long size,
			      void *arg, walk_memory_blocks_func_t func);
extern int for_each_memory_block(void *arg, walk_memory_blocks_func_t func);
#define CONFIG_MEM_BLOCK_SIZE	(PAGES_PER_SECTION<<PAGE_SHIFT)
#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */

+1 −0
Original line number Diff line number Diff line
@@ -1146,6 +1146,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)

		if (DEC_IS_DYNALLOC(s->dict.mode)) {
			if (s->dict.allocated < s->dict.size) {
				s->dict.allocated = s->dict.size;
				vfree(s->dict.buf);
				s->dict.buf = vmalloc(s->dict.size);
				if (s->dict.buf == NULL) {
+17 −14
Original line number Diff line number Diff line
@@ -67,28 +67,31 @@ void __dump_page(struct page *page, const char *reason)
	 */
	mapcount = PageSlab(page) ? 0 : page_mapcount(page);

	pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx",
	if (PageCompound(page))
		pr_warn("page:%px refcount:%d mapcount:%d mapping:%px "
			"index:%#lx compound_mapcount: %d\n",
			page, page_ref_count(page), mapcount,
			page->mapping, page_to_pgoff(page),
			compound_mapcount(page));
	else
		pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n",
			page, page_ref_count(page), mapcount,
			page->mapping, page_to_pgoff(page));
	if (PageCompound(page))
		pr_cont(" compound_mapcount: %d", compound_mapcount(page));
	pr_cont("\n");
	if (PageAnon(page))
		pr_warn("anon ");
	else if (PageKsm(page))
		pr_warn("ksm ");
	if (PageKsm(page))
		pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
	else if (PageAnon(page))
		pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
	else if (mapping) {
		pr_warn("%ps ", mapping->a_ops);
		if (mapping->host && mapping->host->i_dentry.first) {
			struct dentry *dentry;
			dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
			pr_warn("name:\"%pd\" ", dentry);
		}
			pr_warn("%ps name:\"%pd\"\n", mapping->a_ops, dentry);
		} else
			pr_warn("%ps\n", mapping->a_ops);
		pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
	}
	BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);

	pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);

hex_only:
	print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
			sizeof(unsigned long), page,
+1 −1
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
again:
	rcu_read_lock();
	h_cg = hugetlb_cgroup_from_task(current);
	if (!css_tryget_online(&h_cg->css)) {
	if (!css_tryget(&h_cg->css)) {
		rcu_read_unlock();
		goto again;
	}
Loading