Loading Documentation/filesystems/proc.txt +20 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ Table 1-1: Process specific entries in /proc maps Memory maps to executables and library files (2.4) mem Memory held by this process root Link to the root directory of this process reclaim Reclaim pages in this process stat Process status statm Process memory status information status Process status in human readable form Loading Loading @@ -500,6 +501,25 @@ current value: Any other value written to /proc/PID/clear_refs will have no effect. The file /proc/PID/reclaim is used to reclaim pages in this process. To reclaim file-backed pages, > echo file > /proc/PID/reclaim To reclaim anonymous pages, > echo anon > /proc/PID/reclaim To reclaim all pages, > echo all > /proc/PID/reclaim Also, you can specify address range of process so part of address space will be reclaimed. The format is following as > echo addr size-byte > /proc/PID/reclaim NOTE: addr should be page-aligned. Below is example which try to reclaim 2M from 0x100000. > echo 0x100000 2M > /proc/PID/reclaim The /proc/pid/pagemap gives the PFN, which can be used to find the pageflags using /proc/kpageflags and number of times a page is mapped using /proc/kpagecount. For detailed explanation, see Documentation/vm/pagemap.txt. Loading drivers/block/zram/zram_drv.c +1 −0 Original line number Diff line number Diff line Loading @@ -1081,6 +1081,7 @@ static int create_device(struct zram *zram, int device_id) zram->disk->private_data = zram; snprintf(zram->disk->disk_name, 16, "zram%d", device_id); __set_bit(QUEUE_FLAG_FAST, &zram->queue->queue_flags); /* Actual capacity set using syfs (/sys/block/zram<id>/disksize */ set_capacity(zram->disk, 0); /* zram devices sort of resembles non-rotational disks */ Loading drivers/staging/android/lowmemorykiller.c +14 −4 Original line number Diff line number Diff line Loading @@ -171,6 +171,15 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb, trace_almk_vmpressure(pressure, other_free, other_file); } } else if (atomic_read(&shift_adj)) { /* * shift_adj would have been set by a previous invocation * of notifier, which is not followed by a lowmem_shrink yet. * Since vmpressure has improved, reset shift_adj to avoid * false adaptive LMK trigger. */ trace_almk_vmpressure(pressure, other_free, other_file); atomic_set(&shift_adj, 0); } return 0; Loading @@ -182,16 +191,16 @@ static struct notifier_block lmk_vmpr_nb = { static int test_task_flag(struct task_struct *p, int flag) { struct task_struct *t = p; struct task_struct *t; do { for_each_thread(p, t) { task_lock(t); if (test_tsk_thread_flag(t, flag)) { task_unlock(t); return 1; } task_unlock(t); } while_each_thread(p, t); } return 0; } Loading Loading @@ -247,7 +256,8 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx, if (other_file != NULL) *other_file -= zone_page_state(zone, NR_FILE_PAGES) - zone_page_state(zone, NR_SHMEM); - zone_page_state(zone, NR_SHMEM) - zone_page_state(zone, NR_SWAPCACHE); } else if (zone_idx < classzone_idx) { if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0) && other_free) { Loading fs/proc/base.c +3 −0 Original line number Diff line number Diff line Loading @@ -2729,6 +2729,9 @@ static const struct pid_entry tgid_base_stuff[] = { REG("mounts", S_IRUGO, proc_mounts_operations), REG("mountinfo", S_IRUGO, proc_mountinfo_operations), REG("mountstats", S_IRUSR, proc_mountstats_operations), #ifdef CONFIG_PROCESS_RECLAIM REG("reclaim", S_IWUSR, proc_reclaim_operations), #endif #ifdef CONFIG_PROC_PAGE_MONITOR REG("clear_refs", S_IWUSR, proc_clear_refs_operations), REG("smaps", S_IRUGO, proc_pid_smaps_operations), Loading fs/proc/internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ struct pde_opener { extern const struct inode_operations proc_link_inode_operations; extern const struct inode_operations proc_pid_link_inode_operations; extern const struct file_operations proc_reclaim_operations; extern void proc_init_inodecache(void); extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); Loading Loading
Documentation/filesystems/proc.txt +20 −0 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ Table 1-1: Process specific entries in /proc maps Memory maps to executables and library files (2.4) mem Memory held by this process root Link to the root directory of this process reclaim Reclaim pages in this process stat Process status statm Process memory status information status Process status in human readable form Loading Loading @@ -500,6 +501,25 @@ current value: Any other value written to /proc/PID/clear_refs will have no effect. The file /proc/PID/reclaim is used to reclaim pages in this process. To reclaim file-backed pages, > echo file > /proc/PID/reclaim To reclaim anonymous pages, > echo anon > /proc/PID/reclaim To reclaim all pages, > echo all > /proc/PID/reclaim Also, you can specify address range of process so part of address space will be reclaimed. The format is following as > echo addr size-byte > /proc/PID/reclaim NOTE: addr should be page-aligned. Below is example which try to reclaim 2M from 0x100000. > echo 0x100000 2M > /proc/PID/reclaim The /proc/pid/pagemap gives the PFN, which can be used to find the pageflags using /proc/kpageflags and number of times a page is mapped using /proc/kpagecount. For detailed explanation, see Documentation/vm/pagemap.txt. Loading
drivers/block/zram/zram_drv.c +1 −0 Original line number Diff line number Diff line Loading @@ -1081,6 +1081,7 @@ static int create_device(struct zram *zram, int device_id) zram->disk->private_data = zram; snprintf(zram->disk->disk_name, 16, "zram%d", device_id); __set_bit(QUEUE_FLAG_FAST, &zram->queue->queue_flags); /* Actual capacity set using syfs (/sys/block/zram<id>/disksize */ set_capacity(zram->disk, 0); /* zram devices sort of resembles non-rotational disks */ Loading
drivers/staging/android/lowmemorykiller.c +14 −4 Original line number Diff line number Diff line Loading @@ -171,6 +171,15 @@ static int lmk_vmpressure_notifier(struct notifier_block *nb, trace_almk_vmpressure(pressure, other_free, other_file); } } else if (atomic_read(&shift_adj)) { /* * shift_adj would have been set by a previous invocation * of notifier, which is not followed by a lowmem_shrink yet. * Since vmpressure has improved, reset shift_adj to avoid * false adaptive LMK trigger. */ trace_almk_vmpressure(pressure, other_free, other_file); atomic_set(&shift_adj, 0); } return 0; Loading @@ -182,16 +191,16 @@ static struct notifier_block lmk_vmpr_nb = { static int test_task_flag(struct task_struct *p, int flag) { struct task_struct *t = p; struct task_struct *t; do { for_each_thread(p, t) { task_lock(t); if (test_tsk_thread_flag(t, flag)) { task_unlock(t); return 1; } task_unlock(t); } while_each_thread(p, t); } return 0; } Loading Loading @@ -247,7 +256,8 @@ void tune_lmk_zone_param(struct zonelist *zonelist, int classzone_idx, if (other_file != NULL) *other_file -= zone_page_state(zone, NR_FILE_PAGES) - zone_page_state(zone, NR_SHMEM); - zone_page_state(zone, NR_SHMEM) - zone_page_state(zone, NR_SWAPCACHE); } else if (zone_idx < classzone_idx) { if (zone_watermark_ok(zone, 0, 0, classzone_idx, 0) && other_free) { Loading
fs/proc/base.c +3 −0 Original line number Diff line number Diff line Loading @@ -2729,6 +2729,9 @@ static const struct pid_entry tgid_base_stuff[] = { REG("mounts", S_IRUGO, proc_mounts_operations), REG("mountinfo", S_IRUGO, proc_mountinfo_operations), REG("mountstats", S_IRUSR, proc_mountstats_operations), #ifdef CONFIG_PROCESS_RECLAIM REG("reclaim", S_IWUSR, proc_reclaim_operations), #endif #ifdef CONFIG_PROC_PAGE_MONITOR REG("clear_refs", S_IWUSR, proc_clear_refs_operations), REG("smaps", S_IRUGO, proc_pid_smaps_operations), Loading
fs/proc/internal.h +1 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,7 @@ struct pde_opener { extern const struct inode_operations proc_link_inode_operations; extern const struct inode_operations proc_pid_link_inode_operations; extern const struct file_operations proc_reclaim_operations; extern void proc_init_inodecache(void); extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); Loading