mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Revert "mm/hugetlb_cgroup: convert hugetlb_cgroup_uncharge_page() to folios"
This reverts commitcc8f0d90bawhich is commitd4ab0316ccupstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ifdfb62b35c5f8aab3cb387f122f3cd7e0fbc8840 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -158,10 +158,10 @@ extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
|
|||||||
extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
|
extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
|
||||||
struct hugetlb_cgroup *h_cg,
|
struct hugetlb_cgroup *h_cg,
|
||||||
struct page *page);
|
struct page *page);
|
||||||
extern void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
|
extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
|
||||||
struct folio *folio);
|
struct page *page);
|
||||||
extern void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages,
|
extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages,
|
||||||
struct folio *folio);
|
struct page *page);
|
||||||
|
|
||||||
extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
|
extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
|
||||||
struct hugetlb_cgroup *h_cg);
|
struct hugetlb_cgroup *h_cg);
|
||||||
@@ -254,14 +254,14 @@ hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
|
static inline void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
|
||||||
struct folio *folio)
|
struct page *page)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void hugetlb_cgroup_uncharge_folio_rsvd(int idx,
|
static inline void hugetlb_cgroup_uncharge_page_rsvd(int idx,
|
||||||
unsigned long nr_pages,
|
unsigned long nr_pages,
|
||||||
struct folio *folio)
|
struct page *page)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
static inline void hugetlb_cgroup_uncharge_cgroup(int idx,
|
static inline void hugetlb_cgroup_uncharge_cgroup(int idx,
|
||||||
|
|||||||
15
mm/hugetlb.c
15
mm/hugetlb.c
@@ -1955,10 +1955,10 @@ void free_huge_page(struct page *page)
|
|||||||
|
|
||||||
spin_lock_irqsave(&hugetlb_lock, flags);
|
spin_lock_irqsave(&hugetlb_lock, flags);
|
||||||
folio_clear_hugetlb_migratable(folio);
|
folio_clear_hugetlb_migratable(folio);
|
||||||
hugetlb_cgroup_uncharge_folio(hstate_index(h),
|
hugetlb_cgroup_uncharge_page(hstate_index(h),
|
||||||
pages_per_huge_page(h), folio);
|
pages_per_huge_page(h), page);
|
||||||
hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h),
|
hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
|
||||||
pages_per_huge_page(h), folio);
|
pages_per_huge_page(h), page);
|
||||||
if (restore_reserve)
|
if (restore_reserve)
|
||||||
h->resv_huge_pages++;
|
h->resv_huge_pages++;
|
||||||
|
|
||||||
@@ -3081,7 +3081,6 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
|
|||||||
struct hugepage_subpool *spool = subpool_vma(vma);
|
struct hugepage_subpool *spool = subpool_vma(vma);
|
||||||
struct hstate *h = hstate_vma(vma);
|
struct hstate *h = hstate_vma(vma);
|
||||||
struct page *page;
|
struct page *page;
|
||||||
struct folio *folio;
|
|
||||||
long map_chg, map_commit;
|
long map_chg, map_commit;
|
||||||
long gbl_chg;
|
long gbl_chg;
|
||||||
int ret, idx;
|
int ret, idx;
|
||||||
@@ -3145,7 +3144,6 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
|
|||||||
* a reservation exists for the allocation.
|
* a reservation exists for the allocation.
|
||||||
*/
|
*/
|
||||||
page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg);
|
page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg);
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
spin_unlock_irq(&hugetlb_lock);
|
spin_unlock_irq(&hugetlb_lock);
|
||||||
page = alloc_buddy_huge_page_with_mpol(h, vma, addr);
|
page = alloc_buddy_huge_page_with_mpol(h, vma, addr);
|
||||||
@@ -3160,7 +3158,6 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
|
|||||||
set_page_refcounted(page);
|
set_page_refcounted(page);
|
||||||
/* Fall through */
|
/* Fall through */
|
||||||
}
|
}
|
||||||
folio = page_folio(page);
|
|
||||||
hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page);
|
hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page);
|
||||||
/* If allocation is not consuming a reservation, also store the
|
/* If allocation is not consuming a reservation, also store the
|
||||||
* hugetlb_cgroup pointer on the page.
|
* hugetlb_cgroup pointer on the page.
|
||||||
@@ -3190,8 +3187,8 @@ struct page *alloc_huge_page(struct vm_area_struct *vma,
|
|||||||
rsv_adjust = hugepage_subpool_put_pages(spool, 1);
|
rsv_adjust = hugepage_subpool_put_pages(spool, 1);
|
||||||
hugetlb_acct_memory(h, -rsv_adjust);
|
hugetlb_acct_memory(h, -rsv_adjust);
|
||||||
if (deferred_reserve)
|
if (deferred_reserve)
|
||||||
hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h),
|
hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h),
|
||||||
pages_per_huge_page(h), folio);
|
pages_per_huge_page(h), page);
|
||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
|
|
||||||
|
|||||||
@@ -346,10 +346,11 @@ void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages,
|
|||||||
/*
|
/*
|
||||||
* Should be called with hugetlb_lock held
|
* Should be called with hugetlb_lock held
|
||||||
*/
|
*/
|
||||||
static void __hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
|
static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
|
||||||
struct folio *folio, bool rsvd)
|
struct page *page, bool rsvd)
|
||||||
{
|
{
|
||||||
struct hugetlb_cgroup *h_cg;
|
struct hugetlb_cgroup *h_cg;
|
||||||
|
struct folio *folio = page_folio(page);
|
||||||
|
|
||||||
if (hugetlb_cgroup_disabled())
|
if (hugetlb_cgroup_disabled())
|
||||||
return;
|
return;
|
||||||
@@ -367,27 +368,27 @@ static void __hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
|
|||||||
css_put(&h_cg->css);
|
css_put(&h_cg->css);
|
||||||
else {
|
else {
|
||||||
unsigned long usage =
|
unsigned long usage =
|
||||||
h_cg->nodeinfo[folio_nid(folio)]->usage[idx];
|
h_cg->nodeinfo[page_to_nid(page)]->usage[idx];
|
||||||
/*
|
/*
|
||||||
* This write is not atomic due to fetching usage and writing
|
* This write is not atomic due to fetching usage and writing
|
||||||
* to it, but that's fine because we call this with
|
* to it, but that's fine because we call this with
|
||||||
* hugetlb_lock held anyway.
|
* hugetlb_lock held anyway.
|
||||||
*/
|
*/
|
||||||
WRITE_ONCE(h_cg->nodeinfo[folio_nid(folio)]->usage[idx],
|
WRITE_ONCE(h_cg->nodeinfo[page_to_nid(page)]->usage[idx],
|
||||||
usage - nr_pages);
|
usage - nr_pages);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages,
|
void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
|
||||||
struct folio *folio)
|
struct page *page)
|
||||||
{
|
{
|
||||||
__hugetlb_cgroup_uncharge_folio(idx, nr_pages, folio, false);
|
__hugetlb_cgroup_uncharge_page(idx, nr_pages, page, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages,
|
void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages,
|
||||||
struct folio *folio)
|
struct page *page)
|
||||||
{
|
{
|
||||||
__hugetlb_cgroup_uncharge_folio(idx, nr_pages, folio, true);
|
__hugetlb_cgroup_uncharge_page(idx, nr_pages, page, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
|
static void __hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages,
|
||||||
|
|||||||
Reference in New Issue
Block a user