ANDROID: mm/shmem: Add a trace hook to get the shmem folio
Add a trace hook whose callback be used to fill the folio that can be used for shmem fs. This VH also takes the 'shmem_inode_info' which can contain the vendor specific data. The hook is used for drivers who may want to manage the pages of shmem files on their own and do memory allocation optimizations. Bug: 273448633 Change-Id: Ia48480bba6dba1ee37a3297b69fd61877dae8dc9 Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com> (cherry picked from commit 3f5a502bcc6eab646bf1bac4f226960a08bcab06) Signed-off-by: Georgi Djakov <quic_c_gdjako@quicinc.com>
This commit is contained in:
committed by
Georgi Djakov
parent
6f6044bb98
commit
1429c3c9ab
@@ -187,3 +187,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf_pr_cont);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_calc_alloc_flags);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_regmap_update);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_shmem_get_folio);
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
#define _TRACE_HOOK_MM_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
struct shmem_inode_info;
|
||||
struct folio;
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_shmem_get_folio,
|
||||
TP_PROTO(struct shmem_inode_info *info, struct folio **folio),
|
||||
TP_ARGS(info, folio), 2);
|
||||
|
||||
/*
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,
|
||||
|
||||
+8
-1
@@ -43,6 +43,9 @@
|
||||
#include <linux/mm_inline.h>
|
||||
#include "swap.h"
|
||||
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
static struct vfsmount *shm_mnt __ro_after_init;
|
||||
|
||||
#ifdef CONFIG_SHMEM
|
||||
@@ -1764,10 +1767,14 @@ static struct folio *shmem_alloc_folio(gfp_t gfp, int order,
|
||||
{
|
||||
struct mempolicy *mpol;
|
||||
pgoff_t ilx;
|
||||
struct folio *folio;
|
||||
struct folio *folio = NULL;
|
||||
|
||||
mpol = shmem_get_pgoff_policy(info, index, order, &ilx);
|
||||
trace_android_rvh_shmem_get_folio(info, &folio);
|
||||
if (folio)
|
||||
goto done;
|
||||
folio = folio_alloc_mpol(gfp, order, mpol, ilx, numa_node_id());
|
||||
done:
|
||||
mpol_cond_put(mpol);
|
||||
|
||||
return folio;
|
||||
|
||||
Reference in New Issue
Block a user