]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/madvise.c
Merge tag 'please-pull-misc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / mm / madvise.c
index 94c343b4c968843b732497f81dbadda644c5c7e4..bcdb6a04278794ca97eea24cb59e8b7f04ab7111 100644 (file)
@@ -864,13 +864,13 @@ static int madvise_inject_error(int behavior,
 {
        struct page *page;
        struct zone *zone;
-       unsigned int order;
+       unsigned long size;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
 
-       for (; start < end; start += PAGE_SIZE << order) {
+       for (; start < end; start += size) {
                unsigned long pfn;
                int ret;
 
@@ -882,9 +882,9 @@ static int madvise_inject_error(int behavior,
                /*
                 * 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.
+                * no longer be a compound page.
                 */
-               order = compound_order(compound_head(page));
+               size = page_size(compound_head(page));
 
                if (PageHWPoison(page)) {
                        put_page(page);
@@ -895,7 +895,7 @@ static int madvise_inject_error(int behavior,
                        pr_info("Soft offlining pfn %#lx at process virtual address %#lx\n",
                                        pfn, start);
 
-                       ret = soft_offline_page(page, MF_COUNT_INCREASED);
+                       ret = soft_offline_page(pfn, MF_COUNT_INCREASED);
                        if (ret)
                                return ret;
                        continue;
@@ -1059,9 +1059,9 @@ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
        if (!madvise_behavior_valid(behavior))
                return error;
 
-       if (start & ~PAGE_MASK)
+       if (!PAGE_ALIGNED(start))
                return error;
-       len = (len_in + ~PAGE_MASK) & PAGE_MASK;
+       len = PAGE_ALIGN(len_in);
 
        /* Check to see whether len was rounded up from small -ve to zero */
        if (len_in && !len)