]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/madvise.c
UBUNTU: Ubuntu-raspi2-4.13.0-1015.16
[mirror_ubuntu-artful-kernel.git] / mm / madvise.c
index 4d7d1e5ddba9d9b26583b6ca9f05774247d9b1d8..4edca1d863395d7f03abe12c213965bcf84ec3b3 100644 (file)
@@ -614,18 +614,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;