Lines Matching defs:swap
47 #include <linux/swap.h>
71 #include "swap.h"
100 /* Whether legacy memory+swap accounting is active */
1701 pr_info("swap: usage %llukB, limit %llukB, failcnt %lu\n",
1702 K((u64)page_counter_read(&memcg->swap)),
1703 K((u64)READ_ONCE(memcg->swap.max)), memcg->swap.failcnt);
1705 pr_info("memory+swap: usage %llukB, limit %llukB, failcnt %lu\n",
1722 * Return the memory (and swap, if configured) limit for a memcg.
1730 /* Calculate swap excess capacity from memsw limit */
1731 unsigned long swap = READ_ONCE(memcg->memsw.max) - max;
1733 max += min(swap, (unsigned long)total_swap_pages);
1737 max += min(READ_ONCE(memcg->swap.max),
2537 overage = calculate_overage(page_counter_read(&memcg->swap),
2538 READ_ONCE(memcg->swap.high));
2821 swap_high = page_counter_read(&memcg->swap) >
2822 READ_ONCE(memcg->swap.high);
2837 * of the memory or swap footprints.
3464 * mem_cgroup_move_swap_account - move swap charge and swap_cgroup's record.
3465 * @entry: swap entry to be moved
3695 static unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
3706 if (swap)
3709 if (!swap)
4115 "swap",
4230 static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap)
4237 if (!swap)
4245 usage = mem_cgroup_usage(memcg, swap);
5425 page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX);
5431 page_counter_init(&memcg->swap, &parent->swap);
5437 page_counter_init(&memcg->swap, NULL);
5597 page_counter_set_max(&memcg->swap, PAGE_COUNTER_MAX);
5604 page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX);
5773 * stored as special swap entries in the page table.
5814 /* shmem/tmpfs may report page out on swap: account for that too. */
5948 * @target: the pointer the target page or swap ent will be stored(can be NULL)
5956 * * MC_TARGET_SWAP - If the swap entry corresponding to this pte is a
5976 * from other swap handling below.
6028 * There is a swap entry and a page doesn't exist or isn't charged.
6164 /* uncharge swap account from the old cgroup */
7103 * @entry: swap entry for which the folio is allocated
7134 * mem_cgroup_swapin_uncharge_swap - uncharge swap slot
7135 * @entry: swap entry for which the page is charged
7139 * Note: This function assumes the page for which swap slot is being uncharged
7145 * Cgroup1's unified memory+swap counter has been charged with the
7146 * new swapcache page, finish the transfer by uncharging the swap
7147 * slot. The swap slot would also get uncharged when it dies, but
7151 * Cgroup2 has separate resource counters for memory and swap,
7152 * so this is a non-issue here. Memory and swap charge lifetimes
7153 * correspond 1:1 to page and swap slot lifetimes: we charge the
7154 * page to memory here, and uncharge swap when the slot is freed.
7158 * The swap entry might not get freed for a long time,
7160 * memory+swap charge, drop the swap entry duplicate.
7508 * mem_cgroup_swapout - transfer a memsw charge to swap
7510 * @entry: swap entry to move the charge to
7538 * ancestor for the swap instead and transfer the memory+swap charge.
7576 * __mem_cgroup_try_charge_swap - try charging swap space for a folio
7577 * @folio: folio being added to swap
7578 * @entry: swap entry to charge
7580 * Try to charge @folio's memcg for the swap space at @entry.
7608 !page_counter_try_charge(&memcg->swap, nr_pages, &counter)) {
7626 * __mem_cgroup_uncharge_swap - uncharge swap space
7627 * @entry: swap entry to uncharge
7628 * @nr_pages: the amount of swap space to uncharge
7643 page_counter_uncharge(&memcg->swap, nr_pages);
7659 READ_ONCE(memcg->swap.max) -
7660 page_counter_read(&memcg->swap));
7680 unsigned long usage = page_counter_read(&memcg->swap);
7682 if (usage * 2 >= READ_ONCE(memcg->swap.high) ||
7683 usage * 2 >= READ_ONCE(memcg->swap.max))
7696 "in favor of configuring swap control via cgroupfs. "
7708 return (u64)page_counter_read(&memcg->swap) * PAGE_SIZE;
7716 return (u64)memcg->swap.watermark * PAGE_SIZE;
7722 READ_ONCE(mem_cgroup_from_seq(m)->swap.high));
7737 page_counter_set_high(&memcg->swap, high);
7745 READ_ONCE(mem_cgroup_from_seq(m)->swap.max));
7760 xchg(&memcg->swap.max, max);
7781 .name = "swap.current",
7786 .name = "swap.high",
7792 .name = "swap.max",
7798 .name = "swap.peak",
7803 .name = "swap.events",