Files
kernel_common_drivers/include/linux/amlogic/pin_file.h
T
Jianxiong Pan 2271989942 mm: pin locked file after fault. [2/2]
PD#SWPL-95400

Problem:
If we pin a file in android, the whole data of this file
will be loaded to DDR, but most of these data may not be
used, this caused memory waste.

Solution:
delay mark mlocked flags for unevictable pages until
it has been faulted.
You can use following command to disable this function:
echo 0 > /proc/sys/vm/shrink_unevictable

Verify:
sc2_ah212.

Change-Id: I3981b36114ab331c558198b80140aaa91fe7e7df
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
2022-10-18 13:46:23 +08:00

36 lines
946 B
C

/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
*/
#ifndef __PIN_FILE_H__
#define __PIN_FILE_H__
struct aml_pin_file {
spinlock_t pin_file_lock; /* for address space */
unsigned int start_bit;
int cached_pages;
struct vm_struct *root_vm;
unsigned long *bitmap;
struct list_head list;
spinlock_t page_lock; /* for cached pages */
};
/* the macro must large than enum mapping_flags in include/linux/pagemap.h */
#define AS_LOCK_MAPPING 10
struct page *aml_mlock_page_as_lock_mapping(struct vm_area_struct *vma,
struct mm_struct *mm, struct vm_fault *vmf, unsigned long address);
void reset_page_vma_flags(struct vm_area_struct *vma, vm_flags_t flags);
int aml_is_pin_locked_file(struct page *page);
void aml_set_pin_locked_file(struct page *page);
void aml_clear_pin_locked_file(struct page *page);
extern int sysctrl_shrink_unevictable;
#endif /* __PIN_FILE_H__ */