From: wency@cn.fujitsu.com
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: rientjes@google.com, liuj97@gmail.com, len.brown@intel.com,
benh@kernel.crashing.org, paulus@samba.org,
minchan.kim@gmail.com, akpm@linux-foundation.org,
kosaki.motohiro@jp.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com,
Wen Congyang <wency@cn.fujitsu.com>
Subject: [PATCH v3 4/9] clear the memory to store struct page
Date: Fri, 19 Oct 2012 14:46:37 +0800 [thread overview]
Message-ID: <1350629202-9664-5-git-send-email-wency@cn.fujitsu.com> (raw)
In-Reply-To: <1350629202-9664-1-git-send-email-wency@cn.fujitsu.com>
From: Wen Congyang <wency@cn.fujitsu.com>
If sparse memory vmemmap is enabled, we can't free the memory to store
struct page when a memory device is hotremoved, because we may store
struct page in the memory to manage the memory which doesn't belong
to this memory device. When we hotadded this memory device again, we
will reuse this memory to store struct page, and struct page may
contain some obsolete information, and we will get bad-page state:
[ 59.611278] init_memory_mapping: [mem 0x80000000-0x9fffffff]
[ 59.637836] Built 2 zonelists in Node order, mobility grouping on. Total pages: 547617
[ 59.638739] Policy zone: Normal
[ 59.650840] BUG: Bad page state in process bash pfn:9b6dc
[ 59.651124] page:ffffea0002200020 count:0 mapcount:0 mapping: (null) index:0xfdfdfdfdfdfdfdfd
[ 59.651494] page flags: 0x2fdfdfdfd5df9fd(locked|referenced|uptodate|dirty|lru|active|slab|owner_priv_1|private|private_2|writeback|head|tail|swapcache|reclaim|swapbacked|unevictable|uncached|compound_lock)
[ 59.653604] Modules linked in: netconsole acpiphp pci_hotplug acpi_memhotplug loop kvm_amd kvm microcode tpm_tis tpm tpm_bios evdev psmouse serio_raw i2c_piix4 i2c_core parport_pc parport processor button thermal_sys ext3 jbd mbcache sg sr_mod cdrom ata_generic virtio_net ata_piix virtio_blk libata virtio_pci virtio_ring virtio scsi_mod
[ 59.656998] Pid: 988, comm: bash Not tainted 3.6.0-rc7-guest #12
[ 59.657172] Call Trace:
[ 59.657275] [<ffffffff810e9b30>] ? bad_page+0xb0/0x100
[ 59.657434] [<ffffffff810ea4c3>] ? free_pages_prepare+0xb3/0x100
[ 59.657610] [<ffffffff810ea668>] ? free_hot_cold_page+0x48/0x1a0
[ 59.657787] [<ffffffff8112cc08>] ? online_pages_range+0x68/0xa0
[ 59.657961] [<ffffffff8112cba0>] ? __online_page_increment_counters+0x10/0x10
[ 59.658162] [<ffffffff81045561>] ? walk_system_ram_range+0x101/0x110
[ 59.658346] [<ffffffff814c4f95>] ? online_pages+0x1a5/0x2b0
[ 59.658515] [<ffffffff8135663d>] ? __memory_block_change_state+0x20d/0x270
[ 59.658710] [<ffffffff81356756>] ? store_mem_state+0xb6/0xf0
[ 59.658878] [<ffffffff8119e482>] ? sysfs_write_file+0xd2/0x160
[ 59.659052] [<ffffffff8113769a>] ? vfs_write+0xaa/0x160
[ 59.659212] [<ffffffff81137977>] ? sys_write+0x47/0x90
[ 59.659371] [<ffffffff814e2f25>] ? async_page_fault+0x25/0x30
[ 59.659543] [<ffffffff814ea239>] ? system_call_fastpath+0x16/0x1b
[ 59.659720] Disabling lock debugging due to kernel taint
This patch clears the memory to store struct page to avoid unexpected error.
CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Reported-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
mm/sparse.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/mm/sparse.c b/mm/sparse.c
index fac95f2..0021265 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -638,7 +638,6 @@ static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
got_map_page:
ret = (struct page *)pfn_to_kaddr(page_to_pfn(page));
got_map_ptr:
- memset(ret, 0, memmap_size);
return ret;
}
@@ -760,6 +759,8 @@ int __meminit sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
goto out;
}
+ memset(memmap, 0, sizeof(struct page) * nr_pages);
+
ms->section_mem_map |= SECTION_MARKED_PRESENT;
ret = sparse_init_one_section(ms, section_nr, memmap, usemap);
--
1.7.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-10-19 6:41 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 6:46 [PATCH v3 0/9] bugfix for memory hotplug wency
2012-10-19 6:46 ` [PATCH v3 1/9] suppress "Device memoryX does not have a release() function" warning wency
2012-10-19 6:46 ` [PATCH v3 2/9] suppress "Device nodeX " wency
2012-10-19 6:53 ` KOSAKI Motohiro
2012-10-22 22:52 ` Andrew Morton
2012-10-22 23:00 ` Greg KH
2012-10-19 6:46 ` [PATCH v3 3/9] memory-hotplug: flush the work for the node when the node is offlined wency
2012-10-19 7:01 ` KOSAKI Motohiro
2012-10-19 7:28 ` Wen Congyang
2012-10-19 6:46 ` wency [this message]
2012-10-19 7:02 ` [PATCH v3 4/9] clear the memory to store struct page KOSAKI Motohiro
2012-10-26 9:44 ` Wen Congyang
2012-10-29 21:10 ` Andrew Morton
2012-10-30 2:18 ` Wen Congyang
2012-10-30 2:41 ` Andrew Morton
2012-10-30 2:48 ` Wen Congyang
2012-10-19 6:46 ` [PATCH v3 5/9] memory-hotplug: skip HWPoisoned page when offlining pages wency
2012-10-19 6:46 ` [PATCH v3 6/9] memory-hotplug: update mce_bad_pages when removing the memory wency
2012-10-19 7:06 ` KOSAKI Motohiro
2012-10-19 7:18 ` Wen Congyang
2012-10-19 6:46 ` [PATCH v3 7/9] memory-hotplug: auto offline page_cgroup when onlining memory block failed wency
2012-10-19 6:46 ` [PATCH v3 8/9] memory-hotplug: fix NR_FREE_PAGES mismatch wency
2012-10-19 7:41 ` KOSAKI Motohiro
2012-10-19 8:41 ` Wen Congyang
2012-10-19 6:46 ` [PATCH v3 9/9] memory-hotplug: allocate zone's pcp before onlining pages wency
2012-10-19 7:07 ` KOSAKI Motohiro
2012-10-19 8:06 ` [PATCH v3 0/9] bugfix for memory hotplug Yasuaki Ishimatsu
2012-10-19 8:19 ` Yasuaki Ishimatsu
2012-10-19 8:45 ` Wen Congyang
2012-10-19 9:39 ` Yasuaki Ishimatsu
2012-10-19 10:15 ` Wen Congyang
2012-10-22 22:38 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350629202-9664-5-git-send-email-wency@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuj97@gmail.com \
--cc=minchan.kim@gmail.com \
--cc=paulus@samba.org \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).