aboutsummaryrefslogtreecommitdiffstats
path: root/mm/shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index bd9b4ea307b2..adf5c3eedbc9 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -928,8 +928,12 @@ found:
928 error = 1; 928 error = 1;
929 if (!inode) 929 if (!inode)
930 goto out; 930 goto out;
931 /* Charge page using GFP_HIGHUSER_MOVABLE while we can wait */ 931 /*
932 error = mem_cgroup_cache_charge(page, current->mm, GFP_HIGHUSER_MOVABLE); 932 * Charge page using GFP_HIGHUSER_MOVABLE while we can wait.
933 * charged back to the user(not to caller) when swap account is used.
934 */
935 error = mem_cgroup_cache_charge_swapin(page,
936 current->mm, GFP_HIGHUSER_MOVABLE, true);
933 if (error) 937 if (error)
934 goto out; 938 goto out;
935 error = radix_tree_preload(GFP_KERNEL); 939 error = radix_tree_preload(GFP_KERNEL);
@@ -1266,6 +1270,16 @@ repeat:
1266 goto repeat; 1270 goto repeat;
1267 } 1271 }
1268 wait_on_page_locked(swappage); 1272 wait_on_page_locked(swappage);
1273 /*
1274 * We want to avoid charge at add_to_page_cache().
1275 * charge against this swap cache here.
1276 */
1277 if (mem_cgroup_cache_charge_swapin(swappage,
1278 current->mm, gfp, false)) {
1279 page_cache_release(swappage);
1280 error = -ENOMEM;
1281 goto failed;
1282 }
1269 page_cache_release(swappage); 1283 page_cache_release(swappage);
1270 goto repeat; 1284 goto repeat;
1271 } 1285 }