ANDROID: mm: shmem: add vendor hooks in shmem folio allocation path

Add vendor hooks in shmem folio allocation paths to tune the higher
order folios.
With vendor hook possibly overriding shmem_allowable_huge_orders()
result, `order` inside shmem_get_folio_gfp() becomes variable when
when CONFIG_TRANSPARENT_HUGEPAGE=n and the block that calls
vma_thp_gfp_mask() is not compiled out anymore, leading to the
following linker error:

ld.lld: error: undefined symbol: vma_thp_gfp_mask
>>> referenced by shmem.c

Fix this by making the block dependent on CONFIG_TRANSPARENT_HUGEPAGE.

Bug: 397599006
Change-Id: Ia0e126c674a9f08cb10fe5ee06f5efac7b5cbe7f
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Charan Teja Kalla
2025-02-19 17:54:25 +05:30
committed by Suren Baghdasaryan
parent fac8fe3f78
commit add2b5a560
3 changed files with 20 additions and 1 deletions
+8 -1
View File
@@ -20,7 +20,14 @@ DECLARE_RESTRICTED_HOOK(android_rvh_try_alloc_pages_gfp,
TP_PROTO(struct page **page, unsigned int order,
gfp_t gfp, enum zone_type highest_zoneidx),
TP_ARGS(page, order, gfp, highest_zoneidx), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_shmem_suitable_orders,
TP_PROTO(struct inode *inode, pgoff_t index,
unsigned long orders, unsigned long *suitable_orders),
TP_ARGS(inode, index, orders, suitable_orders), 4);
DECLARE_RESTRICTED_HOOK(android_rvh_shmem_allowable_huge_orders,
TP_PROTO(struct inode *inode, pgoff_t index,
struct vm_area_struct *vma, unsigned long *orders),
TP_ARGS(inode, index, vma, orders), 4);
/*
DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,