ANDROID: 16K: Disable kernel APIs indexed by PFNs
When emulating the userspace page size, /proc/*/pagemap doesn't support PFNs since it is not guaranteed that the PFNs of the virtually contiguous pages are also contiguous physically and therefore cannot be collapsed for purposes of the page size emulation. On x86_64 16K devices, PFN bit of pagemap entries are always zero, hence disable APIs that consume PFNs from pagemap: - /proc/kpagecount - /proc/kpageflags - /proc/kpagecgroup - /sys/kernel/mm/page_idle/bitmap Bug: 383389337 Bug: 385167611 Test: atest vts_ltp_test_x86_64:syscalls.msync04_64bit#syscalls.msync04_64bit Test: atest vts_ltp_test_x86_64:syscalls.mmap12_64bit#syscalls.mmap12_64bit Test: atest libmeminfo_test Test: atest bionic-unit-tests:DlExtRelroSharingTest#VerifyMemorySaving Note: bionic-unit-tests must be run as root (add require_root: true) Change-Id: I214c8737c6f7385346436769f144c5ecd429a5b7 Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
d684b3125e
commit
0d44e1eb0e
@@ -14,6 +14,7 @@
|
||||
#include <linux/memcontrol.h>
|
||||
#include <linux/mmu_notifier.h>
|
||||
#include <linux/page_idle.h>
|
||||
#include <linux/page_size_compat.h>
|
||||
#include <linux/kernel-page-flags.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include "internal.h"
|
||||
@@ -328,6 +329,9 @@ static const struct proc_ops kpagecgroup_proc_ops = {
|
||||
|
||||
static int __init proc_page_init(void)
|
||||
{
|
||||
if (__PAGE_SIZE != PAGE_SIZE)
|
||||
return 0;
|
||||
|
||||
proc_create("kpagecount", S_IRUSR, NULL, &kpagecount_proc_ops);
|
||||
proc_create("kpageflags", S_IRUSR, NULL, &kpageflags_proc_ops);
|
||||
#ifdef CONFIG_MEMCG
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/mmzone.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/page_size_compat.h>
|
||||
#include <linux/rmap.h>
|
||||
#include <linux/mmu_notifier.h>
|
||||
#include <linux/page_ext.h>
|
||||
@@ -211,6 +212,9 @@ static int __init page_idle_init(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (__PAGE_SIZE != PAGE_SIZE)
|
||||
return 0;
|
||||
|
||||
err = sysfs_create_group(mm_kobj, &page_idle_attr_group);
|
||||
if (err) {
|
||||
pr_err("page_idle: register sysfs failed\n");
|
||||
|
||||
Reference in New Issue
Block a user