Wanpeng Li
3ba5eebc40
mm/memory-failure.c: fix bug triggered by unpoisoning empty zero page
...
Injecting memory failure for page 0x19d0 at 0xb77d2000
MCE 0x19d0: non LRU page recovery: Ignored
MCE: Software-unpoisoned page 0x19d0
BUG: Bad page state in process bash pfn:019d0
page:f3461a00 count:0 mapcount:0 mapping: (null) index:0x0
page flags: 0x40000404(referenced|reserved)
Modules linked in: nfsd auth_rpcgss i915 nfs_acl nfs lockd video drm_kms_helper drm bnep rfcomm sunrpc bluetooth psmouse parport_pc ppdev lp serio_raw fscache parport gpio_ich lpc_ich mac_hid i2c_algo_bit tpm_tis wmi usb_storage hid_generic usbhid hid e1000e firewire_ohci firewire_core ahci ptp libahci pps_core crc_itu_t
CPU: 3 PID: 2123 Comm: bash Not tainted 3.11.0-rc6+ #12
Hardware name: LENOVO 7034DD7/ , BIOS 9HKT47AUS 01//2012
00000000 00000000 e9625ea0 c15ec49b f3461a00 e9625eb8 c15ea119 c17cbf18
ef084314 000019d0 f3461a00 e9625ed8 c110dc8a f3461a00 00000001 00000000
f3461a00 40000404 00000000 e9625ef8 c110dcc1 f3461a00 f3461a00 000019d0
Call Trace:
dump_stack+0x41/0x52
bad_page+0xcf/0xeb
free_pages_prepare+0x12a/0x140
free_hot_cold_page+0x21/0x110
__put_single_page+0x21/0x30
put_page+0x25/0x40
unpoison_memory+0x107/0x200
hwpoison_unpoison+0x20/0x30
simple_attr_write+0xb6/0xd0
vfs_write+0xa0/0x1b0
SyS_write+0x4f/0x90
sysenter_do_call+0x12/0x22
Disabling lock debugging due to kernel taint
Testcase:
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <errno.h>
#define PAGES_TO_TEST 1
#define PAGE_SIZE 4096
int main(void)
{
char *mem;
mem = mmap(NULL, PAGES_TO_TEST * PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (madvise(mem, PAGES_TO_TEST * PAGE_SIZE, MADV_HWPOISON) == -1)
return -1;
munmap(mem, PAGES_TO_TEST * PAGE_SIZE);
return 0;
}
There is one page reference count for default empty zero page,
madvise_hwpoison add another one by get_user_pages_fast. memory_hwpoison
reduce one page reference count since it's a non LRU page.
unpoison_memory release the last page reference count and free empty zero
page to buddy system which is not correct since empty zero page has
PG_reserved flag. This patch fix it by don't reduce the page reference
count under 1 against empty zero page.
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-09-11 15:58:12 -07:00
..
2013-09-11 15:58:03 -07:00
2012-12-11 17:22:26 -08:00
2013-07-03 16:07:39 -07:00
2013-05-08 10:13:35 -07:00
2013-04-30 17:04:01 -07:00
2013-09-11 15:57:55 -07:00
2012-12-11 17:22:24 -08:00
2013-03-03 22:46:22 -05:00
2013-04-09 14:12:56 -04:00
2013-09-04 09:23:46 -04:00
2013-08-13 17:57:48 -07:00
2013-06-12 16:29:46 -07:00
2012-12-20 08:37:05 -08:00
2013-09-11 15:57:19 -07:00
2013-08-08 20:11:24 -04:00
2013-09-11 15:57:49 -07:00
2013-09-11 15:58:11 -07:00
2013-09-11 15:58:01 -07:00
2012-10-09 16:22:42 +09:00
2013-08-29 00:41:59 +02:00
2013-09-11 15:57:11 -07:00
2013-09-11 15:57:11 -07:00
2013-09-11 15:58:11 -07:00
2013-07-10 18:11:34 -07:00
2013-09-11 15:57:51 -07:00
2013-09-11 15:57:53 -07:00
2013-09-11 15:57:48 -07:00
2013-09-11 15:58:12 -07:00
2013-09-11 15:57:48 -07:00
2013-09-11 15:57:50 -07:00
2012-06-25 11:53:47 +02:00
2013-09-11 15:58:01 -07:00
2013-02-23 17:50:17 -08:00
2013-09-11 15:58:01 -07:00
2013-07-03 16:07:32 -07:00
2013-09-11 15:57:56 -07:00
2013-05-07 18:38:27 -07:00
2013-06-28 14:34:33 +02:00
2013-02-23 17:50:18 -08:00
2012-12-18 15:02:15 -08:00
2013-09-11 15:58:03 -07:00
2013-07-03 16:07:33 -07:00
2013-07-10 18:11:34 -07:00
2013-07-15 11:25:05 +09:30
2013-09-11 15:58:06 -07:00
2012-12-12 17:38:32 -08:00
2013-07-03 16:07:26 -07:00
2013-09-11 15:57:48 -07:00
2013-09-11 15:58:04 -07:00
2013-05-24 16:22:53 -07:00
2012-06-20 14:39:36 -07:00
2012-12-02 06:23:04 -08:00
2013-09-11 15:57:30 -07:00
2013-03-12 11:05:45 -07:00
2013-09-11 15:57:39 -07:00
2013-08-29 13:20:11 +02:00
2013-09-03 22:50:27 -04:00
2013-07-14 15:14:29 -07:00
2013-07-14 19:36:59 -04:00
2013-08-28 19:26:38 -07:00
2013-07-14 15:14:29 -07:00
2013-09-11 15:57:11 -07:00
2013-04-29 15:54:35 -07:00
2013-09-11 15:58:01 -07:00
2013-06-12 16:29:45 -07:00
2013-09-11 15:57:55 -07:00
2013-09-11 15:57:17 -07:00
2013-05-27 23:32:35 -04:00
2013-09-11 15:57:31 -07:00
2013-09-11 15:58:02 -07:00
2013-09-03 18:25:03 -07:00
2013-09-11 15:58:01 -07:00
2013-09-11 15:58:01 -07:00
2013-09-11 15:57:35 -07:00
2013-09-11 15:57:08 -07:00