aboutsummaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2022-09-26 13:13:15 -0700
committerAndrew Morton <akpm@linux-foundation.org>2022-09-26 13:13:15 -0700
commit6d751329e761338faa9c24c2c9736f27bc54282b (patch)
tree6e1778a7448552c58d12da88f70f6ad2718d55da /mm/hugetlb.c
parentmm: fix PageAnonExclusive clearing racing with concurrent RCU GUP-fast (diff)
parentx86/uaccess: avoid check_object_size() in copy_from_user_nmi() (diff)
downloadlinux-dev-6d751329e761338faa9c24c2c9736f27bc54282b.tar.xz
linux-dev-6d751329e761338faa9c24c2c9736f27bc54282b.zip
Merge branch 'mm-hotfixes-stable' into mm-stable
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r--mm/hugetlb.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 46387208fd9d..2ca4e8c3163e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3421,6 +3421,7 @@ static int demote_free_huge_page(struct hstate *h, struct page *page)
{
int i, nid = page_to_nid(page);
struct hstate *target_hstate;
+ struct page *subpage;
int rc = 0;
target_hstate = size_to_hstate(PAGE_SIZE << h->demote_order);
@@ -3454,15 +3455,16 @@ static int demote_free_huge_page(struct hstate *h, struct page *page)
mutex_lock(&target_hstate->resize_lock);
for (i = 0; i < pages_per_huge_page(h);
i += pages_per_huge_page(target_hstate)) {
+ subpage = nth_page(page, i);
if (hstate_is_gigantic(target_hstate))
- prep_compound_gigantic_page_for_demote(page + i,
+ prep_compound_gigantic_page_for_demote(subpage,
target_hstate->order);
else
- prep_compound_page(page + i, target_hstate->order);
- set_page_private(page + i, 0);
- set_page_refcounted(page + i);
- prep_new_huge_page(target_hstate, page + i, nid);
- put_page(page + i);
+ prep_compound_page(subpage, target_hstate->order);
+ set_page_private(subpage, 0);
+ set_page_refcounted(subpage);
+ prep_new_huge_page(target_hstate, subpage, nid);
+ put_page(subpage);
}
mutex_unlock(&target_hstate->resize_lock);