Revert "ANDROID: mm: Create vendor hooks to control ZONE_MOVABLE allocations"

This reverts commit 62e32cf8f3 as it
causes merge issues with the readahead rework that happened in 5.18-rc1
and would be incorrect.

If it is still needed, it can be added back at a later time.

Bug: 158645321
Cc: Chris Goldsworthy <cgoldswo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I886f8a528cfed1d4c9a93468a9d2a4384fdecfe0
This commit is contained in:
Greg Kroah-Hartman 2022-04-14 07:51:26 +02:00
parent 61b6d6f903
commit 9b516bbc18
7 changed files with 18 additions and 38 deletions

View File

@ -23,7 +23,6 @@
#include <trace/hooks/gic_v3.h>
#include <trace/hooks/epoch.h>
#include <trace/hooks/cpufreq.h>
#include <trace/hooks/mm.h>
#include <trace/hooks/preemptirq.h>
#include <trace/hooks/ftrace_dump.h>
#include <trace/hooks/ufshcd.h>
@ -90,9 +89,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_energy_efficient_cpu);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_overutilized);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_setaffinity);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_cpus_allowed);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_skip_swapcache_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_gfp_zone_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_readahead_gfp_mask);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_preempt_disable);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_preempt_enable);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_irqs_disable);

View File

@ -492,7 +492,16 @@ static inline bool gfpflags_normal_context(const gfp_t gfp_flags)
| 1 << (___GFP_MOVABLE | ___GFP_DMA32 | ___GFP_DMA | ___GFP_HIGHMEM) \
)
enum zone_type gfp_zone(gfp_t flags);
static inline enum zone_type gfp_zone(gfp_t flags)
{
enum zone_type z;
int bit = (__force int) (flags & GFP_ZONEMASK);
z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
((1 << GFP_ZONES_SHIFT) - 1);
VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
return z;
}
/*
* There is only one page-allocator function, and two main namespaces to

View File

@ -487,7 +487,10 @@ static inline struct page *page_cache_alloc(struct address_space *x)
return __page_cache_alloc(mapping_gfp_mask(x));
}
gfp_t readahead_gfp_mask(struct address_space *x);
static inline gfp_t readahead_gfp_mask(struct address_space *x)
{
return mapping_gfp_mask(x) | __GFP_NORETRY | __GFP_NOWARN;
}
typedef int filler_t(void *, struct page *);

View File

@ -10,6 +10,7 @@
#include <linux/types.h>
#include <trace/hooks/vendor_hooks.h>
/*
DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,
TP_PROTO(gfp_t *flags),
@ -21,6 +22,7 @@ DECLARE_RESTRICTED_HOOK(android_rvh_set_readahead_gfp_mask,
TP_PROTO(gfp_t *flags),
TP_ARGS(flags), 1);
*/
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@ -74,7 +74,6 @@
#include <linux/perf_event.h>
#include <linux/ptrace.h>
#include <linux/vmalloc.h>
#include <trace/hooks/mm.h>
#include <trace/events/kmem.h>
@ -3565,10 +3564,8 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
if (data_race(si->flags & SWP_SYNCHRONOUS_IO) &&
__swap_count(entry) == 1) {
/* skip swapcache */
gfp_t flags = GFP_HIGHUSER_MOVABLE;
trace_android_rvh_set_skip_swapcache_flags(&flags);
page = alloc_page_vma(flags, vma, vmf->address);
page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma,
vmf->address);
if (page) {
__SetPageLocked(page);
__SetPageSwapBacked(page);

View File

@ -9,7 +9,6 @@
#include <linux/stddef.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <trace/hooks/mm.h>
struct pglist_data *first_online_pgdat(void)
{
@ -109,19 +108,3 @@ int page_cpupid_xchg_last(struct page *page, int cpupid)
return last_cpupid;
}
#endif
enum zone_type gfp_zone(gfp_t flags)
{
enum zone_type z;
gfp_t local_flags = flags;
int bit;
trace_android_rvh_set_gfp_zone_flags(&local_flags);
bit = (__force int) ((local_flags) & GFP_ZONEMASK);
z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
((1 << GFP_ZONES_SHIFT) - 1);
VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
return z;
}

View File

@ -127,7 +127,6 @@
#include <linux/blk-cgroup.h>
#include <linux/fadvise.h>
#include <linux/sched/mm.h>
#include <trace/hooks/mm.h>
#include "internal.h"
@ -219,15 +218,6 @@ int read_cache_pages(struct address_space *mapping, struct list_head *pages,
EXPORT_SYMBOL(read_cache_pages);
gfp_t readahead_gfp_mask(struct address_space *x)
{
gfp_t mask = mapping_gfp_mask(x) | __GFP_NORETRY | __GFP_NOWARN;
trace_android_rvh_set_readahead_gfp_mask(&mask);
return mask;
}
EXPORT_SYMBOL_GPL(readahead_gfp_mask);
static void read_pages(struct readahead_control *rac, struct list_head *pages,
bool skip_page)
{