Lines Matching refs:nr_pages

265 				      unsigned int nr_pages);
271 unsigned int nr_pages; in obj_cgroup_release() local
296 nr_pages = nr_bytes >> PAGE_SHIFT; in obj_cgroup_release()
298 if (nr_pages) in obj_cgroup_release()
299 obj_cgroup_uncharge_pages(objcg, nr_pages); in obj_cgroup_release()
514 unsigned long nr_pages = page_counter_read(&memcg->memory); in soft_limit_excess() local
518 if (nr_pages > soft_limit) in soft_limit_excess()
519 excess = nr_pages - soft_limit; in soft_limit_excess()
811 int nr_pages) in mem_cgroup_charge_statistics() argument
814 if (nr_pages > 0) in mem_cgroup_charge_statistics()
818 nr_pages = -nr_pages; /* for event */ in mem_cgroup_charge_statistics()
821 __this_cpu_add(memcg->vmstats_percpu->nr_page_events, nr_pages); in mem_cgroup_charge_statistics()
1258 int zid, int nr_pages) in mem_cgroup_update_lru_size() argument
1270 if (nr_pages < 0) in mem_cgroup_update_lru_size()
1271 *lru_size += nr_pages; in mem_cgroup_update_lru_size()
1276 __func__, lruvec, lru, nr_pages, size)) { in mem_cgroup_update_lru_size()
1281 if (nr_pages > 0) in mem_cgroup_update_lru_size()
1282 *lru_size += nr_pages; in mem_cgroup_update_lru_size()
2095 unsigned int nr_pages; member
2133 static bool consume_stock(struct mem_cgroup *memcg, unsigned int nr_pages) in consume_stock() argument
2139 if (nr_pages > MEMCG_CHARGE_BATCH) in consume_stock()
2145 if (memcg == stock->cached && stock->nr_pages >= nr_pages) { in consume_stock()
2146 stock->nr_pages -= nr_pages; in consume_stock()
2165 if (stock->nr_pages) { in drain_stock()
2166 page_counter_uncharge(&old->memory, stock->nr_pages); in drain_stock()
2168 page_counter_uncharge(&old->memsw, stock->nr_pages); in drain_stock()
2169 stock->nr_pages = 0; in drain_stock()
2202 static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) in refill_stock() argument
2215 stock->nr_pages += nr_pages; in refill_stock()
2217 if (stock->nr_pages > MEMCG_CHARGE_BATCH) in refill_stock()
2248 if (memcg && stock->nr_pages && in drain_all_stock()
2278 unsigned int nr_pages, in reclaim_high() argument
2293 nr_reclaimed += try_to_free_mem_cgroup_pages(memcg, nr_pages, in reclaim_high()
2416 unsigned int nr_pages, in calculate_high_delay() argument
2444 return penalty_jiffies * nr_pages / MEMCG_CHARGE_BATCH; in calculate_high_delay()
2456 unsigned int nr_pages = current->memcg_nr_pages_over_high; in mem_cgroup_handle_over_high() local
2461 if (likely(!nr_pages)) in mem_cgroup_handle_over_high()
2478 in_retry ? SWAP_CLUSTER_MAX : nr_pages, in mem_cgroup_handle_over_high()
2485 penalty_jiffies = calculate_high_delay(memcg, nr_pages, in mem_cgroup_handle_over_high()
2488 penalty_jiffies += calculate_high_delay(memcg, nr_pages, in mem_cgroup_handle_over_high()
2531 unsigned int nr_pages) in try_charge_memcg() argument
2533 unsigned int batch = max(MEMCG_CHARGE_BATCH, nr_pages); in try_charge_memcg()
2545 if (consume_stock(memcg, nr_pages)) in try_charge_memcg()
2560 if (batch > nr_pages) { in try_charge_memcg()
2561 batch = nr_pages; in try_charge_memcg()
2592 nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages, in try_charge_memcg()
2596 if (mem_cgroup_margin(mem_over_limit) >= nr_pages) in try_charge_memcg()
2616 if (nr_reclaimed && nr_pages <= (1 << PAGE_ALLOC_COSTLY_ORDER)) in try_charge_memcg()
2641 get_order(nr_pages * PAGE_SIZE)); in try_charge_memcg()
2656 page_counter_charge(&memcg->memory, nr_pages); in try_charge_memcg()
2658 page_counter_charge(&memcg->memsw, nr_pages); in try_charge_memcg()
2663 if (batch > nr_pages) in try_charge_memcg()
2664 refill_stock(memcg, batch - nr_pages); in try_charge_memcg()
2712 unsigned int nr_pages) in try_charge() argument
2717 return try_charge_memcg(memcg, gfp_mask, nr_pages); in try_charge()
2720 static inline void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages) in cancel_charge() argument
2725 page_counter_uncharge(&memcg->memory, nr_pages); in cancel_charge()
2727 page_counter_uncharge(&memcg->memsw, nr_pages); in cancel_charge()
2976 unsigned int nr_pages) in obj_cgroup_uncharge_pages() argument
2983 page_counter_uncharge(&memcg->kmem, nr_pages); in obj_cgroup_uncharge_pages()
2984 refill_stock(memcg, nr_pages); in obj_cgroup_uncharge_pages()
2998 unsigned int nr_pages) in obj_cgroup_charge_pages() argument
3005 ret = try_charge_memcg(memcg, gfp, nr_pages); in obj_cgroup_charge_pages()
3010 page_counter_charge(&memcg->kmem, nr_pages); in obj_cgroup_charge_pages()
3052 unsigned int nr_pages = 1 << order; in __memcg_kmem_uncharge_page() local
3058 obj_cgroup_uncharge_pages(objcg, nr_pages); in __memcg_kmem_uncharge_page()
3147 unsigned int nr_pages = stock->nr_bytes >> PAGE_SHIFT; in drain_obj_stock() local
3150 if (nr_pages) in drain_obj_stock()
3151 obj_cgroup_uncharge_pages(old, nr_pages); in drain_obj_stock()
3214 unsigned int nr_pages = 0; in refill_obj_stock() local
3227 nr_pages = stock->nr_bytes >> PAGE_SHIFT; in refill_obj_stock()
3233 if (nr_pages) in refill_obj_stock()
3234 obj_cgroup_uncharge_pages(objcg, nr_pages); in refill_obj_stock()
3239 unsigned int nr_pages, nr_bytes; in obj_cgroup_charge() local
3268 nr_pages = size >> PAGE_SHIFT; in obj_cgroup_charge()
3272 nr_pages += 1; in obj_cgroup_charge()
3274 ret = obj_cgroup_charge_pages(objcg, gfp, nr_pages); in obj_cgroup_charge()
3723 unsigned long nr_pages; in mem_cgroup_write() local
3727 ret = page_counter_memparse(buf, "-1", &nr_pages); in mem_cgroup_write()
3739 ret = mem_cgroup_resize_max(memcg, nr_pages, false); in mem_cgroup_write()
3742 ret = mem_cgroup_resize_max(memcg, nr_pages, true); in mem_cgroup_write()
3749 ret = memcg_update_tcp_max(memcg, nr_pages); in mem_cgroup_write()
3754 memcg->soft_limit = nr_pages; in mem_cgroup_write()
5556 unsigned int nr_pages = compound ? folio_nr_pages(folio) : 1; in mem_cgroup_move_account() local
5583 __mod_lruvec_state(from_vec, NR_ANON_MAPPED, -nr_pages); in mem_cgroup_move_account()
5584 __mod_lruvec_state(to_vec, NR_ANON_MAPPED, nr_pages); in mem_cgroup_move_account()
5587 -nr_pages); in mem_cgroup_move_account()
5589 nr_pages); in mem_cgroup_move_account()
5593 __mod_lruvec_state(from_vec, NR_FILE_PAGES, -nr_pages); in mem_cgroup_move_account()
5594 __mod_lruvec_state(to_vec, NR_FILE_PAGES, nr_pages); in mem_cgroup_move_account()
5597 __mod_lruvec_state(from_vec, NR_SHMEM, -nr_pages); in mem_cgroup_move_account()
5598 __mod_lruvec_state(to_vec, NR_SHMEM, nr_pages); in mem_cgroup_move_account()
5602 __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages); in mem_cgroup_move_account()
5603 __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages); in mem_cgroup_move_account()
5611 -nr_pages); in mem_cgroup_move_account()
5613 nr_pages); in mem_cgroup_move_account()
5619 __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages); in mem_cgroup_move_account()
5620 __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages); in mem_cgroup_move_account()
5649 mem_cgroup_charge_statistics(to, nr_pages); in mem_cgroup_move_account()
5651 mem_cgroup_charge_statistics(from, -nr_pages); in mem_cgroup_move_account()
6223 unsigned long nr_pages = page_counter_read(&memcg->memory); in memory_high_write() local
6226 if (nr_pages <= high) in memory_high_write()
6238 reclaimed = try_to_free_mem_cgroup_pages(memcg, nr_pages - high, in memory_high_write()
6272 unsigned long nr_pages = page_counter_read(&memcg->memory); in memory_max_write() local
6274 if (nr_pages <= max) in memory_max_write()
6287 if (!try_to_free_mem_cgroup_pages(memcg, nr_pages - max, in memory_max_write()
6663 long nr_pages = folio_nr_pages(folio); in charge_memcg() local
6666 ret = try_charge(memcg, gfp, nr_pages); in charge_memcg()
6674 mem_cgroup_charge_statistics(memcg, nr_pages); in charge_memcg()
6800 long nr_pages; in uncharge_folio() local
6838 nr_pages = folio_nr_pages(folio); in uncharge_folio()
6841 ug->nr_memory += nr_pages; in uncharge_folio()
6842 ug->nr_kmem += nr_pages; in uncharge_folio()
6849 ug->nr_memory += nr_pages; in uncharge_folio()
6903 long nr_pages = folio_nr_pages(new); in mem_cgroup_migrate() local
6909 VM_BUG_ON_FOLIO(folio_nr_pages(old) != nr_pages, new); in mem_cgroup_migrate()
6925 page_counter_charge(&memcg->memory, nr_pages); in mem_cgroup_migrate()
6927 page_counter_charge(&memcg->memsw, nr_pages); in mem_cgroup_migrate()
6934 mem_cgroup_charge_statistics(memcg, nr_pages); in mem_cgroup_migrate()
6980 bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, in mem_cgroup_charge_skmem() argument
6986 if (page_counter_try_charge(&memcg->tcpmem, nr_pages, &fail)) { in mem_cgroup_charge_skmem()
6992 page_counter_charge(&memcg->tcpmem, nr_pages); in mem_cgroup_charge_skmem()
6998 if (try_charge(memcg, gfp_mask, nr_pages) == 0) { in mem_cgroup_charge_skmem()
6999 mod_memcg_state(memcg, MEMCG_SOCK, nr_pages); in mem_cgroup_charge_skmem()
7011 void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages) in mem_cgroup_uncharge_skmem() argument
7014 page_counter_uncharge(&memcg->tcpmem, nr_pages); in mem_cgroup_uncharge_skmem()
7018 mod_memcg_state(memcg, MEMCG_SOCK, -nr_pages); in mem_cgroup_uncharge_skmem()
7020 refill_stock(memcg, nr_pages); in mem_cgroup_uncharge_skmem()
7179 unsigned int nr_pages = thp_nr_pages(page); in __mem_cgroup_try_charge_swap() local
7201 !page_counter_try_charge(&memcg->swap, nr_pages, &counter)) { in __mem_cgroup_try_charge_swap()
7209 if (nr_pages > 1) in __mem_cgroup_try_charge_swap()
7210 mem_cgroup_id_get_many(memcg, nr_pages - 1); in __mem_cgroup_try_charge_swap()
7211 oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg), nr_pages); in __mem_cgroup_try_charge_swap()
7213 mod_memcg_state(memcg, MEMCG_SWAP, nr_pages); in __mem_cgroup_try_charge_swap()
7223 void __mem_cgroup_uncharge_swap(swp_entry_t entry, unsigned int nr_pages) in __mem_cgroup_uncharge_swap() argument
7228 id = swap_cgroup_record(entry, 0, nr_pages); in __mem_cgroup_uncharge_swap()
7234 page_counter_uncharge(&memcg->swap, nr_pages); in __mem_cgroup_uncharge_swap()
7236 page_counter_uncharge(&memcg->memsw, nr_pages); in __mem_cgroup_uncharge_swap()
7238 mod_memcg_state(memcg, MEMCG_SWAP, -nr_pages); in __mem_cgroup_uncharge_swap()
7239 mem_cgroup_id_put_many(memcg, nr_pages); in __mem_cgroup_uncharge_swap()