memory-failure.c (92fd4d4d67b945c0766416284d4ab236b31542c4) | memory-failure.c (20d6c96b5f1cad5c5da4641945ec17a1d9a1afc8) |
---|---|
1/* 2 * Copyright (C) 2008, 2009 Intel Corporation 3 * Authors: Andi Kleen, Fengguang Wu 4 * 5 * This software may be redistributed and/or modified under the terms of 6 * the GNU General Public License ("GPL") version 2 only as published by the 7 * Free Software Foundation. 8 * --- 37 unchanged lines hidden (view full) --- 46#include <linux/swap.h> 47#include <linux/backing-dev.h> 48#include <linux/migrate.h> 49#include <linux/page-isolation.h> 50#include <linux/suspend.h> 51#include <linux/slab.h> 52#include <linux/swapops.h> 53#include <linux/hugetlb.h> | 1/* 2 * Copyright (C) 2008, 2009 Intel Corporation 3 * Authors: Andi Kleen, Fengguang Wu 4 * 5 * This software may be redistributed and/or modified under the terms of 6 * the GNU General Public License ("GPL") version 2 only as published by the 7 * Free Software Foundation. 8 * --- 37 unchanged lines hidden (view full) --- 46#include <linux/swap.h> 47#include <linux/backing-dev.h> 48#include <linux/migrate.h> 49#include <linux/page-isolation.h> 50#include <linux/suspend.h> 51#include <linux/slab.h> 52#include <linux/swapops.h> 53#include <linux/hugetlb.h> |
54#include <linux/memory_hotplug.h> |
|
54#include "internal.h" 55 56int sysctl_memory_failure_early_kill __read_mostly = 0; 57 58int sysctl_memory_failure_recovery __read_mostly = 1; 59 60atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0); 61 --- 1163 unchanged lines hidden (view full) --- 1225static int get_any_page(struct page *p, unsigned long pfn, int flags) 1226{ 1227 int ret; 1228 1229 if (flags & MF_COUNT_INCREASED) 1230 return 1; 1231 1232 /* | 55#include "internal.h" 56 57int sysctl_memory_failure_early_kill __read_mostly = 0; 58 59int sysctl_memory_failure_recovery __read_mostly = 1; 60 61atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0); 62 --- 1163 unchanged lines hidden (view full) --- 1226static int get_any_page(struct page *p, unsigned long pfn, int flags) 1227{ 1228 int ret; 1229 1230 if (flags & MF_COUNT_INCREASED) 1231 return 1; 1232 1233 /* |
1233 * The lock_system_sleep prevents a race with memory hotplug, 1234 * because the isolation assumes there's only a single user. | 1234 * The lock_memory_hotplug prevents a race with memory hotplug. |
1235 * This is a big hammer, a better would be nicer. 1236 */ | 1235 * This is a big hammer, a better would be nicer. 1236 */ |
1237 lock_system_sleep(); | 1237 lock_memory_hotplug(); |
1238 1239 /* 1240 * Isolate the page, so that it doesn't get reallocated if it 1241 * was free. 1242 */ 1243 set_migratetype_isolate(p); 1244 /* 1245 * When the target page is a free hugepage, just remove it --- 13 unchanged lines hidden (view full) --- 1259 pfn, p->flags); 1260 ret = -EIO; 1261 } 1262 } else { 1263 /* Not a free page */ 1264 ret = 1; 1265 } 1266 unset_migratetype_isolate(p); | 1238 1239 /* 1240 * Isolate the page, so that it doesn't get reallocated if it 1241 * was free. 1242 */ 1243 set_migratetype_isolate(p); 1244 /* 1245 * When the target page is a free hugepage, just remove it --- 13 unchanged lines hidden (view full) --- 1259 pfn, p->flags); 1260 ret = -EIO; 1261 } 1262 } else { 1263 /* Not a free page */ 1264 ret = 1; 1265 } 1266 unset_migratetype_isolate(p); |
1267 unlock_system_sleep(); | 1267 unlock_memory_hotplug(); |
1268 return ret; 1269} 1270 1271static int soft_offline_huge_page(struct page *page, int flags) 1272{ 1273 int ret; 1274 unsigned long pfn = page_to_pfn(page); 1275 struct page *hpage = compound_head(page); --- 192 unchanged lines hidden --- | 1268 return ret; 1269} 1270 1271static int soft_offline_huge_page(struct page *page, int flags) 1272{ 1273 int ret; 1274 unsigned long pfn = page_to_pfn(page); 1275 struct page *hpage = compound_head(page); --- 192 unchanged lines hidden --- |