mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
memcg: helper function for relcaim from shmem.
A new call, mem_cgroup_shrink_usage() is added for shmem handling and relacing non-standard usage of mem_cgroup_charge/uncharge. Now, shmem calls mem_cgroup_charge() just for reclaim some pages from mem_cgroup. In general, shmem is used by some process group and not for global resource (like file caches). So, it's reasonable to reclaim pages from mem_cgroup where shmem is mainly used. [[email protected]: shmem_getpage release page sooner] [[email protected]: mem_cgroup_shrink_usage css_put] Signed-off-by: KAMEZAWA Hiroyuki <[email protected]> Cc: Balbir Singh <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Li Zefan <[email protected]> Cc: YAMAMOTO Takashi <[email protected]> Cc: Paul Menage <[email protected]> Cc: David Rientjes <[email protected]> Signed-off-by: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
69029cd550
commit
c9b0ed5148
3 changed files with 37 additions and 7 deletions
11
mm/shmem.c
11
mm/shmem.c
|
|
@ -1315,17 +1315,14 @@ repeat:
|
|||
shmem_swp_unmap(entry);
|
||||
spin_unlock(&info->lock);
|
||||
unlock_page(swappage);
|
||||
page_cache_release(swappage);
|
||||
if (error == -ENOMEM) {
|
||||
/* allow reclaim from this memory cgroup */
|
||||
error = mem_cgroup_cache_charge(swappage,
|
||||
current->mm, gfp & ~__GFP_HIGHMEM);
|
||||
if (error) {
|
||||
page_cache_release(swappage);
|
||||
error = mem_cgroup_shrink_usage(current->mm,
|
||||
gfp);
|
||||
if (error)
|
||||
goto failed;
|
||||
}
|
||||
mem_cgroup_uncharge_cache_page(swappage);
|
||||
}
|
||||
page_cache_release(swappage);
|
||||
goto repeat;
|
||||
}
|
||||
} else if (sgp == SGP_READ && !filepage) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue