Lines Matching refs:nr_pages
261 unsigned int nr_pages);
267 unsigned int nr_pages; in obj_cgroup_release() local
292 nr_pages = nr_bytes >> PAGE_SHIFT; in obj_cgroup_release()
294 if (nr_pages) in obj_cgroup_release()
295 obj_cgroup_uncharge_pages(objcg, nr_pages); in obj_cgroup_release()
470 unsigned long nr_pages = page_counter_read(&memcg->memory); in soft_limit_excess() local
474 if (nr_pages > soft_limit) in soft_limit_excess()
475 excess = nr_pages - soft_limit; in soft_limit_excess()
939 int nr_pages) in mem_cgroup_charge_statistics() argument
942 if (nr_pages > 0) in mem_cgroup_charge_statistics()
946 nr_pages = -nr_pages; /* for event */ in mem_cgroup_charge_statistics()
949 __this_cpu_add(memcg->vmstats_percpu->nr_page_events, nr_pages); in mem_cgroup_charge_statistics()
1385 int zid, int nr_pages) in mem_cgroup_update_lru_size() argument
1397 if (nr_pages < 0) in mem_cgroup_update_lru_size()
1398 *lru_size += nr_pages; in mem_cgroup_update_lru_size()
1403 __func__, lruvec, lru, nr_pages, size)) { in mem_cgroup_update_lru_size()
1408 if (nr_pages > 0) in mem_cgroup_update_lru_size()
1409 *lru_size += nr_pages; in mem_cgroup_update_lru_size()
2182 unsigned int nr_pages; member
2205 static void memcg_account_kmem(struct mem_cgroup *memcg, int nr_pages);
2217 static void memcg_account_kmem(struct mem_cgroup *memcg, int nr_pages) in memcg_account_kmem() argument
2233 static bool consume_stock(struct mem_cgroup *memcg, unsigned int nr_pages) in consume_stock() argument
2239 if (nr_pages > MEMCG_CHARGE_BATCH) in consume_stock()
2245 if (memcg == READ_ONCE(stock->cached) && stock->nr_pages >= nr_pages) { in consume_stock()
2246 stock->nr_pages -= nr_pages; in consume_stock()
2265 if (stock->nr_pages) { in drain_stock()
2266 page_counter_uncharge(&old->memory, stock->nr_pages); in drain_stock()
2268 page_counter_uncharge(&old->memsw, stock->nr_pages); in drain_stock()
2269 stock->nr_pages = 0; in drain_stock()
2303 static void __refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) in __refill_stock() argument
2313 stock->nr_pages += nr_pages; in __refill_stock()
2315 if (stock->nr_pages > MEMCG_CHARGE_BATCH) in __refill_stock()
2319 static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) in refill_stock() argument
2324 __refill_stock(memcg, nr_pages); in refill_stock()
2354 if (memcg && stock->nr_pages && in drain_all_stock()
2384 unsigned int nr_pages, in reclaim_high() argument
2399 nr_reclaimed += try_to_free_mem_cgroup_pages(memcg, nr_pages, in reclaim_high()
2523 unsigned int nr_pages, in calculate_high_delay() argument
2551 return penalty_jiffies * nr_pages / MEMCG_CHARGE_BATCH; in calculate_high_delay()
2563 unsigned int nr_pages = current->memcg_nr_pages_over_high; in mem_cgroup_handle_over_high() local
2568 if (likely(!nr_pages)) in mem_cgroup_handle_over_high()
2585 in_retry ? SWAP_CLUSTER_MAX : nr_pages, in mem_cgroup_handle_over_high()
2592 penalty_jiffies = calculate_high_delay(memcg, nr_pages, in mem_cgroup_handle_over_high()
2595 penalty_jiffies += calculate_high_delay(memcg, nr_pages, in mem_cgroup_handle_over_high()
2638 unsigned int nr_pages) in try_charge_memcg() argument
2640 unsigned int batch = max(MEMCG_CHARGE_BATCH, nr_pages); in try_charge_memcg()
2652 if (consume_stock(memcg, nr_pages)) in try_charge_memcg()
2667 if (batch > nr_pages) { in try_charge_memcg()
2668 batch = nr_pages; in try_charge_memcg()
2691 nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages, in try_charge_memcg()
2695 if (mem_cgroup_margin(mem_over_limit) >= nr_pages) in try_charge_memcg()
2715 if (nr_reclaimed && nr_pages <= (1 << PAGE_ALLOC_COSTLY_ORDER)) in try_charge_memcg()
2740 get_order(nr_pages * PAGE_SIZE))) { in try_charge_memcg()
2767 page_counter_charge(&memcg->memory, nr_pages); in try_charge_memcg()
2769 page_counter_charge(&memcg->memsw, nr_pages); in try_charge_memcg()
2774 if (batch > nr_pages) in try_charge_memcg()
2775 refill_stock(memcg, batch - nr_pages); in try_charge_memcg()
2828 unsigned int nr_pages) in try_charge() argument
2833 return try_charge_memcg(memcg, gfp_mask, nr_pages); in try_charge()
2836 static inline void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages) in cancel_charge() argument
2841 page_counter_uncharge(&memcg->memory, nr_pages); in cancel_charge()
2843 page_counter_uncharge(&memcg->memsw, nr_pages); in cancel_charge()
3060 static void memcg_account_kmem(struct mem_cgroup *memcg, int nr_pages) in memcg_account_kmem() argument
3062 mod_memcg_state(memcg, MEMCG_KMEM, nr_pages); in memcg_account_kmem()
3064 if (nr_pages > 0) in memcg_account_kmem()
3065 page_counter_charge(&memcg->kmem, nr_pages); in memcg_account_kmem()
3067 page_counter_uncharge(&memcg->kmem, -nr_pages); in memcg_account_kmem()
3078 unsigned int nr_pages) in obj_cgroup_uncharge_pages() argument
3084 memcg_account_kmem(memcg, -nr_pages); in obj_cgroup_uncharge_pages()
3085 refill_stock(memcg, nr_pages); in obj_cgroup_uncharge_pages()
3099 unsigned int nr_pages) in obj_cgroup_charge_pages() argument
3106 ret = try_charge_memcg(memcg, gfp, nr_pages); in obj_cgroup_charge_pages()
3110 memcg_account_kmem(memcg, nr_pages); in obj_cgroup_charge_pages()
3152 unsigned int nr_pages = 1 << order; in __memcg_kmem_uncharge_page() local
3158 obj_cgroup_uncharge_pages(objcg, nr_pages); in __memcg_kmem_uncharge_page()
3256 unsigned int nr_pages = stock->nr_bytes >> PAGE_SHIFT; in drain_obj_stock() local
3259 if (nr_pages) { in drain_obj_stock()
3264 memcg_account_kmem(memcg, -nr_pages); in drain_obj_stock()
3265 __refill_stock(memcg, nr_pages); in drain_obj_stock()
3332 unsigned int nr_pages = 0; in refill_obj_stock() local
3348 nr_pages = stock->nr_bytes >> PAGE_SHIFT; in refill_obj_stock()
3356 if (nr_pages) in refill_obj_stock()
3357 obj_cgroup_uncharge_pages(objcg, nr_pages); in refill_obj_stock()
3362 unsigned int nr_pages, nr_bytes; in obj_cgroup_charge() local
3391 nr_pages = size >> PAGE_SHIFT; in obj_cgroup_charge()
3395 nr_pages += 1; in obj_cgroup_charge()
3397 ret = obj_cgroup_charge_pages(objcg, gfp, nr_pages); in obj_cgroup_charge()
3850 unsigned long nr_pages; in mem_cgroup_write() local
3854 ret = page_counter_memparse(buf, "-1", &nr_pages); in mem_cgroup_write()
3866 ret = mem_cgroup_resize_max(memcg, nr_pages, false); in mem_cgroup_write()
3869 ret = mem_cgroup_resize_max(memcg, nr_pages, true); in mem_cgroup_write()
3879 ret = memcg_update_tcp_max(memcg, nr_pages); in mem_cgroup_write()
3887 WRITE_ONCE(memcg->soft_limit, nr_pages); in mem_cgroup_write()
5771 unsigned int nr_pages = compound ? folio_nr_pages(folio) : 1; in mem_cgroup_move_account() local
5791 __mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages); in mem_cgroup_move_account()
5792 __mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages); in mem_cgroup_move_account()
5795 -nr_pages); in mem_cgroup_move_account()
5797 nr_pages); in mem_cgroup_move_account()
5801 __mod_lruvec_state(from_vec, NR_FILE_PAGES, -nr_pages); in mem_cgroup_move_account()
5802 __mod_lruvec_state(to_vec, NR_FILE_PAGES, nr_pages); in mem_cgroup_move_account()
5805 __mod_lruvec_state(from_vec, NR_SHMEM, -nr_pages); in mem_cgroup_move_account()
5806 __mod_lruvec_state(to_vec, NR_SHMEM, nr_pages); in mem_cgroup_move_account()
5810 __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages); in mem_cgroup_move_account()
5811 __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages); in mem_cgroup_move_account()
5819 -nr_pages); in mem_cgroup_move_account()
5821 nr_pages); in mem_cgroup_move_account()
5828 __mod_lruvec_state(from_vec, NR_SWAPCACHE, -nr_pages); in mem_cgroup_move_account()
5829 __mod_lruvec_state(to_vec, NR_SWAPCACHE, nr_pages); in mem_cgroup_move_account()
5833 __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages); in mem_cgroup_move_account()
5834 __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages); in mem_cgroup_move_account()
5863 mem_cgroup_charge_statistics(to, nr_pages); in mem_cgroup_move_account()
5865 mem_cgroup_charge_statistics(from, -nr_pages); in mem_cgroup_move_account()
6500 unsigned long nr_pages = page_counter_read(&memcg->memory); in memory_high_write() local
6503 if (nr_pages <= high) in memory_high_write()
6515 reclaimed = try_to_free_mem_cgroup_pages(memcg, nr_pages - high, in memory_high_write()
6549 unsigned long nr_pages = page_counter_read(&memcg->memory); in memory_max_write() local
6551 if (nr_pages <= max) in memory_max_write()
6564 if (!try_to_free_mem_cgroup_pages(memcg, nr_pages - max, in memory_max_write()
6994 long nr_pages = folio_nr_pages(folio); in charge_memcg() local
6997 ret = try_charge(memcg, gfp, nr_pages); in charge_memcg()
7005 mem_cgroup_charge_statistics(memcg, nr_pages); in charge_memcg()
7130 long nr_pages; in uncharge_folio() local
7167 nr_pages = folio_nr_pages(folio); in uncharge_folio()
7170 ug->nr_memory += nr_pages; in uncharge_folio()
7171 ug->nr_kmem += nr_pages; in uncharge_folio()
7178 ug->nr_memory += nr_pages; in uncharge_folio()
7232 long nr_pages = folio_nr_pages(new); in mem_cgroup_migrate() local
7238 VM_BUG_ON_FOLIO(folio_nr_pages(old) != nr_pages, new); in mem_cgroup_migrate()
7254 page_counter_charge(&memcg->memory, nr_pages); in mem_cgroup_migrate()
7256 page_counter_charge(&memcg->memsw, nr_pages); in mem_cgroup_migrate()
7263 mem_cgroup_charge_statistics(memcg, nr_pages); in mem_cgroup_migrate()
7309 bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, in mem_cgroup_charge_skmem() argument
7315 if (page_counter_try_charge(&memcg->tcpmem, nr_pages, &fail)) { in mem_cgroup_charge_skmem()
7321 page_counter_charge(&memcg->tcpmem, nr_pages); in mem_cgroup_charge_skmem()
7327 if (try_charge(memcg, gfp_mask, nr_pages) == 0) { in mem_cgroup_charge_skmem()
7328 mod_memcg_state(memcg, MEMCG_SOCK, nr_pages); in mem_cgroup_charge_skmem()
7340 void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages) in mem_cgroup_uncharge_skmem() argument
7343 page_counter_uncharge(&memcg->tcpmem, nr_pages); in mem_cgroup_uncharge_skmem()
7347 mod_memcg_state(memcg, MEMCG_SOCK, -nr_pages); in mem_cgroup_uncharge_skmem()
7349 refill_stock(memcg, nr_pages); in mem_cgroup_uncharge_skmem()
7510 unsigned int nr_pages = folio_nr_pages(folio); in __mem_cgroup_try_charge_swap() local
7532 !page_counter_try_charge(&memcg->swap, nr_pages, &counter)) { in __mem_cgroup_try_charge_swap()
7540 if (nr_pages > 1) in __mem_cgroup_try_charge_swap()
7541 mem_cgroup_id_get_many(memcg, nr_pages - 1); in __mem_cgroup_try_charge_swap()
7542 oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg), nr_pages); in __mem_cgroup_try_charge_swap()
7544 mod_memcg_state(memcg, MEMCG_SWAP, nr_pages); in __mem_cgroup_try_charge_swap()
7554 void __mem_cgroup_uncharge_swap(swp_entry_t entry, unsigned int nr_pages) in __mem_cgroup_uncharge_swap() argument
7559 id = swap_cgroup_record(entry, 0, nr_pages); in __mem_cgroup_uncharge_swap()
7565 page_counter_uncharge(&memcg->memsw, nr_pages); in __mem_cgroup_uncharge_swap()
7567 page_counter_uncharge(&memcg->swap, nr_pages); in __mem_cgroup_uncharge_swap()
7569 mod_memcg_state(memcg, MEMCG_SWAP, -nr_pages); in __mem_cgroup_uncharge_swap()
7570 mem_cgroup_id_put_many(memcg, nr_pages); in __mem_cgroup_uncharge_swap()