Skip to content

Commit

Permalink
ANDROID: vendor_hooks: Add hooks for adjusting alloc_flags
Browse files Browse the repository at this point in the history
In some situations, we want to adjust the alloc_flags for better performance.

Bug: 300857012
Change-Id: I30bd634d8ede1cc29c83d52bdd9276c8cf72ac1e
Signed-off-by: lvwenhuan <lvwenhuan@oppo.com>
  • Loading branch information
lvwenhuan authored and Treehugger Robot committed Sep 20, 2023
1 parent c1fa53f commit d6c24c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/android/vendor_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_offline);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_css_online);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_adjust_alloc_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_slab);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_looper_state_registered);
Expand Down
1 change: 1 addition & 0 deletions drivers/iommu/dma-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev,
order_size = 1U << order;
if (order_mask > order_size)
alloc_flags |= __GFP_NORETRY;
trace_android_vh_adjust_alloc_flags(order, &alloc_flags);
page = alloc_pages_node(nid, alloc_flags, order);
if (!page)
continue;
Expand Down
4 changes: 4 additions & 0 deletions include/trace/hooks/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ DECLARE_HOOK(android_vh_iommu_iovad_free_iova,
TP_PROTO(struct iova_domain *iovad, dma_addr_t iova, size_t size),
TP_ARGS(iovad, iova, size));

DECLARE_HOOK(android_vh_adjust_alloc_flags,
TP_PROTO(unsigned int order, gfp_t *alloc_flags),
TP_ARGS(order, alloc_flags));

#endif /* _TRACE_HOOK_IOMMU_H */

/* This part must be outside protection */
Expand Down

0 comments on commit d6c24c3

Please sign in to comment.