|
@@ -625,18 +625,26 @@ static int madvise_inject_error(int behavior,
|
|
|
{
|
|
|
struct page *page;
|
|
|
struct zone *zone;
|
|
|
+ unsigned int order;
|
|
|
|
|
|
if (!capable(CAP_SYS_ADMIN))
|
|
|
return -EPERM;
|
|
|
|
|
|
- for (; start < end; start += PAGE_SIZE <<
|
|
|
- compound_order(compound_head(page))) {
|
|
|
+
|
|
|
+ for (; start < end; start += PAGE_SIZE << order) {
|
|
|
int ret;
|
|
|
|
|
|
ret = get_user_pages_fast(start, 1, 0, &page);
|
|
|
if (ret != 1)
|
|
|
return ret;
|
|
|
|
|
|
+ /*
|
|
|
+ * When soft offlining hugepages, after migrating the page
|
|
|
+ * we dissolve it, therefore in the second loop "page" will
|
|
|
+ * no longer be a compound page, and order will be 0.
|
|
|
+ */
|
|
|
+ order = compound_order(compound_head(page));
|
|
|
+
|
|
|
if (PageHWPoison(page)) {
|
|
|
put_page(page);
|
|
|
continue;
|